WrapperFactoryTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @category Magento
  4. * @package Magento_Event
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\Event\Test\Unit;
  9. use \Magento\Framework\Event\WrapperFactory;
  10. /**
  11. * Class WrapperFactoryTest
  12. *
  13. * @package Magento\Framework\Event
  14. */
  15. class WrapperFactoryTest extends \PHPUnit\Framework\TestCase
  16. {
  17. public function testCreate()
  18. {
  19. $expectedInstance = \Magento\Framework\Event\Observer::class;
  20. $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
  21. $wrapperFactory = new WrapperFactory($objectManagerMock);
  22. $arguments = ['argument' => 'value', 'data' => 'data'];
  23. $observerInstanceMock = $this->createMock($expectedInstance);
  24. $objectManagerMock->expects($this->once())
  25. ->method('create')
  26. ->with($expectedInstance, $arguments)
  27. ->will($this->returnValue($observerInstanceMock));
  28. $this->assertInstanceOf($expectedInstance, $wrapperFactory->create($arguments));
  29. }
  30. }