File tree Expand file tree Collapse file tree 1 file changed +31
-6
lines changed
setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader Expand file tree Collapse file tree 1 file changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -204,13 +204,38 @@ class ThisIsNotMyTest
204204 self ::assertContains ('This\Is\Not\My\Ns\ThisIsNotMyTest ' , $ result );
205205 }
206206
207- public function testClassKeywordInMiddleOfFile ()
207+ public function testMultipleClassKeywordsInMiddleOfFileWithStringVariableParsing ()
208208 {
209- $ filename = __DIR__
210- . '/../../../../../../../../../.. '
211- . '/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php ' ;
212- $ filename = realpath ($ filename );
213- $ scanner = new FileClassScanner ($ filename );
209+ $ scanner = $ this ->getMockBuilder (FileClassScanner::class)->disableOriginalConstructor ()->setMethods ([
210+ 'getFileContents '
211+ ])->getMock ();
212+ $ scanner ->expects (self ::once ())->method ('getFileContents ' )->willReturn (<<<'PHP'
213+ <?php
214+
215+ namespace This\Is\My\Ns;
216+
217+ use stdClass;
218+
219+ class ThisIsMyTest
220+ {
221+ protected function firstMethod()
222+ {
223+ $test = 1;
224+ $testString = "foo {$test}";
225+ $className = stdClass::class;
226+ $testString2 = "bar {$test}";
227+ }
228+
229+ protected function secondMethod()
230+ {
231+ $this->doMethod(stdClass::class)->runAction();
232+ }
233+ }
234+
235+ PHP
236+ );
237+
238+ /* @var $scanner FileClassScanner */
214239 $ result = $ scanner ->getClassNames ();
215240
216241 self ::assertCount (1 , $ result );
You can’t perform that action at this time.
0 commit comments