public function testIndexAction()
 {
     $this->navigationModel->expects($this->once())->method('getData')->willReturn('some data');
     $viewModel = $this->controller->indexAction();
     $this->assertInstanceOf('\\Zend\\View\\Model\\JsonModel', $viewModel);
     $this->assertArrayHasKey('nav', $viewModel->getVariables());
 }
Esempio n. 2
0
 public function testHeaderBarUpdater()
 {
     $this->navigationModel->expects($this->once())->method('getType')->willReturn(NavModel::NAV_UPDATER);
     $viewModel = $this->controller->headerBarAction();
     $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $viewModel);
     $variables = $viewModel->getVariables();
     $this->assertArrayHasKey('menu', $variables);
     $this->assertArrayHasKey('main', $variables);
     $this->assertTrue($viewModel->terminate());
     $this->assertSame('/magento/setup/navigation/header-bar.phtml', $viewModel->getTemplate());
 }
 public function setUp()
 {
     $this->updater = $this->getMock('Magento\\Setup\\Model\\Updater', [], [], '', false);
     $this->fullModuleList = $this->getMock('Magento\\Framework\\Module\\FullModuleList', [], [], '', false);
     $this->filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $this->navigation = $this->getMock('Magento\\Setup\\Model\\Navigation', [], [], '', false);
     $this->controller = new StartUpdater($this->filesystem, $this->navigation, $this->updater, $this->fullModuleList);
     $this->navigation->expects($this->any())->method('getMenuItems')->willReturn([['title' => 'A', 'type' => 'update'], ['title' => 'B', 'type' => 'upgrade'], ['title' => 'C', 'type' => 'enable'], ['title' => 'D', 'type' => 'disable']]);
     $this->request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $this->response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $this->mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $this->mvcEvent->expects($this->any())->method('setRequest')->with($this->request)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setResponse')->with($this->response)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
 }