DocumentationTest.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Block\Adminhtml;
  6. use Magento\Framework\View\LayoutInterface;
  7. use Magento\TestFramework\Helper\Bootstrap;
  8. use Temando\Shipping\Model\Dispatch;
  9. use Temando\Shipping\Model\DocumentationInterface;
  10. /**
  11. * Temando Documentation Listing Block Test
  12. *
  13. * @package Temando\Shipping\Test\Integration
  14. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  15. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  16. * @link http://www.temando.com/
  17. */
  18. class DocumentationTest extends \PHPUnit\Framework\TestCase
  19. {
  20. /**
  21. * @test
  22. */
  23. public function getEmptyDocumentationListing()
  24. {
  25. /** @var LayoutInterface $layout */
  26. $layout = Bootstrap::getObjectManager()->get(LayoutInterface::class);
  27. /** @var Documentation $block */
  28. $block = $layout->createBlock(Documentation::class);
  29. $documentation = $block->getDocumentation();
  30. $this->assertInternalType('array', $documentation);
  31. $this->assertEmpty($documentation);
  32. }
  33. /**
  34. * @test
  35. */
  36. public function getDispatchDocumentationListing()
  37. {
  38. $this->markTestIncomplete('parent block usage and numerous constructor args to mock');
  39. /** @var LayoutInterface $layout */
  40. $layout = Bootstrap::getObjectManager()->get(LayoutInterface::class);
  41. /** @var Dispatch $block */
  42. $parentBlock = $layout->createBlock(Dispatch::class);
  43. /** @var Documentation|\PHPUnit_Framework_MockObject_MockObject $block */
  44. $block = $this->getMockBuilder(Documentation::class)
  45. ->setMethods(['getParentBlock'])
  46. ->disableOriginalConstructor()
  47. ->getMock();
  48. $block->expects($this->once())
  49. ->method('getParentBlock')
  50. ->willReturn($parentBlock);
  51. $block->toHtml();
  52. $documentation = $block->getDocumentation();
  53. $this->assertInternalType('array', $documentation);
  54. $this->assertContainsOnly(DocumentationInterface::class, $documentation);
  55. }
  56. /**
  57. * @test
  58. */
  59. public function getShipmentDocumentationListing()
  60. {
  61. $this->markTestIncomplete('parent block usage and numerous constructor args to mock');
  62. }
  63. }