Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExtensionAttributesFactoryTest.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\Api;
7 
8 class ExtensionAttributesFactoryTest extends \PHPUnit\Framework\TestCase
9 {
11  private $factory;
12 
13  protected function setUp()
14  {
17 
18  $this->factory = $objectManager->create(
19  \Magento\Framework\Api\ExtensionAttributesFactory::class,
20  ['objectManager' => $objectManager]
21  );
22  }
23 
28  {
29  $this->factory->create(\Magento\Framework\Api\ExtensionAttributesFactoryTest::class);
30  }
31 
36  {
37  $this->factory->create(\Magento\TestModuleExtensionAttributes\Model\Data\FakeExtensibleOne::class);
38  }
39 
44  {
45  $this->factory->create(\Magento\TestModuleExtensionAttributes\Model\Data\FakeExtensibleTwo::class);
46  }
47 
48  public function testCreate()
49  {
50  $this->assertInstanceOf(
51  \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtension::class,
52  $this->factory->create(\Magento\TestModuleExtensionAttributes\Model\Data\FakeRegion::class)
53  );
54  }
55 
56  public function testCreateWithLogicException()
57  {
58  $this->expectException('LogicException');
59  $this->expectExceptionMessage(
60  "Class 'Magento\\Framework\\Api\\ExtensionAttributesFactoryTest' must implement an interface, "
61  . "which extends from 'Magento\\Framework\\Api\\ExtensibleDataInterface'"
62  );
63  $this->factory->create(get_class($this));
64  }
65 }
$objectManager
Definition: bootstrap.php:17