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\Content; |
||
3 | |||
4 | use Redaxscript\Content; |
||
5 | use Redaxscript\Module; |
||
6 | use Redaxscript\Tests\TestCaseAbstract; |
||
7 | |||
8 | /** |
||
9 | * ParserTest |
||
10 | * |
||
11 | * @since 2.1.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category Tests |
||
15 | * @author Henry Ruhs |
||
16 | * |
||
17 | * @covers Redaxscript\Content\Parser |
||
18 | * @covers Redaxscript\Content\ParserAbstract |
||
19 | * @covers Redaxscript\Content\Tag\Code |
||
20 | * @covers Redaxscript\Content\Tag\Language |
||
21 | * @covers Redaxscript\Content\Tag\Module |
||
22 | * @covers Redaxscript\Content\Tag\More |
||
23 | * @covers Redaxscript\Content\Tag\Registry |
||
24 | * @covers Redaxscript\Content\Tag\TagAbstract |
||
25 | * @covers Redaxscript\Content\Tag\Template |
||
26 | */ |
||
27 | |||
28 | class ParserTest extends TestCaseAbstract |
||
29 | { |
||
30 | /** |
||
31 | * setUp |
||
32 | * |
||
33 | * @since 3.1.0 |
||
34 | */ |
||
35 | |||
36 | public function setUp() : void |
||
37 | { |
||
38 | parent::setUp(); |
||
39 | $optionArray = $this->getOptionArray(); |
||
40 | $installer = $this->installerFactory(); |
||
41 | $installer->init(); |
||
42 | $installer->rawCreate(); |
||
43 | $installer->insertSettings($optionArray); |
||
44 | $installer->rawMigrate(); |
||
45 | $this->installTestDummy(); |
||
0 ignored issues
–
show
|
|||
46 | } |
||
47 | |||
48 | /** |
||
49 | * tearDown |
||
50 | * |
||
51 | * @since 3.1.0 |
||
52 | */ |
||
53 | |||
54 | public function tearDown() : void |
||
55 | { |
||
56 | $this->_language->init(); |
||
57 | $this->uninstallTestDummy(); |
||
58 | $this->dropDatabase(); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * testCode |
||
63 | * |
||
64 | * @since 3.0.0 |
||
65 | * |
||
66 | * @param string $content |
||
67 | * @param string $expect |
||
68 | * |
||
69 | * @dataProvider providerAutoloader |
||
70 | */ |
||
71 | |||
72 | public function testCode(string $content = null, string $expect = null) : void |
||
73 | { |
||
74 | /* setup */ |
||
75 | |||
76 | $parser = new Content\Parser($this->_registry, $this->_request, $this->_language, $this->_config); |
||
77 | $parser->process($content); |
||
78 | |||
79 | /* actual */ |
||
80 | |||
81 | $actual = $parser->getOutput(); |
||
82 | |||
83 | /* compare */ |
||
84 | |||
85 | $this->assertEquals($expect, $actual); |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * testLanguage |
||
90 | * |
||
91 | * @since 3.0.0 |
||
92 | * |
||
93 | * @param string $language |
||
94 | * @param string $content |
||
95 | * @param string $expect |
||
96 | * |
||
97 | * @dataProvider providerAutoloader |
||
98 | */ |
||
99 | |||
100 | public function testLanguage(string $language = null, string $content = null, string $expect = null) : void |
||
101 | { |
||
102 | /* setup */ |
||
103 | |||
104 | $this->_language->init($language); |
||
105 | $parser = new Content\Parser($this->_registry, $this->_request, $this->_language, $this->_config); |
||
106 | $parser->process($content); |
||
107 | |||
108 | /* actual */ |
||
109 | |||
110 | $actual = $parser->getOutput(); |
||
111 | |||
112 | /* compare */ |
||
113 | |||
114 | $this->assertEquals($expect, $actual); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * testModule |
||
119 | * |
||
120 | * @since 3.0.0 |
||
121 | * |
||
122 | * @param string $content |
||
123 | * @param string $expect |
||
124 | * |
||
125 | * @dataProvider providerAutoloader |
||
126 | */ |
||
127 | |||
128 | public function testModule(string $content = null, string $expect = null) : void |
||
129 | { |
||
130 | /* setup */ |
||
131 | |||
132 | Module\Hook::construct($this->_registry, $this->_request, $this->_language, $this->_config); |
||
133 | Module\Hook::init(); |
||
134 | $parser = new Content\Parser($this->_registry, $this->_request, $this->_language, $this->_config); |
||
135 | $parser->process($content); |
||
136 | |||
137 | /* actual */ |
||
138 | |||
139 | $actual = $parser->getOutput(); |
||
140 | |||
141 | /* compare */ |
||
142 | |||
143 | $this->assertEquals($expect, $actual); |
||
144 | } |
||
145 | |||
146 | /** |
||
147 | * testMore |
||
148 | * |
||
149 | * @since 3.0.0 |
||
150 | * |
||
151 | * @param array $registryArray |
||
152 | * @param string $content |
||
153 | * @param string $route |
||
154 | * @param string $expect |
||
155 | * |
||
156 | * @dataProvider providerAutoloader |
||
157 | */ |
||
158 | |||
159 | public function testMore(array $registryArray = [], string $content = null, string $route = null, string $expect = null) : void |
||
160 | { |
||
161 | /* setup */ |
||
162 | |||
163 | $this->_registry->init($registryArray); |
||
164 | $parser = new Content\Parser($this->_registry, $this->_request, $this->_language, $this->_config); |
||
165 | $parser->process($content, $route); |
||
166 | |||
167 | /* actual */ |
||
168 | |||
169 | $actual = $parser->getOutput(); |
||
170 | |||
171 | /* compare */ |
||
172 | |||
173 | $this->assertEquals($expect, $actual); |
||
174 | } |
||
175 | |||
176 | /** |
||
177 | * testRegistry |
||
178 | * |
||
179 | * @since 3.0.0 |
||
180 | * |
||
181 | * @param array $registryArray |
||
182 | * @param string $content |
||
183 | * @param string $expect |
||
184 | * |
||
185 | * @dataProvider providerAutoloader |
||
186 | */ |
||
187 | |||
188 | public function testRegistry(array $registryArray = [], string $content = null, string $expect = null) : void |
||
189 | { |
||
190 | /* setup */ |
||
191 | |||
192 | $this->_registry->init($registryArray); |
||
193 | $parser = new Content\Parser($this->_registry, $this->_request, $this->_language, $this->_config); |
||
194 | $parser->process($content); |
||
195 | |||
196 | /* actual */ |
||
197 | |||
198 | $actual = $parser->getOutput(); |
||
199 | |||
200 | /* compare */ |
||
201 | |||
202 | $this->assertEquals($expect, $actual); |
||
203 | } |
||
204 | |||
205 | /** |
||
206 | * testTemplate |
||
207 | * |
||
208 | * @since 3.0.0 |
||
209 | * |
||
210 | * @param string $content |
||
211 | * @param string $expect |
||
212 | * |
||
213 | * @dataProvider providerAutoloader |
||
214 | */ |
||
215 | |||
216 | public function testTemplate(string $content = null, string $expect = null) : void |
||
217 | { |
||
218 | /* setup */ |
||
219 | |||
220 | $parser = new Content\Parser($this->_registry, $this->_request, $this->_language, $this->_config); |
||
221 | $parser->process($content); |
||
222 | |||
223 | /* actual */ |
||
224 | |||
225 | $actual = $parser->getOutput(); |
||
226 | |||
227 | /* compare */ |
||
228 | |||
229 | $this->assertEquals($expect, $actual); |
||
230 | } |
||
231 | } |
||
232 |
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.