Completed
Push — master ( b716f1...2f9340 )
by Kamil
18:43
created

ProductShowPage::openSpecificProductPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Behat\Page\Product;
13
14
use Sylius\Behat\SymfonyPageObjectExtension\PageObject\SymfonyPage;
15
16
/**
17
 * @author Arkadiusz Krakowiak <[email protected]>
18
 */
19
class ProductShowPage extends SymfonyPage
20
{
21
    /**
22
     * @param array $urlParameters
23
     *
24
     * @return ProductShowPage
25
     */
26
    public function open(array $urlParameters = [])
27
    {
28
        $url = $this->router->generate($urlParameters['product']);
29
        $this->getSession()->visit($url);
30
31
        return $this;
32
    }
33
34
    public function addToCart()
35
    {
36
        $this->getDocument()->pressButton('Add to cart');
37
    }
38
39
    /**
40
     * @param string $quantity
41
     */
42
    public function addToCartWithQuantity($quantity)
43
    {
44
        $this->getDocument()->fillField('Quantity', $quantity);
45
        $this->getDocument()->pressButton('Add to cart');
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getRouteName()
52
    {
53
    }
54
}
55