Skip to content

Commit

Permalink
⏫ Forwardport of #12144 to 2.3-develop branch
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
magento-engcom-team committed Jan 23, 2018
1 parent 8e77e2f commit c574e46
Showing 1 changed file with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,38 @@ class ThisIsNotMyTest
self::assertContains('This\Is\Not\My\Ns\ThisIsNotMyTest', $result);
}

public function testClassKeywordInMiddleOfFile()
public function testMultipleClassKeywordsInMiddleOfFileWithStringVariableParsing()
{
$filename = __DIR__
. '/../../../../../../../../../..'
. '/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php';
$filename = realpath($filename);
$scanner = new FileClassScanner($filename);
$scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([
'getFileContents'
])->getMock();
$scanner->expects(self::once())->method('getFileContents')->willReturn(<<<'PHP'
<?php
namespace This\Is\My\Ns;
use stdClass;
class ThisIsMyTest
{
protected function firstMethod()
{
$test = 1;
$testString = "foo {$test}";
$className = stdClass::class;
$testString2 = "bar {$test}";
}
protected function secondMethod()
{
$this->doMethod(stdClass::class)->runAction();
}
}

PHP
);

/* @var $scanner FileClassScanner */
$result = $scanner->getClassNames();

self::assertCount(1, $result);
Expand Down

0 comments on commit c574e46

Please sign in to comment.