Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
WrapperFactoryTest.php
Go to the documentation of this file.
1 <?php
10 
11 use \Magento\Framework\Event\WrapperFactory;
12 
18 class WrapperFactoryTest extends \PHPUnit\Framework\TestCase
19 {
20  public function testCreate()
21  {
22  $expectedInstance = \Magento\Framework\Event\Observer::class;
23  $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
24 
25  $wrapperFactory = new WrapperFactory($objectManagerMock);
26  $arguments = ['argument' => 'value', 'data' => 'data'];
27  $observerInstanceMock = $this->createMock($expectedInstance);
28 
29  $objectManagerMock->expects($this->once())
30  ->method('create')
31  ->with($expectedInstance, $arguments)
32  ->will($this->returnValue($observerInstanceMock));
33 
34  $this->assertInstanceOf($expectedInstance, $wrapperFactory->create($arguments));
35  }
36 }
$arguments