PHPUnit/using PHPUnit: Difference between revisions

No edit summary
No edit summary
Line 4: Line 4:
PHPUnit Test Suites are logical groups of files and/or directories that you can feed to PHPUnit for testing.
PHPUnit Test Suites are logical groups of files and/or directories that you can feed to PHPUnit for testing.


What are the test suites available to developers/testers in the SemanticMediaWiki codebase? The '''<code>list-suites</code>''' option will tell us.
What are the test suites available to developers/testers in the SemanticMediaWiki codebase? The '''<code>list-suites</code>''' option will tell us.<syntaxhighlight lang="bash">
 
php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --list-suites
<code>php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --bootstrap tests/bootstrap.php --list-suites</code>
# or since that entrypoint is deprecated, we should call composer phpunit
# and pass our additional command line parameters after a --
composer phpunit -- -c phpunit.xml.dist --list-suites
</syntaxhighlight>
   - semantic-mediawiki-check  
   - semantic-mediawiki-check  
   - semantic-mediawiki-data-model  
   - semantic-mediawiki-data-model  
Line 15: Line 18:
   - semantic-mediawiki-benchmark
   - semantic-mediawiki-benchmark
[[File:Grep benchmark testsuite screenshot.png|thumb|527x527px|grepping the PHPUnit configuration file for the definition of the semantic-mediawiki-benchmark test suite]]
[[File:Grep benchmark testsuite screenshot.png|thumb|527x527px|grepping the PHPUnit configuration file for the definition of the semantic-mediawiki-benchmark test suite]]
But where do those come from? What do they mean? What do they do? They are defined in <code>phpunit.xml.dist</code> so you could inspect that file for more details.
But where do those come from? What do they mean? What do they do? They are defined in <code>phpunit.xml.dist</code> so you could inspect that file for more details. In that file, we can see that the "''benchmark''" test suite will process all the PHPUnit tests defined in the '''<code>tests/phpunit/Benchmark</code>''' directory.


== in a Docker Container ==
== in a Docker Container ==