Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AutogeneratedClassNotInConstructorFinderTest.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Catalog\Model\Indexer\Product\Flat\Table\BuilderInterfaceFactory;
9 use Magento\TestFramework\UtilityBarFactory;
10 use Magento\TestFramework\Utility\PartialNamespace\BarFactory as PartialNamespaceBarFactory;
12 use Magento\Catalog\Model\Product\OptionFactory;
13 use Magento\Catalog\Api\Data\ProductLinkInterfaceFactory;
14 
15 class AutogeneratedClassNotInConstructorFinderTest extends \PHPUnit\Framework\TestCase
16 {
22  public function testGetNameWithNamespace($fileContent, $expected)
23  {
24  require_once __DIR__ . '/Foo.php';
25 
26  $classNameExtractor = new ClassNameExtractor();
27  $instantiatedByObjectManagerClassExtractor = new AutogeneratedClassNotInConstructorFinder(
28  $classNameExtractor
29  );
30  $this->assertEquals(
31  $expected,
32  $instantiatedByObjectManagerClassExtractor->find($fileContent)
33  );
34  }
35 
40  {
41  return [
42  [
43  file_get_contents(__DIR__ . '/Foo.php'),
44  [
45  BuilderInterfaceFactory::class,
46  BarFactory::class,
47  PartialNamespaceBarFactory::class,
48  UrlFactory::class,
49  OptionFactory::class,
50  ProductLinkInterfaceFactory::class
51  ]
52  ]
53  ];
54  }
55 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60