These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\Tests\View\Helper; |
||
3 | |||
4 | use Redaxscript\Db; |
||
5 | use Redaxscript\Tests\TestCaseAbstract; |
||
6 | use Redaxscript\View\Helper\Breadcrumb; |
||
7 | |||
8 | /** |
||
9 | * BreadcrumbTest |
||
10 | * |
||
11 | * @since 2.1.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category Tests |
||
15 | * @author Henry Ruhs |
||
16 | * @author Gary Aylward |
||
17 | * |
||
18 | * @covers Redaxscript\View\Helper\Breadcrumb |
||
19 | */ |
||
20 | |||
21 | class BreadcrumbTest extends TestCaseAbstract |
||
22 | { |
||
23 | /** |
||
24 | * setUp |
||
25 | * |
||
26 | * @since 3.1.0 |
||
27 | */ |
||
28 | |||
29 | public function setUp() : void |
||
30 | { |
||
31 | parent::setUp(); |
||
32 | $optionArray = |
||
33 | [ |
||
34 | 'adminName' => 'Test', |
||
35 | 'adminUser' => 'test', |
||
36 | 'adminPassword' => 'test', |
||
37 | 'adminEmail' => '[email protected]' |
||
38 | ]; |
||
39 | $installer = $this->installerFactory(); |
||
0 ignored issues
–
show
|
|||
40 | $installer->init(); |
||
41 | $installer->rawCreate(); |
||
42 | $installer->insertSettings($optionArray); |
||
43 | $categoryOne = Db::forTablePrefix('categories')->create(); |
||
44 | $categoryOne |
||
45 | ->set( |
||
46 | [ |
||
47 | 'title' => 'Category One', |
||
48 | 'alias' => 'category-one' |
||
49 | ]) |
||
50 | ->save(); |
||
51 | $categoryTwo = Db::forTablePrefix('categories')->create(); |
||
52 | $categoryTwo |
||
53 | ->set( |
||
54 | [ |
||
55 | 'title' => 'Category Two', |
||
56 | 'alias' => 'category-two', |
||
57 | 'parent' => $categoryOne->id |
||
58 | ]) |
||
59 | ->save(); |
||
60 | Db::forTablePrefix('articles') |
||
61 | ->create() |
||
62 | ->set( |
||
63 | [ |
||
64 | 'title' => 'Article One', |
||
65 | 'alias' => 'article-one', |
||
66 | 'category' => $categoryOne->id |
||
67 | ]) |
||
68 | ->save(); |
||
69 | Db::forTablePrefix('articles') |
||
70 | ->create() |
||
71 | ->set( |
||
72 | [ |
||
73 | 'title' => 'Article Two', |
||
74 | 'alias' => 'article-two', |
||
75 | 'category' => $categoryTwo->id |
||
76 | ]) |
||
77 | ->save(); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * tearDown |
||
82 | * |
||
83 | * @since 3.1.0 |
||
84 | */ |
||
85 | |||
86 | public function tearDown() : void |
||
87 | { |
||
88 | $this->dropDatabase(); |
||
0 ignored issues
–
show
The method
dropDatabase() does not seem to exist on object<Redaxscript\Tests...\Helper\BreadcrumbTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
89 | } |
||
90 | |||
91 | /** |
||
92 | * testGetArray |
||
93 | * |
||
94 | * @since 2.1.0 |
||
95 | * |
||
96 | * @param array $registryArray |
||
97 | * @param array $expectArray |
||
98 | * |
||
99 | * @dataProvider providerAutoloader |
||
100 | */ |
||
101 | |||
102 | public function testGetArray(array $registryArray = [], array $expectArray = []) : void |
||
103 | { |
||
104 | /* setup */ |
||
105 | |||
106 | $this->_registry->init($registryArray); |
||
107 | $breadcrumb = new Breadcrumb($this->_registry, $this->_language); |
||
108 | $breadcrumb->init(); |
||
109 | |||
110 | /* actual */ |
||
111 | |||
112 | $actualArray = $breadcrumb->getArray(); |
||
113 | |||
114 | /* compare */ |
||
115 | |||
116 | $this->assertEquals($expectArray, $actualArray); |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * testRender |
||
121 | * |
||
122 | * @since 2.1.0 |
||
123 | * |
||
124 | * @param array $registryArray |
||
125 | * @param string $expect |
||
126 | * |
||
127 | * @dataProvider providerAutoloader |
||
128 | */ |
||
129 | |||
130 | public function testRender(array $registryArray = [], string $expect = null) : void |
||
131 | { |
||
132 | /* setup */ |
||
133 | |||
134 | $this->_registry->init($registryArray); |
||
135 | $breadcrumb = new Breadcrumb($this->_registry, $this->_language); |
||
136 | $breadcrumb->init(); |
||
137 | |||
138 | /* actual */ |
||
139 | |||
140 | $actual = $breadcrumb; |
||
141 | |||
142 | /* compare */ |
||
143 | |||
144 | $this->assertEquals($expect, $actual); |
||
145 | } |
||
146 | } |
||
147 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.