123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Framework\Test\Unit;
- class EventFactoryTest extends \PHPUnit\Framework\TestCase
- {
- /**
- * @var \Magento\Framework\EventFactory
- */
- protected $_model;
- /**
- * @var \PHPUnit_Framework_MockObject_MockObject
- */
- protected $_objectManagerMock;
- /**
- * @var \Magento\Framework\Event
- */
- protected $_expectedObject;
- protected function setUp()
- {
- $this->_objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
- $this->_model = new \Magento\Framework\EventFactory($this->_objectManagerMock);
- $this->_expectedObject = $this->getMockBuilder(\Magento\Framework\Event::class)->getMock();
- }
- public function testCreate()
- {
- $arguments = ['property' => 'value'];
- $this->_objectManagerMock->expects(
- $this->once()
- )->method(
- 'create'
- )->with(
- \Magento\Framework\Event::class,
- $arguments
- )->will(
- $this->returnValue($this->_expectedObject)
- );
- $this->assertEquals($this->_expectedObject, $this->_model->create($arguments));
- }
- }
|