diff --git a/.travis.yml b/.travis.yml index 1b81b89..76aa707 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,11 @@ before_install: - sudo service elasticsearch restart before_script: - | - [[ $COVERAGE == "true" ]] || phpenv config-rm xdebug.ini + if [[ $COVERAGE == "true" ]]; then \ + pecl install -f xdebug-2.9.8 #see https://github.com/magento/magento2/issues/28961 \ + else + phpenv config-rm xdebug.ini + fi ./.travis/before_script.sh script: phpunit -c magento2/dev/tests/$TEST_SUITE `[[ $COVERAGE == "true" ]] && echo "--coverage-text --coverage-clover=/tmp/coverage.clover"` after_script: diff --git a/.travis/before_script.sh b/.travis/before_script.sh index 85c2aaf..dc8acbb 100755 --- a/.travis/before_script.sh +++ b/.travis/before_script.sh @@ -13,7 +13,7 @@ echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini phpenv rehash; -composer selfupdate +composer selfupdate --1 # clone main magento github repository git clone --branch $MAGENTO_VERSION --depth=1 https://github.com/magento/magento2 @@ -49,8 +49,11 @@ case $TEST_SUITE in SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_integration_tests; ' - cp etc/install-config-mysql.travis.php.dist etc/install-config-mysql.php + cp etc/install-config-mysql.php.dist etc/install-config-mysql.php + # Remove AMQP configuration sed -i '/amqp/d' etc/install-config-mysql.php + # Remove default root password + sed -i 's/123123q//' etc/install-config-mysql.php cd ../../.. echo "Wait for ElasticSearch on port 9200..." diff --git a/src/Theme/ThemeFixture.php b/src/Theme/ThemeFixture.php new file mode 100644 index 0000000..efc1f78 --- /dev/null +++ b/src/Theme/ThemeFixture.php @@ -0,0 +1,37 @@ +get(Registration::class); + $registration->register(); + } + + /** + * Set the current theme + * + * @param string $themePath a theme identifier without the area, e.g. Magento/luma + */ + public static function setCurrentTheme(string $themePath): void + { + /** @var DesignInterface $design */ + $design = Bootstrap::getObjectManager()->get(DesignInterface::class); + $design->setDesignTheme($themePath); + } +} diff --git a/tests/Catalog/IndexerErrorsTest.php b/tests/Catalog/IndexerErrorsTest.php index 30b073a..7c21727 100644 --- a/tests/Catalog/IndexerErrorsTest.php +++ b/tests/Catalog/IndexerErrorsTest.php @@ -19,11 +19,13 @@ class IndexerErrorsTest extends TestCase private static $indexIsScheduledOrig; /** + * @deprecated the test should be removed in next release, but we should still keep the exception in case this + * happens again * @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php */ public function testHelpfulErrorMessageForFulltextIndexSchedule() { - $this->onlyRunFromMagento('2.3.0'); + $this->markTestSkipped('Since Magento 2.3.6 / 2.4.1 these transaction exceptions do not occur anymore'); $this->expectException(\Exception::class); try { @@ -58,13 +60,4 @@ public static function disableReindexScheduleRollback() $model = Bootstrap::getObjectManager()->get(IndexerRegistry::class)->get('catalogsearch_fulltext'); $model->setScheduled(self::$indexIsScheduledOrig); } - - private function onlyRunFromMagento($magentoVersion): void - { - /** @var ProductMetadataInterface $productMetadata */ - $productMetadata = Bootstrap::getObjectManager()->get(ProductMetadataInterface::class); - if (version_compare($productMetadata->getVersion(), $magentoVersion, '<')) { - $this->markTestSkipped('Only relevant for Magento >= ' . $magentoVersion . ''); - } - } } diff --git a/tests/Theme/ThemeFixtureTest.php b/tests/Theme/ThemeFixtureTest.php new file mode 100644 index 0000000..58b6921 --- /dev/null +++ b/tests/Theme/ThemeFixtureTest.php @@ -0,0 +1,35 @@ +get(DesignInterface::class); + $this->assertEquals('Magento/blank', $design->getDesignTheme()->getCode()); + } + + public function testCanUseTestThemeAfterRegistering() + { + ThemeFixture::registerTestThemes(); + ThemeFixture::setCurrentTheme('Custom/default'); + /** @var DesignInterface $design */ + $design = Bootstrap::getObjectManager()->get(DesignInterface::class); + $this->assertEquals('Custom/default', $design->getDesignTheme()->getCode()); + $this->assertGreaterThan(0, $design->getDesignTheme()->getId()); + $this->assertEquals('Magento/blank', $design->getDesignTheme()->getParentTheme()->getCode()); + } +} diff --git a/tests/Theme/_files/design/frontend/Custom/default/registration.php b/tests/Theme/_files/design/frontend/Custom/default/registration.php new file mode 100644 index 0000000..6e8486d --- /dev/null +++ b/tests/Theme/_files/design/frontend/Custom/default/registration.php @@ -0,0 +1,11 @@ + + + Test theme + Magento/blank +