Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Testing (SimpleTest) Install/Run Error

By editor , 9 July, 2020
Question

Error N°1 : PHPunit not found

Error N°2 : BrowserTestBase::setUp() must be compatible with PHPUnit

Error N°1 : PHPunit not found

If uou have a message like : Add Phpunit via composer

CAUTION : PHPunit Version >= 8 is not compatable with drupal, so use the 7

composer require --dev phpunit/phpunit:7

Note : Probably you will have errors like:
PHPunit Test failed to complete; Error: Class "Symfony\Bridge\PhpUnit\SymfonyTestsListener" does not exis
Error: Class 'Behat\Mink\Driver\GoutteDriver' not found

in this case, add the following libraries
composer require --dev symfony/phpunit-bridge
composer require --dev behat/mink-goutte-driver

Error N°2 : BrowserTestBase::setUp() must be compatible with PHPUnit

Probable your phpunit version is >7 (8 or 9).
1. Chenge the version in composer.json file
"phpunit/phpunit": "^7.0"

2. Run composer update

.

New testing tools use PhpUnit and behat. See:

  • https://www.drupal.org/docs/automated-testing
  • https://www.drupal.org/docs/automated-testing/phpunit-in-drupal
  • https://behat-drupal-extension.readthedocs.io/en/v4.0.1/

 

Tags

  • Drupal 8
  • Code
  • Testing
Test modules using drupal "Testing" System.

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer