Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I'm seeing various failures when running tests on D9.2 + PHP 7.3:
Fatal error: Uncaught Error: Cannot instantiate abstract class Drupal\Tests\amp\Functional\BasicTestCaseBase in /app/web/core/scripts/run-tests.sh:837
Stack trace:
#0 /app/web/core/scripts/run-tests.sh(60): simpletest_script_run_one_test('179', 'Drupal\\Tests\\am...')
#1 {main}
thrown in /app/web/core/scripts/run-tests.sh on line 837
PHP Fatal error: Uncaught Error: Class 'Drupal\Tests\amp\Functional\AmpToolbar' not found in /app/web/core/scripts/run-tests.sh:837
Stack trace:
#0 /app/web/core/scripts/run-tests.sh(60): simpletest_script_run_one_test('177', 'Drupal\\Tests\\am...')
#1 {main}
thrown in /app/web/core/scripts/run-tests.sh on line 837
...
1) Drupal\Tests\amp\Functional\AmpFormatterTextTest::testFormatter
Behat\Mink\Exception\ExpectationException: The string "<amp-img
src="https://upload.wikimedia.org/wikipedia/commons/8/8a/Carnegie_Hall_Tower.JPG"
width="1920" height="2560"
layout="responsive"></amp-img>" was not found
anywhere in the HTML response of the current page.
/app/web/vendor/behat/mink/src/WebAssert.php:768
/app/web/vendor/behat/mink/src/WebAssert.php:324
/app/web/core/tests/Drupal/Tests/WebAssert.php:519
/app/web/modules/contrib/amp/tests/src/Functional/AmpFormatterTestBase.php:115
/app/web/vendor/phpunit/phpunit/src/Framework/TestResult.php:703
...
1) Drupal\Tests\amp\Functional\AmpFormatterTextTrimmedTest::testFormatter
Behat\Mink\Exception\ExpectationException: The string "<h2>AMP
body transform</h2><amp-img
src="https://upload.wikimedia.org/wikipedia/commons/8/8a/Carnegie_Hall_Tower.JPG"
width="1920" height="2560"
layout="responsive"></amp-img><p>N4mx5fV jaHUrnhJ
zzW8KOBxog fTQONTZDY cTpc bHT5 aLMMx0gcJu cURYk07 yk5rt0 hBdb oaiec1n5
iGTkw vz9i5sWk.</p>" was not found anywhere in the HTML response
of the current page.
/app/web/vendor/behat/mink/src/WebAssert.php:768
/app/web/vendor/behat/mink/src/WebAssert.php:324
/app/web/core/tests/Drupal/Tests/WebAssert.php:519
/app/web/modules/contrib/amp/tests/src/Functional/AmpFormatterTestBase.php:115
/app/web/vendor/phpunit/phpunit/src/Framework/TestResult.php:703
Steps to reproduce
- Set up a site running Drupal 9.2 on PHP 7.3. For lando users, a recipe is added in #2.
- Require amp 3.x-dev: composer require drupal/amp:3.x-dev
- Require amp's dev dependencies: composer require drupal/amptheme:^3.0 drupal/adsense:^1.0 --dev
- Run the functional tests, inspect the output
Proposed resolution
- Resolve the tests failures
Remaining tasks
- Determine why the testbot doesn't trigger any of these errors.
Issue fork amp-3232376
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jedihe CreditAttribution: jedihe as a volunteer commentedFor lando users:
Save as .lando.yml:
In the same dir as .lando.yml, run:
Tested with Lando v3.3.1.
Comment #3
jedihe CreditAttribution: jedihe as a volunteer commentedComment #5
jedihe CreditAttribution: jedihe as a volunteer commentedComment #6
jedihe CreditAttribution: jedihe as a volunteer commentedAfter trying to find the cause for the errors in AmpFormatterTextTest and AmpFormatterTextTrimmedTest, now I don't see those anymore. The only "different" thing I remember doing is using curl from inside the Lando-Docker container to verify the image used for testing (https://upload.wikimedia.org/wikipedia/commons/8/8a/Carnegie_Hall_Tower.JPG) was downloading fine, which it was.
Comment #7
jedihe CreditAttribution: jedihe as a volunteer commented