當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。