vancodx / php-testing
VanCodX PHP Testing
1.6.0
2025-02-24 19:22 UTC
Requires
- php: ^8.3
- ext-xdebug: *
- mockery/mockery: ^1.6.12
- phpstan/phpstan: ^2.1.6
- phpstan/phpstan-mockery: ^2.0.0
- phpstan/phpstan-phpunit: ^2.0.4
- phpunit/phpunit: ^12.0.4
Requires (Dev)
- roave/security-advisories: dev-latest
- vancodx/php-coding-style: ^1.3.0
This package is auto-updated.
Last update: 2025-05-08 16:01:50 UTC
README
Installation
Install this package with the following command:
composer require --dev vancodx/php-testing
Create ".phpstan.neon.dist" file in the root directory of your project with the following contents:
includes: - vendor/vancodx/php-testing/phpstan-extension/extension.php parameters: level: 10 paths: - src - tests
Create "phpunit.xml.dist" file in the root directory of your project with the following contents:
<?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"> <testsuites> <testsuite name="unit"> <directory>tests/Unit</directory> </testsuite> </testsuites> <source> <include> <directory suffix=".php">src</directory> </include> </source> <coverage> <report> <text outputFile="php://stdout" showOnlySummary="true"/> </report> </coverage> </phpunit>
Add the following lines into "composer.json" file of your project:
{ "scripts": { "test": [ "phpstan analyze", "phpunit" ] } }
Add the following lines into your ".gitignore" file:
.phpstan.neon
.phpunit.result.cache
phpunit.xml
Usage
Use the following command:
composer test
Running tests
Use the following command for running the tests inside a Docker container:
docker compose up --build tests