Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SubscriptionFactoryTest.php
Go to the documentation of this file.
1 <?php
8 
9 use \Magento\Framework\Mview\View\SubscriptionFactory;
10 
11 class SubscriptionFactoryTest extends \PHPUnit\Framework\TestCase
12 {
16  protected $model;
17 
21  protected $objectManagerMock;
22 
23  protected function setUp()
24  {
25  $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
26  $this->model = new SubscriptionFactory($this->objectManagerMock);
27  }
28 
29  public function testCreate()
30  {
31  $subscriptionInterfaceMock = $this->getMockForAbstractClass(
32  \Magento\Framework\Mview\View\SubscriptionInterface::class,
33  [],
34  '',
35  false
36  );
37  $this->objectManagerMock->expects($this->once())
38  ->method('create')
39  ->with(\Magento\Framework\Mview\View\SubscriptionInterface::class, ['some_data'])
40  ->will($this->returnValue($subscriptionInterfaceMock));
41  $this->assertEquals($subscriptionInterfaceMock, $this->model->create(['some_data']));
42  }
43 }