ContainerTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Indexer\Test\Unit\Block\Backend;
  7. class ContainerTest extends \PHPUnit\Framework\TestCase
  8. {
  9. public function testPseudoConstruct()
  10. {
  11. $headerText = __('Indexer Management');
  12. $buttonList = $this->createPartialMock(
  13. \Magento\Backend\Block\Widget\Button\ButtonList::class,
  14. ['remove', 'add']
  15. );
  16. $buttonList->expects($this->once())->method('add');
  17. $buttonList->expects($this->once())->method('remove')->with('add');
  18. $urlBuilderMock = $this->createMock(\Magento\Framework\UrlInterface::class);
  19. $contextMock = $this->createPartialMock(
  20. \Magento\Backend\Block\Widget\Context::class,
  21. ['getUrlBuilder', 'getButtonList']
  22. );
  23. $contextMock->expects($this->once())->method('getUrlBuilder')->will($this->returnValue($urlBuilderMock));
  24. $contextMock->expects($this->once())->method('getButtonList')->will($this->returnValue($buttonList));
  25. $block = new \Magento\Indexer\Block\Backend\Container($contextMock);
  26. $this->assertEquals($block->getHeaderText(), $headerText);
  27. }
  28. }