Completed
Push — 3.8.x ( 9319bd...9386e4 )
by Tim
61:18 queued 59:29
created

ProductFeatureContext::thePageShouldBeAvailable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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 be available
11
    */
12
    public function thePageShouldBeAvailable($arg1)
13
    {
14
15
        $this->visitPath($arg1);
16
        PHPUnit_Framework_Assert::assertSame(200, $this->getSession()->getStatusCode());
17
    }
18
19
    /**
20
     * @Then the page :arg1 should contain the price :arg2
21
     */
22
    public function thePageShouldContainThePrice($arg1, $arg2)
23
    {
24
25
        $this->visitPath($arg1);
26
27
        /** @var \Behat\Mink\Element\NodeElement $price */
28
        $prices = $this->getSession()->getPage()->findAll('xpath', '//*[@id="product-price-21606"]/span');
29
30
        foreach ($prices as $price) {
31
            echo "Found value: " . $price->getValue() . PHP_EOL;
32
            PHPUnit_Framework_Assert::assertSame($arg2, $price->getValue());
33
        }
34
    }
35
}
36