diff --git a/.gitlab-ci/.gitlab-ci-template.yml b/.gitlab-ci/.gitlab-ci-template.yml
index 02c0ac02a3d24026d314dac606bae6264ca303c7..32f0cfdb96f8e2ae506f73f34016c077f41545c9 100755
--- a/.gitlab-ci/.gitlab-ci-template.yml
+++ b/.gitlab-ci/.gitlab-ci-template.yml
@@ -93,11 +93,6 @@ build:
           "emuse/behat-html-formatter:0.2.*";
         echo -e "\e[0Ksection_end:`date +%s`:dev_install\r\e[0K";
       fi
-    # Added phpspec for Drupal 9.0+, @see https://www.drupal.org/project/drupal/issues/3182653
-    - |
-      if [ 1 -eq "$(echo "${CI_DRUPAL_VERSION} >= 9.0" | bc)" ]; then
-        composer require --no-ansi -n "phpspec/prophecy-phpunit";
-      fi
 
 ################################################################################
 # Drupal tests.
diff --git a/.gitlab-ci/ci/02_test.yml b/.gitlab-ci/ci/02_test.yml
index 0599af7a6887267c5c18ac278b3e24cb863ba511..cb21736de7cc0178f4956faa8a9abe5b2cd18fc8 100644
--- a/.gitlab-ci/ci/02_test.yml
+++ b/.gitlab-ci/ci/02_test.yml
@@ -32,4 +32,10 @@
     - mkdir -p ${BROWSERTEST_OUTPUT_DIRECTORY} &&
       chown -R www-data:www-data ${BROWSERTEST_OUTPUT_DIRECTORY} &&
       chmod -R 777 ${BROWSERTEST_OUTPUT_DIRECTORY}
+    # Added phpspec for Drupal 9.0+, @see https://www.drupal.org/project/drupal/issues/3182653
+    # @todo: remove when 8.9 is deprecated.
+    - |
+      if [ 1 -eq "$(echo "${CI_DRUPAL_VERSION} >= 9.0" | bc)" ]; then
+        composer require --no-ansi -n "phpspec/prophecy-phpunit";
+      fi
     - echo -e "\e[0Ksection_end:`date +%s`:test_ci_prepare\r\e[0K"