Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
EventFactoryTest.php
Go to the documentation of this file.
1 <?php
7 
8 class EventFactoryTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_model;
14 
19 
23  protected $_expectedObject;
24 
25  protected function setUp()
26  {
27  $this->_objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
28  $this->_model = new \Magento\Framework\EventFactory($this->_objectManagerMock);
29  $this->_expectedObject = $this->getMockBuilder(\Magento\Framework\Event::class)->getMock();
30  }
31 
32  public function testCreate()
33  {
34  $arguments = ['property' => 'value'];
35  $this->_objectManagerMock->expects(
36  $this->once()
37  )->method(
38  'create'
39  )->with(
40  \Magento\Framework\Event::class,
42  )->will(
43  $this->returnValue($this->_expectedObject)
44  );
45 
46  $this->assertEquals($this->_expectedObject, $this->_model->create($arguments));
47  }
48 }
$arguments