hechoendrupal / drupal-console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
http://drupalconsole.com
GNU General Public License v2.0
940 stars 559 forks source link

[test] How to test the Drupal Console testing cases? #3939

Open webther opened 5 years ago

webther commented 5 years ago

Problem/Motivation

There are some test files in the /vendor/drupal/console/Test directory. What is the correct way to test these testing cases?

How to reproduce

$ vendor/bin/phpunit vendor/drupal/console/Test/Generator/FormGeneratorTest.php

The result returns PHP Fatal error: Class 'Drupal\Console\Test\Generator\GeneratorTest' not found in \vendor\drupal\console\Test\Generator\FormGeneratorTest.php on line 13

clemens-tolboom commented 5 years ago

I was wondering too.

I can run core

/usr/local/bin/php vendor/phpunit/phpunit/phpunit \
  --configuration core \
  --configuration core/phpunit.xml.dist \
  Drupal\Tests\datetime\Unit\Plugin\migrate\field\DateFieldTest \
  ./core/modules/datetime/tests/src/Unit/Plugin/migrate/field/DateFieldTest.php
/usr/local/bin/php vendor/phpunit/phpunit/phpunit \
  --configuration core \
  --configuration core/phpunit.xml.dist \
  --list-suites

gives (not important but still annoying) error about Devel/Drush for my system but should list all suites.

Fatal error: Trait 'Drush\TestTraits\DrushTestTrait' not found in /.../modules/contrib/devel/devel_generate/tests/src/Functional/DevelGenerateCommandsTest.php on line 26

Trying

vendor/phpunit/phpunit/phpunit   --configuration core/phpunit.xml.dist vendor/drupal/console/Test/
vendor/phpunit/phpunit/phpunit   --configuration vendor/drupal/console/phpunit.xml.dist 

both gives

vendor/phpunit/phpunit/phpunit   --configuration core/phpunit.xml.dist vendor/drupal/console/Test/
PHP Fatal error:  Class 'Drupal\Console\Test\Command\GenerateCommandTest' not found in /...vendor/drupal/console/Test/Command/Generate/ServiceCommandTest.php on line 14