Created
October 15, 2014 21:34
-
-
Save jhedstrom/c5f39c71f99ad5a8451c to your computer and use it in GitHub Desktop.
Gherkin as an abstraction to complex tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given I am viewing an "Article" with the title "My article" | |
Then I should see the "Revisions" link | |
And I should see the "Edit" link | |
And I should see the "View" link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains \Drupal\node\Tests\NodeViewTest. | |
*/ | |
namespace Drupal\node\Tests; | |
/** | |
* Tests the node/{node} page. | |
* | |
* @group node | |
* @see \Drupal\node\Controller\NodeController | |
*/ | |
class NodeViewTest extends NodeTestBase { | |
/** | |
* Tests the html head links. | |
*/ | |
public function testHtmlHeadLinks() { | |
$node = $this->drupalCreateNode(); | |
$this->drupalGet($node->getSystemPath()); | |
$result = $this->xpath('//link[@rel = "version-history"]'); | |
$this->assertEqual($result[0]['href'], _url("node/{$node->id()}/revisions")); | |
$result = $this->xpath('//link[@rel = "edit-form"]'); | |
$this->assertEqual($result[0]['href'], _url("node/{$node->id()}/edit")); | |
$result = $this->xpath('//link[@rel = "canonical"]'); | |
$this->assertEqual($result[0]['href'], _url("node/{$node->id()}")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment