diff --git a/README.md b/README.md index 63aabab..4cc1562 100644 --- a/README.md +++ b/README.md @@ -11,20 +11,6 @@ composer require --dev roave/no-leaks ## Usage -In your `phpunit.xml` configuration, add following section: - -```xml - - - - - - - -``` - -Then run: - ```sh vendor/bin/roave-no-leaks ``` diff --git a/bin/roave-no-leaks.php b/bin/roave-no-leaks.php index 185207e..740b505 100755 --- a/bin/roave-no-leaks.php +++ b/bin/roave-no-leaks.php @@ -5,6 +5,8 @@ namespace Roave\NoLeaks\CLI; use PHPUnit\TextUI\Command; +use PHPUnit\TextUI\TestRunner; +use Roave\NoLeaks\PHPUnit\CollectTestExecutionMemoryFootprints; (function () { if (file_exists(__DIR__ . '/../vendor/autoload.php')) { @@ -13,7 +15,33 @@ require_once __DIR__ . '/../../../autoload.php'; } - $_SERVER['argv'][] = '--repeat=3'; + (new class extends Command + { + /** @var CollectTestExecutionMemoryFootprints */ + private $collector; - Command::main(); + public function __construct() + { + $this->collector = new CollectTestExecutionMemoryFootprints(); + } + + protected function handleArguments(array $argv) : void + { + parent::handleArguments($argv); + + $this->arguments['listeners'] = array_merge( + $this->arguments['listeners'] ?? [], + [$this->collector] + ); + } + + protected function createRunner() : TestRunner + { + $runner = parent::createRunner(); + + $runner->addExtension($this->collector); + + return $runner; + } + })->run(array_merge($_SERVER['argv'], ['--repeat=3']), true); })(); diff --git a/test/e2e/phpunit-mock-suite.xml b/test/e2e/phpunit-mock-suite.xml index 0d41536..366233d 100644 --- a/test/e2e/phpunit-mock-suite.xml +++ b/test/e2e/phpunit-mock-suite.xml @@ -11,14 +11,6 @@ beStrictAboutTodoAnnotatedTests="true" verbose="true" > - - - - - - - - ./LeakyIntegrationTest.php