Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AdditionalInfoTest.php
Go to the documentation of this file.
1 <?php
8 
12 
13 class AdditionalInfoTest extends \PHPUnit\Framework\TestCase
14 {
16  private $model;
17 
18  public function setUp()
19  {
20  $this->model = new AdditionalInfo();
21  }
22  public function testGet()
23  {
24  $productRenderInfo = $this->createMock(ProductRenderInterface::class);
25  $productRenderInfo->expects($this->once())
26  ->method('setIsSalable')
27  ->with(true);
28  $productRenderInfo->expects($this->once())
29  ->method('setName')
30  ->with('simple');
31  $productRenderInfo->expects($this->once())
32  ->method('setId')
33  ->with(1);
34  $productMock = $this->getMockBuilder(Product::class)
35  ->disableOriginalConstructor()
36  ->getMock();
37  $productMock->expects($this->once())
38  ->method('isSalable')
39  ->willReturn(true);
40  $productMock->expects($this->once())
41  ->method('getTypeId')
42  ->willReturn('simple');
43  $productMock->expects($this->once())
44  ->method('getName')
45  ->willReturn('simple');
46  $productMock->expects($this->once())
47  ->method('getId')
48  ->willReturn(1);
49  $this->model->collect($productMock, $productRenderInfo);
50  }
51 }