Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExcelFactoryTest.php
Go to the documentation of this file.
1 <?php
7 
10 
11 class ExcelFactoryTest extends \PHPUnit\Framework\TestCase
12 {
16  protected $model;
17 
21  protected $objectManager;
22 
23  protected function setUp()
24  {
25  $this->objectManager = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
26  ->setMethods(['create'])
27  ->getMockForAbstractClass();
28 
29  $this->model = new ExcelFactory(
30  $this->objectManager
31  );
32  }
33 
34  public function testCreate()
35  {
36  $excel = $this->getMockBuilder(\Magento\Framework\Convert\Excel::class)
37  ->disableOriginalConstructor()
38  ->getMock();
39 
40  $this->objectManager->expects($this->once())
41  ->method('create')
42  ->with(\Magento\Framework\Convert\Excel::class, [])
43  ->willReturn($excel);
44 
45  $this->assertInstanceOf(\Magento\Framework\Convert\Excel::class, $this->model->create());
46  }
47 }