当前位置: 首页>>代码示例>>PHP>>正文


PHP Node\PyStringNode类代码示例

本文整理汇总了PHP中Behat\Gherkin\Node\PyStringNode的典型用法代码示例。如果您正苦于以下问题:PHP PyStringNode类的具体用法?PHP PyStringNode怎么用?PHP PyStringNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PyStringNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: theSystemShouldHaveTheFollowingOperations

 /**
  * @Then the system should have the following info sms subscription low balance reminder logs:
  *
  * @param PyStringNode $body
  */
 public function theSystemShouldHaveTheFollowingOperations(PyStringNode $body)
 {
     /** @var CollectLogsTestWorker $collectLogsTestWorker */
     $collectLogsTestWorker = $this->kernel->getContainer()->get('muchacuba.info_sms.subscription.low_balance_reminder.collect_logs_test_worker');
     Assert::assertTrue((new SimpleFactory())->createMatcher()->match(iterator_to_array($collectLogsTestWorker->collect()), (array) json_decode($body->getRaw(), true)));
     $this->rootContext->ignoreState('Muchacuba\\InfoSms\\Subscription\\LowBalanceReminder\\Log');
 }
开发者ID:nabelhm,项目名称:api,代码行数:12,代码来源:Context.php

示例2: theSystemShouldHaveTheFollowingDebtOperations

 /**
  * @Given the system should have the following recharge card profiles debt operations
  */
 public function theSystemShouldHaveTheFollowingDebtOperations(PyStringNode $body)
 {
     /** @var CollectOperationsTestWorker $collectOperationsTestWorker */
     $collectOperationsTestWorker = $this->kernel->getContainer()->get('muchacuba.recharge_card.profile.debt.collect_operations_test_worker');
     Assert::assertTrue((new SimpleFactory())->createMatcher()->match(iterator_to_array($collectOperationsTestWorker->collect()), (array) json_decode($body->getRaw(), true)));
     $this->rootContext->ignoreState('Muchacuba\\RechargeCard\\Profile\\Debt\\Operation');
 }
开发者ID:nabelhm,项目名称:api,代码行数:10,代码来源:Context.php

示例3: iSendARequestToUrlWithBody

 /**
  * @When I send a :method request to URL :url with body:
  */
 public function iSendARequestToUrlWithBody($method, $url, PyStringNode $body)
 {
     $bodyReplace = $body->getRaw();
     $bodyReplace = $this->replaceParameters($bodyReplace);
     $body = new PyStringNode([$bodyReplace], $body->getLine());
     $this->restContext->iSendARequestToWithBody($method, $this->replaceParameters($url), $body);
 }
开发者ID:hogosha,项目名称:hogosha,代码行数:10,代码来源:ApiContext.php

示例4: theSystemShouldHaveTheFollowingUniquenesses

 /**
  * @Given the system should have the following uniquenesses:
  */
 public function theSystemShouldHaveTheFollowingUniquenesses(PyStringNode $body)
 {
     /** @var CollectUniquenessTestWorker $collectUniquenessTestWorker */
     $collectUniquenessTestWorker = $this->kernel->getContainer()->get('cubalider.unique.collect_uniqueness_test_worker');
     Assert::assertTrue((new SimpleFactory())->createMatcher()->match(iterator_to_array($collectUniquenessTestWorker->collect()), (array) json_decode($body->getRaw(), true)));
     $this->rootContext->ignoreState('Cubalider\\Uniqueness');
 }
开发者ID:nabelhm,项目名称:api,代码行数:10,代码来源:UniquenessContext.php

示例5:

 function it_saves_behat_feature_file(PyStringNode $config, Filesystem $filesystem)
 {
     $config->getRaw()->willReturn('Feature: test');
     $filesystem->dumpFile(Argument::containingString('/features/feature.feature'), 'Feature: test')->shouldBeCalled();
     $this->createWorkingDirectory();
     $this->iHaveTheFeature($config);
 }
开发者ID:elvetemedve,项目名称:behat-test-runner,代码行数:7,代码来源:TestRunnerContextSpec.php

