コード例 #1
0
 /**
  * @param FixtureFactory $fixtureFactory
  * @param AssertSuccessfulReadinessCheck $assertReadiness
  * @param AssertVersionAndEditionCheck $assertVersionAndEdition
  * @param AssertSuccessMessage $assertSuccessMessage
  * @param AssertApplicationVersion $assertApplicationVersion
  * @param array $upgrade
  * @return void
  */
 public function test(FixtureFactory $fixtureFactory, AssertSuccessfulReadinessCheck $assertReadiness, AssertVersionAndEditionCheck $assertVersionAndEdition, AssertSuccessMessage $assertSuccessMessage, AssertApplicationVersion $assertApplicationVersion, $upgrade = [])
 {
     // Create fixture
     $upgradeFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $upgrade]);
     $createBackupConfig = array_intersect_key($upgrade, ['optionsCode' => '', 'optionsMedia' => '', 'optionsDb' => '']);
     $createBackupFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $createBackupConfig]);
     $version = $upgrade['upgradeVersion'];
     $suffix = "( (CE|EE))\$";
     $normalVersion = '(0|[1-9]\\d*)';
     $preReleaseVersion = "((0(?!\\d+(\\.|\\+|{$suffix}))|[1-9A-Za-z])[0-9A-Za-z-]*)";
     $buildVersion = '([0-9A-Za-z][0-9A-Za-z-]*)';
     $versionPattern = "/^{$normalVersion}(\\.{$normalVersion}){2}" . "(-{$preReleaseVersion}(\\.{$preReleaseVersion})*)?" . "(\\+{$buildVersion}(\\.{$buildVersion})*)?{$suffix}/";
     if (preg_match($versionPattern, $version)) {
         preg_match("/(.*){$suffix}/", $version, $matches);
         $version = $matches[1];
     } else {
         $this->fail("Provided version format does not comply with semantic versioning specification. Got '{$version}'");
     }
     // Authenticate in admin area
     $this->adminDashboard->open();
     // Open Web Setup Wizard
     $this->setupWizard->open();
     // Authenticate on repo.magento.com
     if ($upgrade['needAuthentication'] === 'Yes') {
         $this->setupWizard->getSystemConfig()->clickSystemConfig();
         $this->setupWizard->getAuthentication()->fill($upgradeFixture);
         $this->setupWizard->getAuthentication()->clickSaveConfig();
         $this->setupWizard->open();
     }
     // Select upgrade to version
     $this->setupWizard->getSystemUpgradeHome()->clickSystemUpgrade();
     $this->setupWizard->getSelectVersion()->fill($upgradeFixture);
     if ($upgrade['otherComponents'] === 'Yes') {
         $this->setupWizard->getSelectVersion()->chooseUpgradeOtherComponents();
     }
     $this->setupWizard->getSelectVersion()->clickNext();
     // Readiness Check
     $this->setupWizard->getReadiness()->clickReadinessCheck();
     $assertReadiness->processAssert($this->setupWizard);
     $this->setupWizard->getReadiness()->clickNext();
     // Create Backup page
     $this->setupWizard->getCreateBackup()->fill($createBackupFixture);
     $this->setupWizard->getCreateBackup()->clickNext();
     // Check info and press 'Upgrade' button
     $assertVersionAndEdition->processAssert($this->setupWizard, $upgrade['package'], $version);
     $this->setupWizard->getSystemUpgrade()->clickSystemUpgrade();
     $assertSuccessMessage->processAssert($this->setupWizard, $upgrade['package']);
     // Check application version
     $this->adminDashboard->open();
     $assertApplicationVersion->processAssert($this->adminDashboard, $version);
 }
コード例 #2
0
 /**
  * Assert that readiness check items are passed.
  *
  * @param SetupWizard $setupWizard
  * @return void
  */
 public function processAssert(SetupWizard $setupWizard)
 {
     \PHPUnit_Framework_Assert::assertContains(self::UPDATER_APPLICATION_MESSAGE, $setupWizard->getReadiness()->getUpdaterApplicationCheck(), 'Updater application check is incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::CRON_SCRIPT_MESSAGE, $setupWizard->getReadiness()->getCronScriptCheck(), 'Cron scripts are incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::DEPENDENCY_CHECK_MESSAGE, $setupWizard->getReadiness()->getDependencyCheck(), 'Dependency check is incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::PHP_VERSION_MESSAGE, $setupWizard->getReadiness()->getPhpVersionCheck(), 'PHP version is incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::PHP_SETTING_REGEXP, $setupWizard->getReadiness()->getSettingsCheck(), 'PHP settings check failed.');
     \PHPUnit_Framework_Assert::assertRegExp(self::PHP_EXTENSIONS_REGEXP, $setupWizard->getReadiness()->getPhpExtensionsCheck(), 'PHP extensions missed.');
 }
