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

  1. Set up a site running Drupal 9.2 on PHP 7.3. For lando users, a recipe is added in #2.
  2. Require amp 3.x-dev: composer require drupal/amp:3.x-dev
  3. Require amp's dev dependencies: composer require drupal/amptheme:^3.0 drupal/adsense:^1.0 --dev
  4. Run the functional tests, inspect the output

Proposed resolution

  1. Resolve the tests failures

Remaining tasks

  1. Determine why the testbot doesn't trigger any of these errors.

Issue fork amp-3232376

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jedihe created an issue. See original summary.

jedihe’s picture

For lando users:

Save as .lando.yml:

name: amp--tests-failures
recipe: drupal9
config:
  webroot: web
  php: '7.3'
drush: path:/app/vendor/bin/drush
tooling:
  composer:
    service: appserver
    cmd: composer --working-dir=/app/web
  drush:
    service: appserver
    cmd: /app/web/vendor/bin/drush --root=/app/web
  run-tests:
    service: appserver
    description: Fires run-tests.sh, with many parameters already filled-in
    cmd: php /app/web/core/scripts/run-tests.sh --color --verbose --keep-results --suppress-deprecations --concurrency "8" --php /usr/local/bin/php --sqlite "/tmp/test.sqlite" --dburl "mysql://drupal9:drupal9@database/drupal9"
services:
  appserver:
    type: php:7.3
    overrides:
      environment:
        SIMPLETEST_DB: "mysql://drupal9:drupal9@database/drupal9"

In the same dir as .lando.yml, run:

git clone --depth 1 --branch 9.2.x https://git.drupalcode.org/project/drupal.git web
lando start
lando composer require drupal/amp:3.x-dev
lando composer require drupal/amptheme:^3.0 drupal/adsense:^1.0 --dev
lando run-tests --types "PHPUnit-Functional" --module amp

Tested with Lando v3.3.1.

jedihe’s picture

Issue summary: View changes

jedihe’s picture

Issue summary: View changes
jedihe’s picture

After 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.

jedihe’s picture

Status: Active » Needs review