/** * Removes 'Web Setup Wizard' from the menu if doc root is pub and no setup url variable is specified. * * @param Builder $subject * @param Menu $menu * @return Menu * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterGetResult(Builder $subject, Menu $menu) { if ($this->docRootLocator->isPub()) { $menu->remove('Magento_Backend::setup_wizard'); } return $menu; }
/** * @dataProvider isPubDataProvider * * @param string $path * @param bool $isExist * @param bool $result */ public function testIsPub($path, $isExist, $result) { $request = $this->getMock('\\Magento\\Framework\\App\\Request\\Http', [], [], '', false); $request->expects($this->once())->method('getServer')->willReturn($path); $reader = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\Read', [], [], '', false); $reader->expects($this->any())->method('isExist')->willReturn($isExist); $readFactory = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadFactory', [], [], '', false); $readFactory->expects($this->once())->method('create')->willReturn($reader); $model = new DocRootLocator($request, $readFactory); $this->assertSame($result, $model->isPub()); }