diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 856b9a2e60ddc07588962935bdf82a0b92e57589..2ebf6b497c8c77f2731e8fe08c1cab066c234cc4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,34 +10,49 @@ include: # Start custom overrides. # +.setup-extension: &setup-extension + # https://docs.gitlab.com/ee/ci/jobs/index.html#pre-collapse-sections + - echo -e "\e[0Ksection_start:`date +%s`:my_first_section[collapsed=true]\r\e[0KInstall PHP Extensions" + - > + if [ "$REDIS_INTERFACE" == "PhpRedis" ]; then + apt-get update + apt-get install -y --no-install-recommends $PHPIZE_DEPS + pecl install redis && docker-php-ext-enable redis + fi + - > + if [ "$REDIS_INTERFACE" == "Relay" ]; then + apt-get update + apt-get install -y --no-install-recommends $PHPIZE_DEPS + if [ ! -f /usr/src/php.tar.xz ]; then + PHP_URL="https://www.php.net/distributions/php-`php -r "echo phpversion();"`.tar.xz" + curl -fsSL -o /usr/src/php.tar.xz "$PHP_URL" + fi + curl -sSLf -o /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions + chmod +x /usr/local/bin/install-php-extensions + PHPIZE_DEPS="autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c" PHP_INI_DIR="/usr/local/etc/php" install-php-extensions relay + fi + - echo -e "\e[0Ksection_end:`date +%s`:my_first_section\r\e[0K" + variables: _SHOW_ENVIRONMENT_VARIABLES: 1 REDIS_HOST: redis + REDIS_INTERFACE: PhpRedis + OPT_IN_TEST_PREVIOUS_MINOR: 1 -composer: +.composer-base: before_script: - composer require --dev predis/predis --no-update -phpunit: +.phpunit-base: parallel: matrix: - REDIS_INTERFACE: - PhpRedis - Predis - Relay + before_script: + - *setup-extension services: - !reference [ .with-database ] - !reference [ .with-chrome ] - name: redis:6 - before_script: - # https://docs.gitlab.com/ee/ci/jobs/index.html#pre-collapse-sections - - echo -e "\e[0Ksection_start:`date +%s`:my_first_section[collapsed=true]\r\e[0KInstall PHP Extensions" - - sudo sed -i 's/zend.assertions = -1/zend.assertions = 1/g' /usr/local/etc/php/php.ini - - pecl install redis && docker-php-ext-enable redis - - > - if [ "$REDIS_INTERFACE" == "Relay" ]; then - sudo curl -sSLf -o /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions - sudo chmod +x /usr/local/bin/install-php-extensions - sudo PHPIZE_DEPS="autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c" PHP_INI_DIR="/usr/local/etc/php" install-php-extensions relay - fi - - echo -e "\e[0Ksection_end:`date +%s`:my_first_section\r\e[0K" diff --git a/src/Cache/CacheBase.php b/src/Cache/CacheBase.php index b59441ad026cb30a03706e3ed078f3f0c497196b..79cb5594d7195aa0f08e4712fa2bf949e1aa2834 100644 --- a/src/Cache/CacheBase.php +++ b/src/Cache/CacheBase.php @@ -158,7 +158,13 @@ abstract class CacheBase implements CacheBackendInterface { $in_transaction = \Drupal::database()->inTransaction(); if ($in_transaction) { if (empty($this->delayedDeletions)) { - \Drupal::database()->addRootTransactionEndCallback([$this, 'postRootTransactionCommit']); + if (method_exists(\Drupal::database(), 'transactionManager')) { + \Drupal::database()->transactionManager()->addPostTransactionCallback([$this, 'postRootTransactionCommit']); + } + else { + /** @phpstan-ignore-next-line */ + \Drupal::database()->addRootTransactionEndCallback([$this, 'postRootTransactionCommit']); + } } $this->delayedDeletions = array_unique(array_merge($this->delayedDeletions, $cids)); } diff --git a/tests/src/Functional/WebTest.php b/tests/src/Functional/WebTest.php index 5f22c26d13ef11d9d15b821cdc825dd65f4115cc..02463263a2d7b229c9eeba8393cfeb99f3bdbc4a 100644 --- a/tests/src/Functional/WebTest.php +++ b/tests/src/Functional/WebTest.php @@ -138,14 +138,14 @@ class WebTest extends BrowserTestBase { $edit["modules[field_ui][enable]"] = TRUE; $edit["modules[text][enable]"] = TRUE; $this->drupalGet('admin/modules'); - $this->submitForm($edit, t('Install')); - $this->submitForm([], t('Continue')); + $this->submitForm($edit, 'Install'); + $this->submitForm([], 'Continue'); $assert = $this->assertSession(); // The order of the modules is not guaranteed, so just assert that they are // all listed. - $assert->elementTextContains('css', '.messages--status', '6 modules have been enabled'); + $assert->elementTextContains('css', '.messages--status', '6 modules have been'); $assert->elementTextContains('css', '.messages--status', 'Field UI'); $assert->elementTextContains('css', '.messages--status', 'Node'); $assert->elementTextContains('css', '.messages--status', 'Text'); @@ -160,7 +160,7 @@ class WebTest extends BrowserTestBase { 'type' => $node_type = mb_strtolower($this->randomMachineName()), ]; $this->drupalGet('admin/structure/types/add'); - $this->submitForm($edit, t('Save and manage fields')); + $this->submitForm($edit, 'Save and manage fields'); $field_name = mb_strtolower($this->randomMachineName()); $this->fieldUIAddNewField('admin/structure/types/manage/' . $node_type, $field_name, NULL, 'text'); @@ -171,7 +171,7 @@ class WebTest extends BrowserTestBase { 'field_' . $field_name . '[0][value]' => $this->randomMachineName(), ]; $this->drupalGet('node/add/' . $node_type); - $this->submitForm($edit, t('Save')); + $this->submitForm($edit, 'Save'); // Test the output as anonymous user. $this->drupalLogout(); @@ -186,7 +186,7 @@ class WebTest extends BrowserTestBase { $update = [ 'title[0][value]' => $this->randomMachineName(), ]; - $this->submitForm($update, t('Save')); + $this->submitForm($update, 'Save'); $this->assertSession()->responseContains($update['title[0][value]']); $this->drupalGet('node'); $this->assertSession()->responseContains($update['title[0][value]']);