Skip to content

Commit 54e00ac

Browse files
author
Ivan Gavryshko
committed
MAGETWO-52914: Setup UI Modifications
- fixed static test - added test coverage for unstable versions
1 parent 5f37661 commit 54e00ac

File tree

1 file changed

+61
-47
lines changed

1 file changed

+61
-47
lines changed

setup/src/Magento/Setup/Test/Unit/Model/SystemPackageTest.php

Lines changed: 61 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,60 @@ class SystemPackageTest extends \PHPUnit_Framework_TestCase
4545
*/
4646
private $composer;
4747

48+
/**
49+
* @var array
50+
*/
51+
private $expectedPackages = [
52+
[
53+
'id' => '1.2.0',
54+
'name' => 'Version 1.2.0 EE (latest)',
55+
'package' => 'magento/product-enterprise-edition',
56+
'stable' => true
57+
],
58+
[
59+
'id' => '1.2.0',
60+
'name' => 'Version 1.2.0 CE (latest)',
61+
'package' => 'magento/product-community-edition',
62+
'stable' => true
63+
],
64+
[
65+
'id' => '1.1.0',
66+
'name' => 'Version 1.1.0 EE',
67+
'package' => 'magento/product-enterprise-edition',
68+
'stable' => true
69+
],
70+
[
71+
'id' => '1.1.0',
72+
'name' => 'Version 1.1.0 CE',
73+
'package' => 'magento/product-community-edition',
74+
'stable' => true
75+
],
76+
[
77+
'id' => '1.1.0-RC1',
78+
'name' => 'Version 1.1.0-RC1 EE (unstable version)',
79+
'package' => 'magento/product-enterprise-edition',
80+
'stable' => false
81+
],
82+
[
83+
'id' => '1.1.0-RC1',
84+
'name' => 'Version 1.1.0-RC1 CE (unstable version)',
85+
'package' => 'magento/product-community-edition',
86+
'stable' => false
87+
],
88+
[
89+
'id' => '1.0.0',
90+
'name' => 'Version 1.0.0 EE (current)',
91+
'package' => 'magento/product-enterprise-edition',
92+
'stable' => true
93+
],
94+
[
95+
'id' => '1.0.0',
96+
'name' => 'Version 1.0.0 CE (current)',
97+
'package' => 'magento/product-community-edition',
98+
'stable' => true
99+
],
100+
];
101+
48102
/**
49103
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Composer\ComposerInformation
50104
*/
@@ -113,45 +167,6 @@ public function testGetPackageVersions()
113167

114168
$this->systemPackage = new SystemPackage($this->composerAppFactory, $this->composerInformation);
115169

116-
$expected = [
117-
[
118-
'id' => '1.2.0',
119-
'name' => 'Version 1.2.0 EE (latest)',
120-
'package' => 'magento/product-enterprise-edition',
121-
'stable' => true
122-
],
123-
[
124-
'id' => '1.2.0',
125-
'name' => 'Version 1.2.0 CE (latest)',
126-
'package' => 'magento/product-community-edition',
127-
'stable' => true
128-
],
129-
[
130-
'id' => '1.1.0',
131-
'name' => 'Version 1.1.0 EE',
132-
'package' => 'magento/product-enterprise-edition',
133-
'stable' => true
134-
],
135-
[
136-
'id' => '1.1.0',
137-
'name' => 'Version 1.1.0 CE',
138-
'package' => 'magento/product-community-edition',
139-
'stable' => true
140-
],
141-
[
142-
'id' => '1.0.0',
143-
'name' => 'Version 1.0.0 EE (current)',
144-
'package' => 'magento/product-enterprise-edition',
145-
'stable' => true
146-
],
147-
[
148-
'id' => '1.0.0',
149-
'name' => 'Version 1.0.0 CE (current)',
150-
'package' => 'magento/product-community-edition',
151-
'stable' => true
152-
],
153-
];
154-
155170
$this->infoCommand->expects($this->at(0))
156171
->method('run')
157172
->with('magento/product-community-edition')
@@ -160,14 +175,14 @@ public function testGetPackageVersions()
160175
'name' => 'magento/product-community-edition',
161176
'description' => 'eCommerce Platform for Growth (Enterprise Edition)',
162177
'keywords' => '',
163-
'versions' => '1.2.0, 1.1.0, * 1.0.0',
178+
'versions' => '1.2.0, 1.1.0, 1.1.0-RC1, * 1.0.0',
164179
'type' => 'metapackage',
165180
'license' => 'OSL-3.0, AFL-3.0',
166181
'source' => '[]',
167182
'names' => 'magento/product-community-edition',
168183
'current_version' => '1.0.0',
169-
'available_versions' => [1 => '1.2.0', 2 => '1.1.0', 3 => '1.0.0'],
170-
'new_versions' => ['1.2.0', '1.1.0']
184+
'available_versions' => [1 => '1.2.0', 2 => '1.1.0', 3 => '1.1.0-RC1', 4 => '1.0.0'],
185+
'new_versions' => ['1.2.0', '1.1.0', '1.1.0-RC1']
171186
]
172187
);
173188

@@ -179,18 +194,17 @@ public function testGetPackageVersions()
179194
'name' => 'magento/product-enterprise-edition',
180195
'description' => 'eCommerce Platform for Growth (Enterprise Edition)',
181196
'keywords' => '',
182-
'versions' => '1.2.0, 1.1.0, * 1.0.0',
197+
'versions' => '1.2.0, 1.1.0, 1.1.0-RC1, * 1.0.0',
183198
'type' => 'metapackage',
184199
'license' => 'OSL-3.0, AFL-3.0',
185200
'source' => '[]',
186201
'names' => 'magento/product-enterprise-edition',
187202
'current_version' => '1.0.0',
188-
'available_versions' => [1 => '1.2.0', 2 => '1.1.0', 3 => '1.0.0'],
189-
'new_versions' => ['1.2.0', '1.1.0']
203+
'available_versions' => [1 => '1.2.0', 2 => '1.1.0', 3 => '1.1.0-RC1', 4 => '1.0.0'],
204+
'new_versions' => ['1.2.0', '1.1.0', '1.1.0-RC1']
190205
]
191206
);
192-
193-
$this->assertEquals($expected, $this->systemPackage->getPackageVersions());
207+
$this->assertEquals($this->expectedPackages, $this->systemPackage->getPackageVersions());
194208
}
195209

196210
/**

0 commit comments

Comments
 (0)