當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TableNode::getTable方法代碼示例

本文整理匯總了PHP中Behat\Gherkin\Node\TableNode::getTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP TableNode::getTable方法的具體用法?PHP TableNode::getTable怎麽用?PHP TableNode::getTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Behat\Gherkin\Node\TableNode的用法示例。


在下文中一共展示了TableNode::getTable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ensureContentTypeGroupsExists

 /**
  * @Given there are the following Content Type Groups:
  *
  * Make sure that content type groups in the provided table exist, by identifier. Example:
  *      | group                 |
  *      | testContentTypeGroup1 |
  *      | testContentTypeGroup2 |
  *      | testContentTypeGroup3 |
  */
 public function ensureContentTypeGroupsExists(TableNode $table)
 {
     $contentTypeGroups = $table->getTable();
     array_shift($contentTypeGroups);
     foreach ($contentTypeGroups as $contentTypeGroup) {
         $this->ensureContentTypeGroupExists($contentTypeGroup[0]);
     }
 }
開發者ID:ezsystems,項目名稱:behatbundle,代碼行數:17,代碼來源:ContentTypeGroup.php

示例2: truncatedTables

 /**
  * @Given /^Truncated tables$/
  * @param TableNode $table
  */
 public function truncatedTables(TableNode $table)
 {
     foreach ($table->getTable() as $tableNames) {
         foreach ($tableNames as $tableName) {
             $this->clearTable($tableName);
         }
     }
 }
開發者ID:Combination,項目名稱:BehatDatabaseFixtureExtension,代碼行數:12,代碼來源:CoreContext.php

示例3: iCallTheOperation

 /**
  * @When I call the :operation operation
  * @When I call the :operation operation with
  */
 public function iCallTheOperation($operation, TableNode $table = null)
 {
     $this->result = null;
     $args = [];
     if ($table) {
         foreach ($table->getTable() as $row) {
             $args[$row[0]] = $row[1];
         }
     }
     $this->result = call_user_func([$this->sdk, $operation], $args);
 }
開發者ID:rwentzeis,項目名稱:sdk,代碼行數:15,代碼來源:SdkContext.php

示例4: transformTableNode

 /**
  * @param TableNode $table
  * @return TableNode
  */
 protected function transformTableNode(TableNode $table)
 {
     $tempList = $table->getTable();
     foreach ($tempList as $key => $row) {
         foreach ($row as $columnKey => $column) {
             $newValue = $this->transformValue($column);
             $tempList[$key][$columnKey] = $newValue;
         }
     }
     return new TableNode($tempList);
 }
開發者ID:timitao,項目名稱:behatplaceholderextension,代碼行數:15,代碼來源:PlaceholderArgumentTransformer.php

示例5: iCallTheOperation

 /**
  * @When I call the :operation operation
  * @When I call the :operation operation with
  */
 public function iCallTheOperation($operation, TableNode $table = null)
 {
     $this->result = null;
     $args = [];
     if ($table) {
         foreach ($table->getTable() as $row) {
             if (isset($query)) {
                 $query .= "&";
             } else {
                 $query = '';
             }
             $query .= $row[0] . '=' . $row[1];
         }
         if ($query) {
             parse_str($query, $args);
         }
     }
     try {
         $this->result = call_user_func([$this->sdk, $operation], $args);
     } catch (CommandClientException $e) {
         $this->exception = $e;
     }
 }
開發者ID:continuousphp,項目名稱:sdk,代碼行數:27,代碼來源:SdkContext.php

示例6: applicationExists

 /**
  * @Then I should have the application
  */
 public function applicationExists(TableNode $table)
 {
     /** @var ApplicationManager $applicationManager */
     $applicationManager = self::$application->getServiceManager()->get('application/application-manager');
     $data = [];
     foreach ($table->getTable() as $row) {
         $data[$row[0]] = $row[1];
     }
     $application = $applicationManager->get($data['name']);
     \PHPUnit_Framework_Assert::assertInstanceOf('Continuous\\DeployAgent\\Application\\Application', $application);
     foreach ($data as $property => $value) {
         switch ($property) {
             case 'pipeline':
                 $property = 'reference';
             case 'token':
             case 'repositoryProvider':
             case 'repository':
                 \PHPUnit_Framework_Assert::assertAttributeEquals($value, $property, $application->getProvider());
                 break;
             case 'provider':
                 $provider = self::$application->getServiceManager()->get('provider/' . $value);
                 \PHPUnit_Framework_Assert::assertAttributeInstanceOf(get_class($provider), $property, $application);
                 break;
             default:
                 \PHPUnit_Framework_Assert::assertAttributeEquals($value, $property, $application);
         }
     }
 }
