Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
ItemsTest Class Reference
Inheritance diagram for ItemsTest:

Public Member Functions

 testGetCommentsHtml ()
 

Detailed Description

Definition at line 8 of file ItemsTest.php.

Member Function Documentation

◆ testGetCommentsHtml()

testGetCommentsHtml ( )

Definition at line 10 of file ItemsTest.php.

11  {
13  \Magento\Framework\View\LayoutInterface::class
14  );
15  $block = $layout->createBlock(\Magento\Shipping\Block\Items::class, 'block');
16  $childBlock = $layout->addBlock(\Magento\Framework\View\Element\Text::class, 'shipment_comments', 'block');
18  \Magento\Sales\Model\Order\Shipment::class
19  );
20 
21  $expectedHtml = '<b>Any html</b>';
22  $this->assertEmpty($childBlock->getEntity());
23  $this->assertEmpty($childBlock->getTitle());
24  $this->assertNotEquals($expectedHtml, $block->getCommentsHtml($shipment));
25 
26  $childBlock->setText($expectedHtml);
27  $actualHtml = $block->getCommentsHtml($shipment);
28  $this->assertSame($shipment, $childBlock->getEntity());
29  $this->assertNotEmpty($childBlock->getTitle());
30  $this->assertEquals($expectedHtml, $actualHtml);
31  }
$block
Definition: block.php:8
foreach($order->getItems() as $orderItem) $shipment

The documentation for this class was generated from the following file: