These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 spec\Sylius\Behat\Service; |
||
13 | |||
14 | use Behat\Mink\Session; |
||
15 | use PhpSpec\ObjectBehavior; |
||
16 | use Sylius\Behat\Page\Admin\Crud\CreatePageInterface; |
||
17 | use Sylius\Behat\Page\Admin\Crud\UpdatePageInterface; |
||
18 | use Sylius\Behat\Service\CurrentPageResolver; |
||
19 | use Sylius\Behat\Service\CurrentPageResolverInterface; |
||
20 | use Symfony\Component\Routing\Matcher\UrlMatcherInterface; |
||
21 | |||
22 | /** |
||
23 | * @mixin CurrentPageResolver |
||
24 | * |
||
25 | * @author Łukasz Chruściel <[email protected]> |
||
26 | */ |
||
27 | class CurrentPageResolverSpec extends ObjectBehavior |
||
28 | { |
||
29 | function let(Session $session, UrlMatcherInterface $urlMatcher) |
||
30 | { |
||
31 | $this->beConstructedWith($session, $urlMatcher); |
||
32 | } |
||
33 | |||
34 | function it_is_initializable() |
||
0 ignored issues
–
show
|
|||
35 | { |
||
36 | $this->shouldHaveType('Sylius\Behat\Service\CurrentPageResolver'); |
||
37 | } |
||
38 | |||
39 | function it_implements_current_page_resolver_interface() |
||
0 ignored issues
–
show
The method it_implements_current_page_resolver_interface is not named in camelCase.
This check marks method names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes ![]() |
|||
40 | { |
||
41 | $this->shouldImplement(CurrentPageResolverInterface::class); |
||
42 | } |
||
43 | |||
44 | function it_returns_create_page_if_current_route_name_contains_create_word( |
||
0 ignored issues
–
show
The method it_returns_create_page_if_current_route_name_contains_create_word is not named in camelCase.
This check marks method names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes ![]() |
|||
45 | Session $session, |
||
46 | CreatePageInterface $createPage, |
||
47 | UpdatePageInterface $updatePage, |
||
48 | UrlMatcherInterface $urlMatcher |
||
49 | ) { |
||
50 | $session->getCurrentUrl()->willReturn('https://sylius.com/resource/new'); |
||
51 | $urlMatcher->match('/resource/new')->willReturn(['_route' => 'sylius_resource_create']); |
||
52 | |||
53 | $this->getCurrentPageWithForm($createPage, $updatePage)->shouldReturn($createPage); |
||
54 | } |
||
55 | |||
56 | function it_returns_update_page_if_current_route_name_contains_update_word( |
||
0 ignored issues
–
show
The method it_returns_update_page_if_current_route_name_contains_update_word is not named in camelCase.
This check marks method names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes ![]() |
|||
57 | Session $session, |
||
58 | CreatePageInterface $createPage, |
||
59 | UpdatePageInterface $updatePage, |
||
60 | UrlMatcherInterface $urlMatcher |
||
61 | ) { |
||
62 | $session->getCurrentUrl()->willReturn('https://sylius.com/resource/edit'); |
||
63 | $urlMatcher->match('/resource/edit')->willReturn(['_route' => 'sylius_resource_update']); |
||
64 | |||
65 | $this->getCurrentPageWithForm($createPage, $updatePage)->shouldReturn($updatePage); |
||
66 | } |
||
67 | |||
68 | function it_throws_an_exception_if_neither_create_nor_update_key_word_has_been_found( |
||
0 ignored issues
–
show
The method it_throws_an_exception_if_neither_create_nor_update_key_word_has_been_found is not named in camelCase.
This check marks method names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes ![]() |
|||
69 | Session $session, |
||
70 | CreatePageInterface $createPage, |
||
71 | UpdatePageInterface $updatePage, |
||
72 | UrlMatcherInterface $urlMatcher |
||
73 | ) { |
||
74 | $session->getCurrentUrl()->willReturn('https://sylius.com/resource/show'); |
||
75 | $urlMatcher->match('/resource/show')->willReturn(['_route' => 'sylius_resource_show']); |
||
76 | |||
77 | $this->shouldThrow(\LogicException::class)->during('getCurrentPageWithForm', [$createPage, $updatePage]); |
||
78 | } |
||
79 | } |
||
80 |
This check marks method names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.