開發者ID:continuousphp,項目名稱:deploy-agent,代碼行數:31,代碼來源:DeployAgentContext.php

示例7: theFollowingHeadersShouldBeSet

 /**
  * @Then The following headers should be set
  * @param \Behat\Gherkin\Node\TableNode $table
  * @throws \Exception
  */
 public function theFollowingHeadersShouldBeSet(\Behat\Gherkin\Node\TableNode $table)
 {
     foreach ($table->getTable() as $header) {
         $headerName = $header[0];
         $expectedHeaderValue = $header[1];
         $returnedHeader = $this->response->getHeader($headerName);
         if ($returnedHeader !== $expectedHeaderValue) {
             throw new \Exception(sprintf("Expected value '%s' for header '%s', got '%s'", $expectedHeaderValue, $headerName, $returnedHeader));
         }
     }
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:16,代碼來源:WebDav.php

示例8: assertUserWithNameExistsWithFields

 /**
  * @Then User with name :username has the following fields:
  * @Then User with name :username exists with the following fields:
  *
  * Checks that user ':username' exists with the values provided in the field/value table. example:
  *       | Name          | value           |
  *       | email         | testuser@ez.no  |
  *       | password      | testuser        |
  *       | first_name    | Test            |
  *       | last_name     | User            |
  */
 public function assertUserWithNameExistsWithFields($username, TableNode $table)
 {
     Assertion::assertTrue($this->checkUserExistenceByUsername($username), "Couldn't find User with name '{$username}'.");
     $user = $this->userService->loadUserByLogin($username);
     $fieldsTable = $table->getTable();
     array_shift($fieldsTable);
     $updateFields = array();
     foreach ($fieldsTable as $fieldRow) {
         $fieldName = $fieldRow[0];
         $expectedValue = $fieldRow[1];
         switch ($fieldName) {
             case 'email':
                 $fieldValue = $user->email;
                 break;
             case 'password':
                 $fieldValue = $user->passwordHash;
                 $expectedValue = $this->createPasswordHash($username, $expectedValue, $user->hashAlgorithm);
                 break;
             default:
                 $fieldValue = $user->getFieldValue($fieldName);
         }
         Assertion::assertEquals($expectedValue, $fieldValue, "Field '{$fieldName}' did not contain expected value '{$expectedValue}'.");
     }
 }
開發者ID:ezsystems,項目名稱:ezpublish-kernel,代碼行數:35,代碼來源:UserContext.php

示例9: theOrderTotalsShouldBeAsFollows

 /**
  * @Then The order totals should be as follows
  */
 public function theOrderTotalsShouldBeAsFollows(TableNode $table)
 {
     $orderTotals = $this->_getOrderTotals();
     $data = $table->getTable();
     foreach ($data as $expectedTotals) {
         if (count($expectedTotals) !== 2) {
             throw new \Exception('Malformed table. Each row should have two columns');
         }
         $expectedValue = array_pop($expectedTotals);
         $expectedKey = array_pop($expectedTotals);
         if (!isset($orderTotals[$expectedKey])) {
             throw new \Exception("Expected to find a total of {$expectedKey} but this was not found on the page");
         }
         if ($orderTotals[$expectedKey] !== $expectedValue) {
             throw new \Exception("Expected {$expectedKey} to have a value of {$expectedValue}, found {$orderTotals[$expectedKey]}");
         }
     }
 }
開發者ID:edmondscommerce,項目名稱:behat-magento-one-context,代碼行數:21,代碼來源:AdminContext.php

示例10: iHaveTheFollowingUserGroups

 /**
  * @Given there are the following User Groups:
  *
  * Make sure that user groups in the provided table exist in their respective parent group. Example:
  *       | childGroup      | parentGroup      |
  *       | testUserGroup1  | Members          | # should create.
  *       | testUserGroup1  | Editors          | # should create.
  *       | testUserGroup3  | Test Parent      | # parent and child should be created.
  *       | innerGroup3-1   | testUserGroup3   | # should be created inside previous.
  */
 public function iHaveTheFollowingUserGroups(TableNode $table)
 {
     $userGroups = $table->getTable();
     array_shift($userGroups);
     foreach ($userGroups as $userGroup) {
         $this->getUserGroupManager()->ensureUserGroupExists($userGroup[0], $userGroup[1]);
     }
 }
開發者ID:ezsystems,項目名稱:behatbundle,代碼行數:18,代碼來源:UserGroup.php

示例11: testGetTable

 public function testGetTable()
 {
     $table = new TableNode($a = array(5 => array('username', 'password'), 10 => array('everzet', 'qwerty'), 13 => array('antono', 'pa$sword')));
     $this->assertEquals($a, $table->getTable());
 }
開發者ID:higrow,項目名稱:Gherkin,代碼行數:5,代碼來源:TableNodeTest.php

示例12: transformRowTable

 /**
  * Helper method to transform column names in row tables.
  *
  * @param \Behat\Gherkin\Node\TableNode $table_node
  *   The table to transform.
  * @param array $aliases
  *   An associative array of aliases that are uses for the column names. Keyed
  *   by alias, and with the transformed string as value.
  *
  * @return \Behat\Gherkin\Node\TableNode
  *   The transformed table
  *
  * @see self::transformArticleNodeTable()
  */
 protected function transformRowTable(TableNode $table_node, array $aliases)
 {
     $table = $table_node->getTable();
     array_walk($table, function (&$row) use($aliases) {
         // The first column of the row contains the field names. Replace the
         // aliased field name with the machine name if it exists.
         if (array_key_exists($row[0], $aliases)) {
             $row[0] = $aliases[$row[0]];
         }
     });
     return new TableNode($table);
 }
開發者ID:ec-europa,項目名稱:platform-dev,代碼行數:26,代碼來源:FeatureContext.php

示例13: transformPostContentTable

 /**
  * Transforms human readable field names into machine names.
  *
  * This is used in field_handlers.feature for testing if human readable names
  * can be used instead of machine names in tests.
  *
  * @param TableNode $post_table
  *   The original table.
  *
  * @return TableNode
  *   The transformed table.
  *
  * @Transform rowtable:title,body,reference,date,links,select,address
  */
 public function transformPostContentTable(TableNode $post_table)
 {
     $aliases = array('reference' => 'field_post_reference', 'date' => 'field_post_date', 'links' => 'field_post_links', 'select' => 'field_post_select', 'address' => 'field_post_address');
     $table = $post_table->getTable();
     array_walk($table, function (&$row) use($aliases) {
         // The first column of the row contains the field names. Replace the
         // human readable field name with the machine name if it exists.
         if (array_key_exists($row[0], $aliases)) {
             $row[0] = $aliases[$row[0]];
         }
     });
     return new TableNode($table);
 }
開發者ID:alfonsojoven,項目名稱:drupalextension,代碼行數:27,代碼來源:FeatureContext.php

示例14: castUsersTable

 /**
  * Transforms long address field columns into shorter aliases.
  *
  * This is used in field_handlers.feature for testing if lengthy field:column
  * combinations can be shortened to more human friendly aliases.
  *
  * @Transform table:name,mail,street,city,postcode,country
  */
 public function castUsersTable(TableNode $user_table)
 {
     $aliases = ['country' => 'field_post_address:country', 'city' => 'field_post_address:locality', 'street' => 'field_post_address:thoroughfare', 'postcode' => 'field_post_address:postal_code'];
     // The first row of the table contains the field names.
     $table = $user_table->getTable();
     reset($table);
     $first_row = key($table);
     // Replace the aliased field names with the actual ones.
     foreach ($table[$first_row] as $key => $alias) {
         if (array_key_exists($alias, $aliases)) {
             $table[$first_row][$key] = $aliases[$alias];
         }
     }
     return new TableNode($table);
 }
開發者ID:nedjo,項目名稱:drupalextension,代碼行數:23,代碼來源:FeatureContext.php

示例15: breadcrumbHasTheFollowingLinks

 /**
  * Tests if a link is present in the breadcrumbs.
  * @Then the breadcrumb has the following links:
  */
 public function breadcrumbHasTheFollowingLinks(TableNode $table)
 {
     foreach ($table->getTable() as $breadcrumbItem) {
         $text = $breadcrumbItem[0];
         $url = $breadcrumbItem[1];
         // this is not a link (the current page)
         if ($url === 'null') {
             $query = sprintf('//ul[@id="wo-breadcrumbs"]/li/span[text()="%s"]', $text);
         } else {
             $query = sprintf('//ul[@id="wo-breadcrumbs"]/li/a[@href="%s"]/span[text()="%s"]', $url, $text);
         }
         Assertion::assertCount(1, $this->getXpath()->findXpath($query));
     }
 }
開發者ID:ezsystems,項目名稱:demobundle,代碼行數:18,代碼來源:Context.php


注:本文中的Behat\Gherkin\Node\TableNode::getTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。