Skip to content

Commit 4d41fb7

Browse files
author
Joan He
committed
Merge remote-tracking branch 'origin/MAGETWO-34627-update-setup-tool-for-EE-packages' into MAGETWO-34625-ee-packages
2 parents 3fb9035 + 65b7055 commit 4d41fb7

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@
88

99
use Magento\Install\Test\Page\Install;
1010
use Magento\Mtf\Constraint\AbstractConstraint;
11+
use Magento\TestFramework\Inspection\Exception;
1112

1213
/**
1314
* Check that agreement text present on Terms & Agreement page during install.
1415
*/
1516
class AssertAgreementTextPresent extends AbstractConstraint
1617
{
1718
/**
18-
* Part of license agreement text.
19+
* Part of Default license agreement text.
1920
*/
20-
const LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0';
21+
const DEFAULT_LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0';
22+
23+
/**
24+
* Part of Default license agreement text.
25+
*/
26+
const LICENSE_AGREEMENT_TEXT = 'END USER LICENSE AGREEMENT';
2127

2228
/**
2329
* Assert that part of license agreement text is present on Terms & Agreement page.
@@ -27,11 +33,19 @@ class AssertAgreementTextPresent extends AbstractConstraint
2733
*/
2834
public function processAssert(Install $installPage)
2935
{
30-
\PHPUnit_Framework_Assert::assertContains(
31-
self::LICENSE_AGREEMENT_TEXT,
32-
$installPage->getLicenseBlock()->getLicense(),
33-
'License agreement text is absent.'
34-
);
36+
try {
37+
\PHPUnit_Framework_Assert::assertContains(
38+
self::LICENSE_AGREEMENT_TEXT,
39+
$installPage->getLicenseBlock()->getLicense(),
40+
'License agreement text is absent.'
41+
);
42+
} catch (\Exception $e) {
43+
\PHPUnit_Framework_Assert::assertContains(
44+
self::DEFAULT_LICENSE_AGREEMENT_TEXT,
45+
$installPage->getLicenseBlock()->getLicense(),
46+
'License agreement text is absent.'
47+
);
48+
}
3549
}
3650

3751
/**

setup/src/Magento/Setup/Model/License.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@
1616
*/
1717
class License
1818
{
19+
/**
20+
* Default License File location
21+
*
22+
* @var string
23+
*/
24+
const DEFAULT_LICENSE_FILENAME = 'LICENSE.txt';
25+
1926
/**
2027
* License File location
2128
*
2229
* @var string
2330
*/
24-
const LICENSE_FILENAME = 'LICENSE.txt';
31+
const LICENSE_FILENAME = 'LICENSE_EE.txt';
2532

2633
/**
2734
* Directory that contains license file
@@ -43,13 +50,16 @@ public function __construct(Filesystem $filesystem)
4350
/**
4451
* Returns contents of License file.
4552
*
46-
* @return string
53+
* @return string|boolean
4754
*/
4855
public function getContents()
4956
{
50-
if (!$this->dir->isFile(self::LICENSE_FILENAME)) {
57+
if ($this->dir->isFile(self::LICENSE_FILENAME)) {
58+
return $this->dir->readFile(self::LICENSE_FILENAME);
59+
} elseif ($this->dir->isFile(self::DEFAULT_LICENSE_FILENAME)) {
60+
return $this->dir->readFile(self::DEFAULT_LICENSE_FILENAME);
61+
} else {
5162
return false;
5263
}
53-
return $this->dir->readFile(self::LICENSE_FILENAME);
5464
}
5565
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ public function setUp()
3333
public function testGetContents()
3434
{
3535
$this->directoryReadMock
36-
->expects($this->once())
36+
->expects($this->atLeastOnce())
3737
->method('readFile')
38-
->with(License::LICENSE_FILENAME)
3938
->will($this->returnValue('License text'));
4039
$this->directoryReadMock
41-
->expects($this->once())
40+
->expects($this->atLeastOnce())
4241
->method('isFile')
43-
->with(License::LICENSE_FILENAME)
4442
->will($this->returnValue(true));
4543

4644
$license = new License($this->filesystemMock);
@@ -50,9 +48,8 @@ public function testGetContents()
5048
public function testGetContentsNoFile()
5149
{
5250
$this->directoryReadMock
53-
->expects($this->once())
51+
->expects($this->atLeastOnce())
5452
->method('isFile')
55-
->with(License::LICENSE_FILENAME)
5653
->will($this->returnValue(false));
5754

5855
$license = new License($this->filesystemMock);

0 commit comments

Comments
 (0)