Skip to content

Commit ff33a1b

Browse files
Merge forwardport of #12144 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/12144.patch (created by @wexo-team) based on commit(s): 1. e046aad Fixed GitHub Issues in 2.3-develop branch: - #11230: Unit test fails after fresh installation (reported by @bnymn)
2 parents dcfa68c + c574e46 commit ff33a1b

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)