Skip to content

Commit

Permalink
Removed FileClassScannerTest dependency to "Magento_Catalog"
Browse files Browse the repository at this point in the history
Looked at the original error fixed by 4e8d1d6 and reproduced
what it needed from app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php
to test for "FileClassScannerTest not liking one case when the word "class" was in a class"
  • Loading branch information
kimsondrup committed Nov 9, 2017
1 parent fd8dcad commit e046aad
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 e046aad

Please sign in to comment.