-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNodeContext.php
56 lines (45 loc) · 1.51 KB
/
NodeContext.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* Contains Palantirnet\PalantirBehatExtension\Context\NodeContext.
*
* @copyright 2015 Palantir.net, Inc.
*/
namespace Palantirnet\PalantirBehatExtension\Context;
use Drupal\DrupalExtension\Context\RawDrupalContext;
/**
* Behat context class with additional node-related steps.
*/
class NodeContext extends SharedDrupalContext
{
/**
* Verify that a node exists and the current user can access its node page.
*
* @When I view the :contentType content :title
*
* @param string $contentType A Drupal content type machine name.
* @param string $title The title of a Drupal node.
*
* @return void
*/
public function assertNodeByTitle($contentType, $title)
{
$node = $this->findNodeByTitle($contentType, $title);
$this->getSession()->visit($this->locatePath("node/{$node->nid}"));
}//end assertNodeByTitle()
/**
* Verify that a node exists and the current user can visit its edit form.
*
* @When I edit the :contentType content :title
*
* @param string $contentType A Drupal content type machine name.
* @param string $title The title of a Drupal node.
*
* @return void
*/
public function assertEditNodeByTitle($contentType, $title)
{
$node = $this->findNodeByTitle($contentType, $title);
$this->getSession()->visit($this->locatePath("node/{$node->nid}/edit"));
$this->assertSession()->statusCodeEquals('200');
}//end assertEditNodeByTitle()
}//end class