Completed
Push — master ( 133b57...4c004c )
by Kamil
20:32
created

CreatePage::getRouteName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
dl 0
loc 4
rs 10
c 2
b 1
f 1
cc 1
eloc 2
nc 1
nop 0
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\Admin\Crud;
13
14
use Behat\Mink\Session;
15
use Sylius\Behat\Page\SymfonyPage;
16
use Symfony\Component\Routing\RouterInterface;
17
18
/**
19
 * @author Arkadiusz Krakowiak <[email protected]>
20
 */
21
class CreatePage extends SymfonyPage implements CreatePageInterface
22
{
23
    /**
24
     * @var string
25
     */
26
    private $resourceName;
27
28
    /**
29
     * @param Session $session
30
     * @param array $parameters
31
     * @param RouterInterface $router
32
     * @param string $resourceName
33
     */
34
    public function __construct(Session $session, array $parameters, RouterInterface $router, $resourceName)
35
    {
36
        parent::__construct($session, $parameters, $router);
37
38
        $this->resourceName = strtolower($resourceName);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function create()
45
    {
46
        $this->getDocument()->pressButton('Create');
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected function getRouteName()
53
    {
54
        return sprintf('sylius_admin_%s_create', $this->resourceName);
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    protected function getResourceName()
61
    {
62
        return $this->resourceName;
63
    }
64
}
65