public function testIndexAction() { /** @var $controller LandingUpdater */ $controller = new LandingUpdater(); $_SERVER['DOCUMENT_ROOT'] = 'some/doc/root/value'; $viewModel = $controller->indexAction(); $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $viewModel); $this->assertTrue($viewModel->terminate()); $this->assertEquals('/magento/setup/landing.phtml', $viewModel->getTemplate()); $variables = $viewModel->getVariables(); $this->assertArrayHasKey('version', $variables); $this->assertArrayHasKey('welcomeMsg', $variables); $this->assertArrayHasKey('docRef', $variables); $this->assertArrayHasKey('agreeButtonText', $variables); $this->assertEquals('Agree and Update Magento', $variables['agreeButtonText']); }
public function testIndexAction() { /** @var \Magento\Framework\App\ProductMetadata|\PHPUnit_Framework_MockObject_MockObject $productMetadataMock */ $productMetadataMock = $this->getMockBuilder('Magento\\Framework\\App\\ProductMetadata')->setMethods(['getVersion'])->disableOriginalConstructor()->getMock(); $productMetadataMock->expects($this->once())->method('getVersion')->willReturn($this::TEST_PRODUCT_VERSION); /** @var $controller LandingUpdater */ $controller = new LandingUpdater($productMetadataMock); $_SERVER['DOCUMENT_ROOT'] = 'some/doc/root/value'; $viewModel = $controller->indexAction(); $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $viewModel); $this->assertTrue($viewModel->terminate()); $this->assertEquals('/magento/setup/landing.phtml', $viewModel->getTemplate()); $variables = $viewModel->getVariables(); $this->assertArrayHasKey('version', $variables); $this->assertEquals($this::TEST_PRODUCT_VERSION, $variables['version']); $this->assertArrayHasKey('welcomeMsg', $variables); $this->assertArrayHasKey('docRef', $variables); $this->assertArrayHasKey('agreeButtonText', $variables); $this->assertEquals('Agree and Update Magento', $variables['agreeButtonText']); }