GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing phpunit.de — Getting Started with Version 13 of PHPUnit Getting Started with PHPUnit 13This tutorial assumes that you use PHP 8.4 or PHP 8.5. You will learn how to write simple unit tests as well as how to download and run PHPUnit. The documentation for PHPUnit 13 can be found here. DownloadPHP Archive (PHAR)We distribute a PHP Archive (PHAR) that contains everything you need in order to use PHPUnit 13. Simply download it from here and make it executable: ➜ wget -O phpunit https://phar.phpunit.de/phpunit-13.phar ➜ chmod +x phpunit ➜ ./phpunit --version PHPUnit 13.0.0 by Sebastian Bergmann and contributors. Please refer to the documentation for details on how to verify PHAR releases of PHPUnit. ComposerYou can add PHPUnit as a local, per-project, development-time dependency to your project using Composer: ➜ composer require --dev phpunit/phpunit ^13 ➜ ./vendor/bin/phpunit --version PHPUnit 13.0.0 by Sebastian Bergmann and contributors. The example shown above assumes that Your
Code
Test Code
Test ExecutionPHP Archive (PHAR)➜ ./phpunit --bootstrap src/autoload.php tests PHPUnit 13.0.0 by Sebastian Bergmann and contributors. .. 2 / 2 (100%) Time: 70 ms, Memory: 10.00MB OK (2 tests, 2 assertions)
The above assumes that you have downloaded
Composer➜ ./vendor/bin/phpunit tests PHPUnit 13.0.0 by Sebastian Bergmann and contributors. .. 2 / 2 (100%) Time: 70 ms, Memory: 10.00MB OK (2 tests, 2 assertions)
The above assumes that
TestDoxBelow you see an alternative output which is based on the idea that the name of a test can be used to document the behavior that is verified by the test: ➜ ./phpunit --bootstrap src/autoload.php --testdox tests PHPUnit 13.0.0 by Sebastian Bergmann and contributors. .. 2 / 2 (100%) Time: 70 ms, Memory: 10.00MB Email ✔ Can be created from valid email address ✔ Cannot be created from invalid email address OK (2 tests, 2 assertions) ➜ ./vendor/bin/phpunit --testdox tests PHPUnit 13.0.0 by Sebastian Bergmann and contributors. .. 2 / 2 (100%) Time: 70 ms, Memory: 10.00MB Email ✔ Can be created from valid email address ✔ Cannot be created from invalid email address OK (2 tests, 2 assertions) |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |