1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
||
5 | * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
||
6 | */ |
||
7 | |||
8 | namespace SprykerTest\Zed\StoreGui\Communication\Form; |
||
9 | |||
10 | use Codeception\Test\Unit; |
||
11 | |||
12 | /** |
||
13 | * Auto-generated group annotations |
||
14 | * |
||
15 | * @group SprykerTest |
||
16 | * @group Zed |
||
17 | * @group StoreGui |
||
18 | * @group Communication |
||
19 | * @group Form |
||
20 | * @group CreateStoreFormTest |
||
21 | * Add your own group annotations below this line |
||
22 | */ |
||
23 | class CreateStoreFormTest extends Unit |
||
24 | { |
||
25 | /** |
||
26 | * @var \SprykerTest\Zed\StoreGui\StoreGuiCommunicationTester |
||
27 | */ |
||
28 | protected $tester; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected const REGEX_NAME_PATTERN = '/^(?!.*_{2})[A-Z][A-Z_]*[A-Z]$/'; |
||
34 | |||
35 | /** |
||
36 | * @dataProvider regexTestDataProvider |
||
37 | * |
||
38 | * @param string $string |
||
39 | * @param bool $shouldMatch |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | public function testStoreNameCanContainOnlyUppercaseLettersSeparatedBySingleUnderscore(string $string, bool $shouldMatch): void |
||
44 | { |
||
45 | // Arrange |
||
46 | $storeNameRegularExpression = static::REGEX_NAME_PATTERN; |
||
47 | |||
48 | // Act |
||
49 | $result = preg_match($storeNameRegularExpression, $string); |
||
50 | |||
51 | // Assert |
||
52 | $this->assertEquals($shouldMatch, (bool)$result); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return array<array> |
||
57 | */ |
||
58 | private function regexTestDataProvider(): array |
||
0 ignored issues
–
show
|
|||
59 | { |
||
60 | return [ |
||
61 | ['A_B', true], |
||
62 | ['ABC', true], |
||
63 | ['A_B_C', true], |
||
64 | ['A_B_C_D', true], |
||
65 | ['ABCD', true], |
||
66 | ['A__B', false], |
||
67 | ['A_B_', false], |
||
68 | ['_A_B', false], |
||
69 | ['A__B__C', false], |
||
70 | ['A__B_C', false], |
||
71 | ['A_B__C', false], |
||
72 | ['A__B_C_D', false], |
||
73 | ['A_B__C_D', false], |
||
74 | ['A_B_C__D', false], |
||
75 | ['A_B_C_D_', false], |
||
76 | ['_A_B_C_D', false], |
||
77 | ['A_B_1', false], |
||
78 | ['A_B_*', false], |
||
79 | ['A_B_?', false], |
||
80 | ['AB1', false], |
||
81 | ['AB*', false], |
||
82 | ['AB?', false], |
||
83 | ]; |
||
84 | } |
||
85 | } |
||
86 |
This check looks for private methods that have been defined, but are not used inside the class.