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

ProductShowPage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 36
rs 10
c 5
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A open() 0 7 1
A addToCart() 0 4 1
A addToCartWithQuantity() 0 5 1
A getRouteName() 0 3 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