Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MenuBuilderTest.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class MenuBuilderTest extends \PHPUnit\Framework\TestCase
12 {
20  public function testAfterGetResult($isPub, $times)
21  {
22  $docRootLocator = $this->createMock(\Magento\Framework\App\DocRootLocator::class);
23  $docRootLocator->expects($this->once())->method('isPub')->willReturn($isPub);
24  $model = new MenuBuilder($docRootLocator);
26  $menu = $this->createMock(\Magento\Backend\Model\Menu::class);
27  $menu->expects($this->exactly($times))->method('remove')->willReturn(true);
28 
30  $menuBuilder = $this->createMock(\Magento\Backend\Model\Menu\Builder::class);
31 
32  $this->assertInstanceOf(
33  \Magento\Backend\Model\Menu::class,
34  $model->afterGetResult($menuBuilder, $menu)
35  );
36  }
37 
41  public function afterGetResultDataProvider()
42  {
43  return [[true, 1], [false, 0],];
44  }
45 }