示例6: thereExistsASnippetTemplateWithTheFollowingPropertyConfiguration

    /**
     * @Given there exists a snippet template ":name" with the following property configuration
     */
    public function thereExistsASnippetTemplateWithTheFollowingPropertyConfiguration($name, PyStringNode $string)
    {
        $template = <<<EOT
<?xml version="1.0" ?>

<template xmlns="http://schemas.sulu.io/template/template"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd"
          >

    <key>%s</key>

    <properties>
        <property name="title" type="text_line" mandatory="true">
            <meta>
                <title lang="de">Title</title>
                <title lang="en">Title</title>
            </meta>
        </property>

%s

    </properties>
</template>
EOT;
        $template = sprintf($template, $name, $string->getRaw());
        $this->createStructureTemplate('snippet', $name, $template);
    }
开发者ID:ollietb,项目名称:sulu,代码行数:31,代码来源:SnippetContext.php

示例7: iShouldGetTheFollowingData

 /**
  * @Then I should get the following data:
  *
  * @param PyStringNode $string
  *
  * @throws \Exception
  */
 public function iShouldGetTheFollowingData(PyStringNode $string)
 {
     $matcher = (new SimpleFactory())->createMatcher();
     if (!$matcher->match(json_decode(json_encode($this->result), true), json_decode((string) $string->getRaw(), true))) {
         throw new \Exception($matcher->getError());
     }
 }
开发者ID:cubalider,项目名称:internet-profile,代码行数:14,代码来源:Context.php

示例8: theSystemShouldHaveTheFollowingInternetProfiles

 /**
  * @Given the system should have the following internet profiles:
  *
  * @param PyStringNode $body
  *
  */
 public function theSystemShouldHaveTheFollowingInternetProfiles(PyStringNode $body)
 {
     /** @var CollectProfilesTestWorker $collectProfilesTestWorker */
     $collectProfilesTestWorker = $this->kernel->getContainer()->get('muchacuba.internet.collect_profiles_test_worker');
     Assert::assertTrue((new SimpleFactory())->createMatcher()->match(iterator_to_array($collectProfilesTestWorker->collect()), (array) json_decode($body->getRaw(), true)));
     $this->rootContext->ignoreState('Muchacuba\\Internet\\Profile');
 }
开发者ID:nabelhm,项目名称:api,代码行数:13,代码来源:Context.php

示例9: exportedFileOfShouldContain

 /**
  * @param string       $code
  * @param PyStringNode $csv
  *
  * @Then /^exported file of "([^"]*)" should contain:$/
  *
  * @throws ExpectationException
  * @throws \Exception
  */
 public function exportedFileOfShouldContain($code, PyStringNode $csv)
 {
     $config = $this->getFixturesContext()->getJobInstance($code)->getRawConfiguration();
     $path = $this->getMainContext()->getSubcontext('job')->getJobInstancePath($code);
     if (!is_file($path)) {
         throw $this->getMainContext()->createExpectationException(sprintf('File "%s" doesn\'t exist', $path));
     }
     $delimiter = isset($config['delimiter']) ? $config['delimiter'] : ';';
     $enclosure = isset($config['enclosure']) ? $config['enclosure'] : '"';
     $escape = isset($config['escape']) ? $config['escape'] : '\\';
     $csvFile = new \SplFileObject($path);
     $csvFile->setFlags(\SplFileObject::READ_CSV | \SplFileObject::READ_AHEAD | \SplFileObject::SKIP_EMPTY | \SplFileObject::DROP_NEW_LINE);
     $csvFile->setCsvControl($delimiter, $enclosure, $escape);
     $expectedLines = [];
     foreach ($csv->getLines() as $line) {
         if (!empty($line)) {
             $expectedLines[] = explode($delimiter, str_replace($enclosure, '', $line));
         }
     }
     $actualLines = [];
     while ($data = $csvFile->fgetcsv()) {
         if (!empty($data)) {
             $actualLines[] = array_map(function ($item) use($enclosure) {
                 return str_replace($enclosure, '', $item);
             }, $data);
         }
     }
     $expectedCount = count($expectedLines);
     $actualCount = count($actualLines);
     assertSame($expectedCount, $actualCount, sprintf('Expecting to see %d rows, found %d', $expectedCount, $actualCount));
     if (md5(json_encode($actualLines[0])) !== md5(json_encode($expectedLines[0]))) {
         throw new \Exception(sprintf('Header in the file %s does not match expected one: %s', $path, implode(' | ', $actualLines[0])));
     }
     unset($actualLines[0]);
     unset($expectedLines[0]);
     foreach ($expectedLines as $expectedLine) {
         $originalExpectedLine = $expectedLine;
         $found = false;
         foreach ($actualLines as $index => $actualLine) {
             // Order of columns is not ensured
             // Sorting the line values allows to have two identical lines
             // with values in different orders
             sort($expectedLine);
             sort($actualLine);
             // Same thing for the rows
             // Order of the rows is not reliable
             // So we generate a hash for the current line and ensured that
             // the generated file contains a line with the same hash
             if (md5(json_encode($actualLine)) === md5(json_encode($expectedLine))) {
                 $found = true;
                 // Unset line to prevent comparing it twice
                 unset($actualLines[$index]);
                 break;
             }
         }
         if (!$found) {
             throw new \Exception(sprintf('Could not find a line containing "%s" in %s', implode(' | ', $originalExpectedLine), $path));
         }
     }
 }
