PHPUnit/using PHPUnit

From Freephile Wiki
Revision as of 15:35, 10 February 2025 by Admin (talk | contribs) (Created page with "== in a Docker Container == After you clone the code for SemanticMediaWiki and initialize the build submodule, you should be able to use '''make''' for various activities. <code>make bash</code> puts you into a bash shell as root in the wiki container Change to the SMW directory if instead you are at the document root of <tt>/var/www/html</tt><br> <code> cd extensions/SemanticMediaWiki</code><br> <pre> root@2421517631d1:/var/www/html/extensions/SemanticMediaWiki# </pre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

in a Docker Container[edit]

After you clone the code for SemanticMediaWiki and initialize the build submodule, you should be able to use make for various activities. make bash puts you into a bash shell as root in the wiki container

Change to the SMW directory if instead you are at the document root of /var/www/html
cd extensions/SemanticMediaWiki

root@2421517631d1:/var/www/html/extensions/SemanticMediaWiki# 

Now you can manually interact with PHPUnit from the command line to accomplish precise objectives without having to wade through volumes of data and spend huge amounts of time waiting for entire test runs.

php ${MW_INSTALL_PATH:-../..}/tests/phpunit/phpunit.php -c phpunit.xml.dist --bootstrap tests/bootstrap.php --list-tests
lists the ~8800 tests such as:

SMW\Tests\Integration\SpecialsTest::testValidCovers

If you pipe it through grep, you can filter out the tests you want to run:

|grep JSONScript

such as

SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile"a-0001.json"

But this
php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --bootstrap tests/bootstrap.php --filter SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile"a-0001.json"

only produces the result

No tests executed!