diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php b/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php index 7c59cf1d4c263b8493ce2dcbb0889824a55e72ed..1bc49b0acc7773869bb8b2af6f669c01661f94df 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php @@ -8,6 +8,7 @@ namespace Magento\Install\Test\Constraint; use Magento\Install\Test\Page\Install; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\TestFramework\Inspection\Exception; /** * Check that agreement text present on Terms & Agreement page during install. @@ -15,9 +16,14 @@ use Magento\Mtf\Constraint\AbstractConstraint; class AssertAgreementTextPresent extends AbstractConstraint { /** - * Part of license agreement text. + * Part of Default license agreement text. */ - const LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0'; + const DEFAULT_LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0'; + + /** + * Part of Default license agreement text. + */ + const LICENSE_AGREEMENT_TEXT = 'END USER LICENSE AGREEMENT'; /** * Assert that part of license agreement text is present on Terms & Agreement page. @@ -27,11 +33,19 @@ class AssertAgreementTextPresent extends AbstractConstraint */ public function processAssert(Install $installPage) { - \PHPUnit_Framework_Assert::assertContains( - self::LICENSE_AGREEMENT_TEXT, - $installPage->getLicenseBlock()->getLicense(), - 'License agreement text is absent.' - ); + try { + \PHPUnit_Framework_Assert::assertContains( + self::LICENSE_AGREEMENT_TEXT, + $installPage->getLicenseBlock()->getLicense(), + 'License agreement text is absent.' + ); + } catch (\Exception $e) { + \PHPUnit_Framework_Assert::assertContains( + self::DEFAULT_LICENSE_AGREEMENT_TEXT, + $installPage->getLicenseBlock()->getLicense(), + 'License agreement text is absent.' + ); + } } /** diff --git a/setup/src/Magento/Setup/Model/License.php b/setup/src/Magento/Setup/Model/License.php index beb3d857aedea1ca21ca059697d79434a114a263..1c7458bd3404c1c816d134f61a97c4f41a43b5ee 100644 --- a/setup/src/Magento/Setup/Model/License.php +++ b/setup/src/Magento/Setup/Model/License.php @@ -16,12 +16,19 @@ use Magento\Framework\Filesystem; */ class License { + /** + * Default License File location + * + * @var string + */ + const DEFAULT_LICENSE_FILENAME = 'LICENSE.txt'; + /** * License File location * * @var string */ - const LICENSE_FILENAME = 'LICENSE.txt'; + const LICENSE_FILENAME = 'LICENSE_EE.txt'; /** * Directory that contains license file @@ -43,13 +50,16 @@ class License /** * Returns contents of License file. * - * @return string + * @return string|boolean */ public function getContents() { - if (!$this->dir->isFile(self::LICENSE_FILENAME)) { + if ($this->dir->isFile(self::LICENSE_FILENAME)) { + return $this->dir->readFile(self::LICENSE_FILENAME); + } elseif ($this->dir->isFile(self::DEFAULT_LICENSE_FILENAME)) { + return $this->dir->readFile(self::DEFAULT_LICENSE_FILENAME); + } else { return false; } - return $this->dir->readFile(self::LICENSE_FILENAME); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php b/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php index 1d8f9f3accce01dd668f9f8b4ed4e998a2fafe47..3bb5a5324c33e7b58bb3d11a28cacdd10f0a8735 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php @@ -33,14 +33,12 @@ class LicenseTest extends \PHPUnit_Framework_TestCase public function testGetContents() { $this->directoryReadMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('readFile') - ->with(License::LICENSE_FILENAME) ->will($this->returnValue('License text')); $this->directoryReadMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('isFile') - ->with(License::LICENSE_FILENAME) ->will($this->returnValue(true)); $license = new License($this->filesystemMock); @@ -50,9 +48,8 @@ class LicenseTest extends \PHPUnit_Framework_TestCase public function testGetContentsNoFile() { $this->directoryReadMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('isFile') - ->with(License::LICENSE_FILENAME) ->will($this->returnValue(false)); $license = new License($this->filesystemMock);