开发者ID:SamirBoulil,项目名称:pim-community-dev,代码行数:69,代码来源:ExportProfilesContext.php

示例10: theResponseShouldBe

 /**
  * @Then /^(?:the )?response should be:$/
  */
 public function theResponseShouldBe(PyStringNode $content)
 {
     if ($this->getResponseHeader('Content-Type') === 'application/json') {
         $this->assertJsonStringEqualsJsonString($this->adaptContent($content->getRaw()), $this->getResponse()->getContent(), sprintf('The content of the response is not the expected'));
     } else {
         Assertions::assertEquals($content->getRaw(), $this->getResponse()->getContent(), sprintf('The content of the response is not the expected'));
     }
 }
开发者ID:JavierCane,项目名称:mpwar,代码行数:11,代码来源:FeatureContext.php

示例11: itShouldContain

 /**
  * @Then /^it should contain:$/
  */
 public function itShouldContain(PyStringNode $string)
 {
     $sql = file_get_contents($this->workingDirectory . '/behat_table.sql');
     if (empty($sql) || !preg_match(sprintf('/%s/', preg_quote($string->getRaw())), $sql)) {
         $this->printDebug($sql);
         throw new Exception('Content not found');
     }
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:11,代码来源:FeatureContext.php

示例12: iSendARequestToWithBody

 /**
  * Sends a HTTP request with a body
  *
  * @Given I send a :method request to :url with body:
  */
 public function iSendARequestToWithBody($method, $url, PyStringNode $body)
 {
     $client = $this->getSession()->getDriver()->getClient();
     // intercept redirection
     $client->followRedirects(false);
     $client->request($method, $this->locatePath($url), array(), array(), array(), $body->getRaw());
     $client->followRedirects(true);
 }
开发者ID:ducbin,项目名称:behatch-contexts,代码行数:13,代码来源:RestContext.php

示例13: iShouldSee

 /**
  * @Then I should see:
  */
 public function iShouldSee(PyStringNode $content)
 {
     $displayArray = explode("\n", $this->tester->getDisplay());
     array_walk($displayArray, function (&$line) {
         $line = rtrim($line);
     });
     expect($displayArray)->shouldBeLike($content->getStrings());
 }
开发者ID:phpzone,项目名称:shell,代码行数:11,代码来源:ApplicationContext.php

示例14: theResponseShouldEqualToJson

 /**
  * @Then /^(?:the )?response should equal to json:$/
  */
 public function theResponseShouldEqualToJson(PyStringNode $jsonString)
 {
     $expected = json_decode($jsonString->getRaw(), true);
     $actual = $this->lastResponse;
     if (null === $expected) {
         throw new \RuntimeException("Can not convert etalon to json:\n" . $jsonString->getRaw());
     }
     assertEquals($expected, $actual, "Failed asserting that equals to \n" . print_r($actual, true));
 }
开发者ID:nickl-,项目名称:php-github-api,代码行数:12,代码来源:FeatureContext.php

示例15: theSystemHasTheFollowingUserAccounts

 /**
  * @When the system has the following user accounts:
  *
  * @param PyStringNode $body
  */
 public function theSystemHasTheFollowingUserAccounts(PyStringNode $body)
 {
     /** @var CreateAccountTestWorker $createAccountTestWorker */
     $createAccountTestWorker = $this->kernel->getContainer()->get('muchacuba.user.create_account_test_worker');
     $items = json_decode($body->getRaw(), true);
     foreach ($items as $item) {
         $createAccountTestWorker->create($item['id'], $item['username'], $item['password'], $item['roles']);
     }
 }
开发者ID:nabelhm,项目名称:api,代码行数:14,代码来源:Context.php


注:本文中的Behat\Gherkin\Node\PyStringNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。