Completed
Push — 3.8.x ( 9386e4...de6774 )
by Tim
05:29
created

ProductFeatureContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A thePageShouldReturnStatus() 0 7 1
A thePageShouldReturnStatusHasTitleAndContainPrice() 0 15 1
1
<?php
2
3
/**
4
 * Defines application features from the specific context.
5
 */
6
class ProductFeatureContext extends FeatureContext
7
{
8
9
    /**
10
     * @Then the page :arg1 should return status :arg2
11
     */
12
    public function thePageShouldReturnStatus($arg1, $arg2)
13
    {
14
15
        $this->visitPath($arg1);
16
17
        PHPUnit_Framework_Assert::assertSame((integer) $arg2, $this->getSession()->getStatusCode());
18
    }
19
20
    /**
21
     * @Then the page :arg1 should return status :arg2 has title :arg3 and contain price :arg4
22
     */
23
    public function thePageShouldReturnStatusHasTitleAndContainPrice($arg1, $arg2, $arg3, $arg4)
24
    {
25
26
        $this->visitPath($arg1);
27
28
        PHPUnit_Framework_Assert::assertSame((integer) $arg2, $this->getSession()->getStatusCode());
29
30
        /** @var \Behat\Mink\Element\NodeElement $title */
31
        $title = $this->getSession()->getPage()->find('css', 'title');
32
        PHPUnit_Framework_Assert::assertSame($arg3, $title->getText());
33
34
        /** @var \Behat\Mink\Element\NodeElement $price */
35
        $price = $this->getSession()->getPage()->find('xpath', '//*[@class="price"]');
36
        PHPUnit_Framework_Assert::assertSame($arg4, $price->getText());
37
    }
38
}
39