1

There is a way to see if the Drupal tests are working? I wanted to test the FileSystemTest, but when I type phpunit command on the test folder this error appears:

1) Drupal\Tests\Core\File\FileSystemTest::testChmodFile
Argument 1 passed to Drupal\Core\File\FileSystem::__construct() must be an instance of Drupal\Core\File\StreamWrapperManagerInterface, instance of Mock_StreamWrapperManagerInterface_428d696c given, called in /var/www/html/drupal-8.0.5/core/lib/tests/FileSystemTest.php on line 43 and defined

/var/www/html/drupal-8.0.5/core/lib/Drupal/Core/File/FileSystem.php:62
/var/www/html/drupal-8.0.5/core/lib/tests/FileSystemTest.php:43
/home/bianca/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:153
/home/bianca/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:105

Someone know how to make the test work with phpunit?

  • How did you run phpunit exactly? – Berdir Apr 4 '16 at 18:08
  • I typed phpunit on terminal. – B. Pereira Apr 4 '16 at 18:12
1

See https://www.drupal.org/node/2116263.

You either need to run it inside the core folder, or (easier IMHO), you need to pass the -c core argument, so it finds the phpunit documentation.

Also note that only a part of Drupal's tests are phpunit, others are based on our own test framework and you need to run them with run-tests.sh or through the UI.

That said, you only need to run core tests if you work patches for Drupal core. Drupal's tests always path, nothing is added unless it is passing all tests.

| improve this answer | |
  • I tried to do what you tell me and I did what the article you send me said too, but another error occurred, look: PHP Fatal error: Call to undefined function Drupal\Component\Utility\mb_strtolower() in /var/www/html/drupal-8.0.5/core/lib/Drupal/Component/Utility/Unicode.php on line 331 – B. Pereira Apr 4 '16 at 18:32
  • Maybe you don't have mbstring enabled for CLI? – Clive Apr 4 '16 at 19:05
  • Why do I need mbstring? I used php -m to see and I really don't have this module installed, but I want to know how this can help me, because I'll need to ask my boss to install it as I'm not the root user :/ – B. Pereira Apr 5 '16 at 15:13
  • @Berdir, I think now I really did what you tell me, but I got two more errors! One appears when I call the second core folder: Cannot open file "/home/bianca/drupal/core/lib/Drupal/Core/vendor/autoload.php". and other when I call the first core folder: PHP Fatal error: Cannot redeclare class Drupal\Tests\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumperTest in /home/bianca/drupal/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php on line 597. I used php ./vendor/bin/phpunit -c /home/bianca/drupal/core. – B. Pereira Apr 5 '16 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.