getMockBuilder(\Magento\Framework\App\ProductMetadata::class) ->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::class, $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']); } }