Exemplo n.º 1
0
 /**
  * @return array|ViewModel
  */
 public function indexAction()
 {
     $this->view->setVariable('menu', $this->navigation->getMenuItems());
     $this->view->setVariable('main', $this->navigation->getMainItems());
     $this->view->setTerminal(true);
     return $this->view;
 }
Exemplo n.º 2
0
 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());
 }
Exemplo n.º 3
0
 /**
  * @return array|ViewModel
  */
 public function menuAction()
 {
     $view = new ViewModel();
     $view->setTemplate('/magento/setup/navigation/menu.phtml');
     $view->setTerminal(true);
     $view->setVariable('menu', $this->navigation->getMenuItems());
     $view->setVariable('main', $this->navigation->getMainItems());
     return $view;
 }
Exemplo n.º 4
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());
 }
Exemplo n.º 5
0
 /**
  * @return array|ViewModel
  */
 public function headerBarAction()
 {
     if ($this->navigation->getType() === NavModel::NAV_UPDATER) {
         if ($this->status->isUpdateError() || $this->status->isUpdateInProgress()) {
             $this->view->setVariable('redirect', '../' . Environment::UPDATER_DIR . '/index.php');
         }
     }
     $this->view->setTemplate('/magento/setup/navigation/header-bar.phtml');
     $this->view->setTerminal(true);
     return $this->view;
 }
 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);
 }
Exemplo n.º 7
0
 /**
  * Create flag to be used in Updater
  *
  * @param string $type
  * @param string $title
  * @return void
  */
 private function createTypeFlag($type, $title)
 {
     $data = [];
     $data[self::KEY_POST_JOB_TYPE] = $type;
     $data[self::KEY_POST_HEADER_TITLE] = $title;
     $menuItems = $this->navigation->getMenuItems();
     $titles = [];
     foreach ($menuItems as $menuItem) {
         if (isset($menuItem['type']) && $menuItem['type'] === $type) {
             $titles[] = str_replace("\n", '<br />', $menuItem['title']);
         }
     }
     $data['titles'] = $titles;
     $directoryWrite = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
     $directoryWrite->writeFile('.type.json', Json::encode($data));
 }
Exemplo n.º 8
0
 /**
  * @return JsonModel
  */
 public function indexAction()
 {
     return $this->jsonModel->setVariable('nav', $this->navigation->getData());
 }
 public function testGetMainItems()
 {
     $this->assertEquals([['main' => 'abc', 'key3' => 'value3']], array_values($this->navigation->getMainItems()));
 }
Exemplo n.º 10
0
 public function testGetMainItems()
 {
     $this->serviceLocatorMock->expects($this->once())->method('get')->with('config')->will($this->returnValue(['nav' => [['key1' => 'value1'], ['key2' => 'value2'], ['main' => 'abc', 'key3' => 'value3'], ['main' => ''], ['main' => false]]]));
     $this->assertEquals([['main' => 'abc', 'key3' => 'value3']], array_values($this->navigation->getMainItems()));
 }