Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LandingUpdaterTest.php
Go to the documentation of this file.
1 <?php
8 
9 use \Magento\Setup\Controller\LandingUpdater;
10 use \Magento\Framework\App\ProductMetadata;
11 use \Magento\Framework\Composer\ComposerJsonFinder;
13 
14 class LandingUpdaterTest extends \PHPUnit\Framework\TestCase
15 {
19  const TEST_PRODUCT_VERSION = '222.333.444';
20 
21  public function testIndexAction()
22  {
24  $productMetadataMock = $this->getMockBuilder(\Magento\Framework\App\ProductMetadata::class)
25  ->setMethods(['getVersion'])
26  ->disableOriginalConstructor()
27  ->getMock();
28  $productMetadataMock->expects($this->once())
29  ->method('getVersion')
30  ->willReturn($this::TEST_PRODUCT_VERSION);
32  $controller = new LandingUpdater($productMetadataMock);
33  $_SERVER['DOCUMENT_ROOT'] = 'some/doc/root/value';
34  $viewModel = $controller->indexAction();
35  $this->assertInstanceOf(\Zend\View\Model\ViewModel::class, $viewModel);
36  $this->assertTrue($viewModel->terminate());
37  $this->assertEquals('/magento/setup/landing.phtml', $viewModel->getTemplate());
38  $variables = $viewModel->getVariables();
39  $this->assertArrayHasKey('version', $variables);
40  $this->assertEquals($this::TEST_PRODUCT_VERSION, $variables['version']);
41  $this->assertArrayHasKey('welcomeMsg', $variables);
42  $this->assertArrayHasKey('docRef', $variables);
43  $this->assertArrayHasKey('agreeButtonText', $variables);
44  $this->assertEquals('Agree and Update Magento', $variables['agreeButtonText']);
45  }
46 }
$viewModel
$controller
Definition: info.phtml:14