コード例 #3
0
 /**
  * @param FixtureFactory $fixtureFactory
  * @param AssertSuccessfulReadinessCheck $assertReadiness
  * @param AssertVersionAndEditionCheck $assertVersionAndEdition
  * @param AssertSuccessMessage $assertSuccessMessage
  * @param AssertApplicationVersion $assertApplicationVersion
  * @param array $upgrade
  * @return void
  */
 public function test(FixtureFactory $fixtureFactory, AssertSuccessfulReadinessCheck $assertReadiness, AssertVersionAndEditionCheck $assertVersionAndEdition, AssertSuccessMessage $assertSuccessMessage, AssertApplicationVersion $assertApplicationVersion, $upgrade = [])
 {
     // Create fixture
     $upgradeFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $upgrade]);
     $createBackupConfig = array_intersect_key($upgrade, ['optionsCode' => '', 'optionsMedia' => '', 'optionsDb' => '']);
     $createBackupFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $createBackupConfig]);
     $version = $upgrade['upgradeVersion'];
     if (preg_match('/^[0-9].[0-9].[0-9]/', $version, $out)) {
         $version = array_shift($out);
     }
     // Authenticate in admin area
     $this->adminDashboard->open();
     // Open Web Setup Wizard
     $this->setupWizard->open();
     // Authenticate on repo.magento.com
     if ($upgrade['needAuthentication'] === 'Yes') {
         $this->setupWizard->getSystemConfig()->clickSystemConfig();
         $this->setupWizard->getAuthentication()->fill($upgradeFixture);
         $this->setupWizard->getAuthentication()->clickSaveConfig();
         $this->setupWizard->open();
     }
     // Select upgrade to version
     $this->setupWizard->getSystemUpgradeHome()->clickSystemUpgrade();
     $this->setupWizard->getSelectVersion()->fill($upgradeFixture);
     $this->setupWizard->getSelectVersion()->clickNext();
     // Readiness Check
     $this->setupWizard->getReadiness()->clickReadinessCheck();
     $assertReadiness->processAssert($this->setupWizard);
     $this->setupWizard->getReadiness()->clickNext();
     // Create Backup page
     $this->setupWizard->getCreateBackup()->fill($createBackupFixture);
     $this->setupWizard->getCreateBackup()->clickNext();
     // Check info and press 'Upgrade' button
     $assertVersionAndEdition->processAssert($this->setupWizard, $upgrade['package'], $version);
     $this->setupWizard->getSystemUpgrade()->clickSystemUpgrade();
     $assertSuccessMessage->processAssert($this->setupWizard, $upgrade['package']);
     // Check application version
     $this->adminDashboard->open();
     $assertApplicationVersion->processAssert($this->adminDashboard, $version);
 }
コード例 #4
0
 /**
  * Assert upgrade is successfully
  *
  * @param SetupWizard $setupWizard
  * @param string $package
  * @return void
  */
 public function processAssert(SetupWizard $setupWizard, $package)
 {
     $message = "You upgraded:";
     \PHPUnit_Framework_Assert::assertContains($message, $setupWizard->getSuccessMessage()->getUpdaterStatus(), 'Success message is incorrect.');
     \PHPUnit_Framework_Assert::assertContains($package, $setupWizard->getSuccessMessage()->getUpdaterStatus(), 'Updated package is incorrect.');
 }
コード例 #5
0
 /**
  * Assert that package and version is correct
  *
  * @param SetupWizard $setupWizard
  * @param string $package
  * @param string $version
  * @return void
  */
 public function processAssert(SetupWizard $setupWizard, $package, $version)
 {
     $message = "We're ready to upgrade {$package} to {$version}";
     \PHPUnit_Framework_Assert::assertContains($message, $setupWizard->getSystemUpgrade()->getUpgradeMessage(), 'Updater application check is incorrect.');
 }