9 use \Magento\Setup\Controller\SelectVersion;
10 use \Magento\Setup\Controller\ResponseTypeInterface;
17 private $systemPackage;
28 $this->systemPackage = $this->createMock(\
Magento\Setup\Model\SystemPackage::class);
37 $this->assertInstanceOf(\
Zend\View\Model\ViewModel::class,
$viewModel);
43 $this->systemPackage->expects($this->once())
44 ->method(
'getPackageVersions')
46 'package' =>
'magento/product-community-edition',
48 'id' =>
'magento/product-community-edition',
49 'name' =>
'Version 1.0.0' 52 $jsonModel = $this->controller->systemPackageAction();
53 $this->assertInstanceOf(\
Zend\View\Model\JsonModel::class, $jsonModel);
54 $variables = $jsonModel->getVariables();
55 $this->assertArrayHasKey(
'responseType', $variables);
61 $this->systemPackage->expects($this->once())
62 ->method(
'getPackageVersions')
63 ->will($this->throwException(
new \
Exception(
"Test error message")));
64 $jsonModel = $this->controller->systemPackageAction();
65 $this->assertInstanceOf(\
Zend\View\Model\JsonModel::class, $jsonModel);
66 $variables = $jsonModel->getVariables();
67 $this->assertArrayHasKey(
'responseType', $variables);
73 $this->systemPackage->expects($this->once())
74 ->method(
'getInstalledSystemPackages')
76 'package' =>
'magento/product-community-edition',
78 'id' =>
'magento/product-community-edition',
79 'name' =>
'Version 1.0.0' 82 $jsonModel = $this->controller->installedSystemPackageAction();
83 $this->assertInstanceOf(\
Zend\View\Model\JsonModel::class, $jsonModel);
84 $variables = $jsonModel->getVariables();
85 $this->assertArrayHasKey(
'responseType', $variables);
91 $this->systemPackage->expects($this->once())
92 ->method(
'getInstalledSystemPackages')
93 ->will($this->throwException(
new \
Exception(
"Test error message")));
94 $jsonModel = $this->controller->installedSystemPackageAction();
95 $variables = $jsonModel->getVariables();
96 $this->assertArrayHasKey(
'responseType', $variables);
testInstalledSystemPackageActionWithError()
testInstalledSystemPackageAction()
const RESPONSE_TYPE_SUCCESS
testSystemPackageAction()
const RESPONSE_TYPE_ERROR
testSystemPackageActionActionWithError()