diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6324c20..e815e00 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -7,20 +7,26 @@ on: branches: [ main ] jobs: - build-test: + unit-test: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - - name: Composer 8 - uses: php-actions/composer@v5 + uses: actions/checkout@v3 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - php_version: 8.2 - - name: PHP 8 tests - uses: php-actions/phpunit@v2 - with: - version: 9 - php_version: 8.2 - memory_limit: 1G + php-version: 8.2 + extensions: xdebug + tools: composer:2 + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Composer (AsyncUnit & Tools) + run: composer install + - name: Unit Testing + env: + XDEBUG_MODE: coverage + run: ./vendor/bin/phpunit diff --git a/acme_src/ErrorConditions/AfterAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php b/acme_src/ErrorConditions/AfterAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php index 6618506..81c8c86 100644 --- a/acme_src/ErrorConditions/AfterAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php +++ b/acme_src/ErrorConditions/AfterAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php @@ -2,7 +2,7 @@ namespace Acme\DemoSuites\ErrorConditions\AfterAllAttributeOnNotTestCaseOrTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; class BadTestCase { diff --git a/acme_src/ErrorConditions/AfterAllNonStaticMethod/BadTestCase.php b/acme_src/ErrorConditions/AfterAllNonStaticMethod/BadTestCase.php index 878428c..0b32a49 100644 --- a/acme_src/ErrorConditions/AfterAllNonStaticMethod/BadTestCase.php +++ b/acme_src/ErrorConditions/AfterAllNonStaticMethod/BadTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ErrorConditions\AfterAllNonStaticMethod; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class BadTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/AfterEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php b/acme_src/ErrorConditions/AfterEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php index 5da7956..86235ef 100644 --- a/acme_src/ErrorConditions/AfterEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php +++ b/acme_src/ErrorConditions/AfterEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\AfterEachAttributeOnNotTestCaseOrTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; class BadTestCase { diff --git a/acme_src/ErrorConditions/BadNamespaceTest/MyTestCase.php b/acme_src/ErrorConditions/BadNamespaceTest/MyTestCase.php index efd7e75..dd75e1a 100644 --- a/acme_src/ErrorConditions/BadNamespaceTest/MyTestCase.php +++ b/acme_src/ErrorConditions/BadNamespaceTest/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTest\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/BadNamespaceTestCaseAfterAll/MyTestCase.php b/acme_src/ErrorConditions/BadNamespaceTestCaseAfterAll/MyTestCase.php index 4c8648d..d645762 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestCaseAfterAll/MyTestCase.php +++ b/acme_src/ErrorConditions/BadNamespaceTestCaseAfterAll/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestCaseAfterAll\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/BadNamespaceTestCaseAfterEach/MyTestCase.php b/acme_src/ErrorConditions/BadNamespaceTestCaseAfterEach/MyTestCase.php index 4d4f74a..56c4e4e 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestCaseAfterEach/MyTestCase.php +++ b/acme_src/ErrorConditions/BadNamespaceTestCaseAfterEach/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestCaseAfterEach\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeAll/MyTestCase.php b/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeAll/MyTestCase.php index 9cf63f4..df998af 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeAll/MyTestCase.php +++ b/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeAll/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestCaseBeforeAll\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeEach/MyTestCase.php b/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeEach/MyTestCase.php index b9b7186..5b23bc0 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeEach/MyTestCase.php +++ b/acme_src/ErrorConditions/BadNamespaceTestCaseBeforeEach/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestCaseBeforeEach\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterAll/MyTestSuite.php b/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterAll/MyTestSuite.php index 80a9cc1..e7b3faf 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterAll/MyTestSuite.php +++ b/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterAll/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestSuiteAfterAll\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEach/MyTestSuite.php b/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEach/MyTestSuite.php index 1a77d66..d4b5929 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEach/MyTestSuite.php +++ b/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEach/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestSuiteAfterEach\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEachTest/MyTestSuite.php b/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEachTest/MyTestSuite.php index 29246e1..9172705 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEachTest/MyTestSuite.php +++ b/acme_src/ErrorConditions/BadNamespaceTestSuiteAfterEachTest/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestSuiteAfterEachTest\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEachTest; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterEachTest; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeAll/MyTestSuite.php b/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeAll/MyTestSuite.php index 1319935..781cb34 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeAll/MyTestSuite.php +++ b/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeAll/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestSuiteBeforeAll\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEach/MyTestSuite.php b/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEach/MyTestSuite.php index 9c05424..06b4eaf 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEach/MyTestSuite.php +++ b/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEach/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestSuiteBeforeEach\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEachTest/MyTestSuite.php b/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEachTest/MyTestSuite.php index 38cd95d..3aa9deb 100644 --- a/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEachTest/MyTestSuite.php +++ b/acme_src/ErrorConditions/BadNamespaceTestSuiteBeforeEachTest/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BadNamespaceTestSuiteBeforeEachTest\IntentionallyBad; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEachTest; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEachTest; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ErrorConditions/BeforeAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php b/acme_src/ErrorConditions/BeforeAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php index 17b8d44..697e473 100644 --- a/acme_src/ErrorConditions/BeforeAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php +++ b/acme_src/ErrorConditions/BeforeAllAttributeOnNotTestCaseOrTestSuite/BadTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ErrorConditions\BeforeAllAttributeOnNotTestCaseOrTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; class BadTestCase { diff --git a/acme_src/ErrorConditions/BeforeAllNonStaticMethod/BadTestCase.php b/acme_src/ErrorConditions/BeforeAllNonStaticMethod/BadTestCase.php index 6f24cac..bb15fa9 100644 --- a/acme_src/ErrorConditions/BeforeAllNonStaticMethod/BadTestCase.php +++ b/acme_src/ErrorConditions/BeforeAllNonStaticMethod/BadTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ErrorConditions\BeforeAllNonStaticMethod; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class BadTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/BeforeEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php b/acme_src/ErrorConditions/BeforeEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php index abec50b..ca3e2d9 100644 --- a/acme_src/ErrorConditions/BeforeEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php +++ b/acme_src/ErrorConditions/BeforeEachAttributeOnNotTestCaseOrTestSuite/BadTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ErrorConditions\BeforeEachAttributeOnNotTestCaseOrTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; class BadTestCase { diff --git a/acme_src/ErrorConditions/NoTestsTestCase/BadTestCase.php b/acme_src/ErrorConditions/NoTestsTestCase/BadTestCase.php index 3240180..03f017d 100644 --- a/acme_src/ErrorConditions/NoTestsTestCase/BadTestCase.php +++ b/acme_src/ErrorConditions/NoTestsTestCase/BadTestCase.php @@ -2,7 +2,7 @@ namespace Acme\DemoSuites\ErrorConditions\NoTestsTestCase; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\TestCase; class BadTestCase extends TestCase { diff --git a/acme_src/ErrorConditions/TestAttributeOnNotTestCase/BadTestCase.php b/acme_src/ErrorConditions/TestAttributeOnNotTestCase/BadTestCase.php index 3d09943..17c3aaa 100644 --- a/acme_src/ErrorConditions/TestAttributeOnNotTestCase/BadTestCase.php +++ b/acme_src/ErrorConditions/TestAttributeOnNotTestCase/BadTestCase.php @@ -2,7 +2,7 @@ namespace Acme\DemoSuites\ErrorConditions\TestAttributeOnNotTestCase; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\Test; class BadTestCase { diff --git a/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/FirstTestCase.php b/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/FirstTestCase.php index 8a98d4e..3833ea5 100644 --- a/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/FirstTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterAllTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function ensureSuiteCounter() : void { - $this->assert()->intEquals(0, $this->testSuite()->getCounter()); + $this->assert->intEquals(0, $this->testSuite->getCounter()); } #[Test] public function ensureSuiteCounterAgain() : void { - $this->assert()->intEquals(0, $this->testSuite()->getCounter()); + $this->assert->intEquals(0, $this->testSuite->getCounter()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/MyTestSuite.php b/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/MyTestSuite.php index f36edd6..ad19878 100644 --- a/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterAllTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/SecondTestCase.php b/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/SecondTestCase.php index e1f87e2..b8f0a22 100644 --- a/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterAllTestSuiteHook/SecondTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterAllTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { #[Test] public function ensureSuiteCounter() : void { - $this->assert()->intEquals(0, $this->testSuite()->getCounter()); + $this->assert->intEquals(0, $this->testSuite->getCounter()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/FirstTestCase.php b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/FirstTestCase.php index c4e1235..f3406a6 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/FirstTestCase.php @@ -2,24 +2,24 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function testSomething() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } #[Test] public function testSomethingElse() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } #[Test] public function testItAgain() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/MyTestSuite.php b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/MyTestSuite.php index de6525f..a96e5a4 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/SecondTestCase.php b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/SecondTestCase.php index 4555ee8..97a25eb 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/SecondTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { #[Test] public function ensureIntEquals() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/ThirdTestCase.php b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/ThirdTestCase.php index 4f4cae4..e4ef6df 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/ThirdTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestSuiteHook/ThirdTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class ThirdTestCase extends TestCase { #[Test] public function testFoo() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } #[Test] public function testBar() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/FirstTestCase.php b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/FirstTestCase.php index 4743a91..f8e5ec6 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/FirstTestCase.php @@ -2,24 +2,24 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function testSomething() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } #[Test] public function testSomethingElse() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } #[Test] public function testItAgain() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/MyTestSuite.php b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/MyTestSuite.php index 0b3e40a..677776e 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterEachTest; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/SecondTestCase.php b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/SecondTestCase.php index 5c432a3..171f468 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/SecondTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { #[Test] public function ensureIntEquals() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/ThirdTestCase.php b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/ThirdTestCase.php index 0c91709..c785a79 100644 --- a/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/ThirdTestCase.php +++ b/acme_src/ExplicitTestSuite/AfterEachTestTestSuiteHook/ThirdTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AfterEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class ThirdTestCase extends TestCase { #[Test] public function testFoo() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } #[Test] public function testBar() : void { - $this->assert()->arrayEquals([], $this->testSuite()->getState()); + $this->assert->arrayEquals([], $this->testSuite->getState()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestCase.php b/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestCase.php index c1cee3e..9aa5445 100644 --- a/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AnnotatedDefaultTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { @@ -15,8 +15,8 @@ public function getTestSuiteName() : ?string { #[Test] public function ensureSomething() { - $this->testSuiteName = $this->testSuite()->getName(); - $this->assert()->stringEquals(MyTestSuite::class, $this->testSuiteName); + $this->testSuiteName = $this->testSuite->getName(); + $this->assert->stringEquals(MyTestSuite::class, $this->testSuiteName); } diff --git a/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestSuite.php b/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestSuite.php index 809baee..8f6be6b 100644 --- a/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/AnnotatedDefaultTestSuite/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\AnnotatedDefaultTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite {} \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/FirstTestCase.php b/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/FirstTestCase.php index ec7b57a..b377ab4 100644 --- a/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/FirstTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeAllTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function ensureSuiteCounter() : void { - $this->assert()->intEquals(1, $this->testSuite()->getCounter()); + $this->assert->intEquals(1, $this->testSuite->getCounter()); } #[Test] public function ensureSuiteCounterAgain() : void { - $this->assert()->intEquals(1, $this->testSuite()->getCounter()); + $this->assert->intEquals(1, $this->testSuite->getCounter()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/MyTestSuite.php b/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/MyTestSuite.php index d50701f..0d2e5f0 100644 --- a/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeAllTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/SecondTestCase.php b/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/SecondTestCase.php index 13ad0b0..678b6e9 100644 --- a/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeAllTestSuiteHook/SecondTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeAllTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { #[Test] public function ensureSuiteCounter() : void { - $this->assert()->intEquals(1, $this->testSuite()->getCounter()); + $this->assert->intEquals(1, $this->testSuite->getCounter()); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/FirstTestCase.php b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/FirstTestCase.php index a181291..cd71aa1 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/FirstTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function testSomething() : void { - $this->assert()->stringEquals('foo', 'foo'); + $this->assert->stringEquals('foo', 'foo'); } #[Test] public function testSomethingElse() : void { - $this->assert()->stringEquals('bar', 'bar'); + $this->assert->stringEquals('bar', 'bar'); } /** @@ -22,7 +22,7 @@ public function testSomethingElse() : void { */ #[Test] public function testItAgain() : void { - $this->assert()->stringEquals('baz', 'baz'); + $this->assert->stringEquals('baz', 'baz'); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/MyTestSuite.php b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/MyTestSuite.php index 544260e..8828b4b 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/SecondTestCase.php b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/SecondTestCase.php index 20107e8..65d7386 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/SecondTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { #[Test] public function ensureIntEquals() : void { - $this->assert()->intEquals(1, 1); + $this->assert->intEquals(1, 1); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/ThirdTestCase.php b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/ThirdTestCase.php index be291c7..203f816 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/ThirdTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestSuiteHook/ThirdTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class ThirdTestCase extends TestCase { #[Test] public function testFoo() : void { - $this->assert()->isNull(null); + $this->assert->isNull(null); } #[Test] public function testBar() : void { - $this->assert()->isTrue(true); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/FirstTestCase.php b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/FirstTestCase.php index 315fb30..810ae9f 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/FirstTestCase.php @@ -2,24 +2,24 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function testSomething() : void { - $this->assert()->arrayEquals('foo', 'foo'); + $this->assert->arrayEquals('foo', 'foo'); } #[Test] public function testSomethingElse() : void { - $this->assert()->stringEquals('bar', 'bar'); + $this->assert->stringEquals('bar', 'bar'); } #[Test] public function testItAgain() : void { - $this->assert()->stringEquals('baz', 'baz'); + $this->assert->stringEquals('baz', 'baz'); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/MyTestSuite.php b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/MyTestSuite.php index a440eab..3deec50 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEachTest; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/SecondTestCase.php b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/SecondTestCase.php index 0fc72d9..b711033 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/SecondTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { #[Test] public function ensureIntEquals() : void { - $this->assert()->intEquals(1, 1); + $this->assert->intEquals(1, 1); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/ThirdTestCase.php b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/ThirdTestCase.php index b73c81a..e851834 100644 --- a/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/ThirdTestCase.php +++ b/acme_src/ExplicitTestSuite/BeforeEachTestTestSuiteHook/ThirdTestCase.php @@ -2,19 +2,19 @@ namespace Acme\DemoSuites\ExplicitTestSuite\BeforeEachTestTestSuiteHook; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class ThirdTestCase extends TestCase { #[Test] public function testFoo() : void { - $this->assert()->isNull(null); + $this->assert->isNull(null); } #[Test] public function testBar() : void { - $this->assert()->isTrue(true); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/FirstTestCase.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/FirstTestCase.php index 421303d..cd70967 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/FirstTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteAfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function ensureSomething() { - $this->assert()->isTrue(true); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/MyTestSuite.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/MyTestSuite.php index d93f06a..00095c5 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterAll/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteAfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; use RuntimeException; #[DefaultTestSuite] diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestCase.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestCase.php index 5d0b8ce..7c7515b 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestSuite.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestSuite.php index 1712950..9294702 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEach/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestCase.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestCase.php index dfaaba0..f20dfa0 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestSuite.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestSuite.php index 5b74e9e..bad02cb 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteAfterEachTest/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterEachTest; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/FirstTestCase.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/FirstTestCase.php index a0d8a55..f7e4ecb 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/FirstTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function ensureSomething() { - $this->assert()->isTrue(true); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/MyTestSuite.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/MyTestSuite.php index bf84ae1..77bc977 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeAll/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestCase.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestCase.php index c47e0f1..fddb8f1 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestSuite.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestSuite.php index b414387..334f51d 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEach/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestCase.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestCase.php index 80ee5a2..777f8a2 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestSuite.php b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestSuite.php index 0c7e877..053f116 100644 --- a/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/ExceptionThrowingTestSuiteBeforeEachTest/MyTestSuite.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEachTest; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestCase.php b/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestCase.php index 31ba1ff..14c377b 100644 --- a/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestCase.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseAfterAllHasTestSuiteState; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestCase extends TestCase { @@ -18,7 +18,7 @@ public static function setState(TestSuite $testSuite) { #[Test] public function checkState() { - $this->assert()->isNull(self::$state); + $this->assert->isNull(self::$state); } public function getState() : ?string { diff --git a/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestSuite.php index 2755400..7b16d50 100644 --- a/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestCaseAfterAllHasTestSuiteState/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseAfterAllHasTestSuiteState; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestCase.php b/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestCase.php index 9deff6d..70b8679 100644 --- a/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestCase.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseBeforeAllHasTestSuiteState; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestCase extends TestCase { @@ -18,7 +18,7 @@ public static function setState(TestSuite $testSuite) { #[Test] public function checkState() { - $this->assert()->stringEquals('AsyncUnit', self::$state); + $this->assert->stringEquals('AsyncUnit', self::$state); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestSuite.php index a9c899b..3a48863 100644 --- a/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestCaseBeforeAllHasTestSuiteState/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseBeforeAllHasTestSuiteState; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/FirstTestCase.php b/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/FirstTestCase.php index e2926ab..fc690d7 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/FirstTestCase.php @@ -4,14 +4,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function ensureSomething() { - $this->assert()->stringEquals('AsyncUnit', 'AsyncUnit'); + $this->assert->stringEquals('AsyncUnit', 'AsyncUnit'); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/MyTestSuite.php index 08ac05d..54f7b1a 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/MyTestSuite.php @@ -2,6 +2,6 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite {} \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/SecondTestCase.php b/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/SecondTestCase.php index 1a1baf0..7ca63cd 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinedAndImplicitDefaultTestSuite/SecondTestCase.php @@ -4,16 +4,16 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(MyTestSuite::class)] class SecondTestCase extends TestCase { #[Test] public function ensureSomething() { - $this->assert()->isFalse(false); + $this->assert->isFalse(false); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/FirstTestCase.php b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/FirstTestCase.php index 65564eb..c305f34 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/FirstTestCase.php @@ -2,15 +2,15 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinesTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite as TestSuiteAttribute; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite as TestSuiteAttribute; +use Labrador\AsyncUnit\Framework\TestCase; #[TestSuiteAttribute(MyFirstTestSuite::class)] class FirstTestCase extends TestCase { #[Test] public function ensureIntEquals() { - $this->assert()->intEquals(42, 42); + $this->assert->intEquals(42, 42); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MyFirstTestSuite.php b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MyFirstTestSuite.php index edbaafb..1701b26 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MyFirstTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MyFirstTestSuite.php @@ -2,6 +2,6 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinesTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; class MyFirstTestSuite extends TestSuite {} \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MySecondTestSuite.php b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MySecondTestSuite.php index 16440dd..d45c25e 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MySecondTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/MySecondTestSuite.php @@ -2,6 +2,6 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinesTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; class MySecondTestSuite extends TestSuite {} \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/SecondTestCase.php b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/SecondTestCase.php index 4f2af29..db26ea5 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/SecondTestCase.php @@ -2,18 +2,18 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinesTestSuite; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite as TestSuiteAttribute; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite as TestSuiteAttribute; use Generator; #[TestSuiteAttribute(MySecondTestSuite::class)] class SecondTestCase extends TestCase { #[Test] - public function ensureSomethingIsNull() : Generator { - yield $this->asyncAssert()->isNull(new Success(null)); + public function ensureSomethingIsNull() : void { + $this->assert->isNull(null); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/ThirdTestCase.php b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/ThirdTestCase.php index daaedfa..fdcc0af 100644 --- a/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/ThirdTestCase.php +++ b/acme_src/ExplicitTestSuite/TestCaseDefinesTestSuite/ThirdTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestCaseDefinesTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite as TestSuiteAttribute; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite as TestSuiteAttribute; +use Labrador\AsyncUnit\Framework\TestCase; #[TestSuiteAttribute(MySecondTestSuite::class)] class ThirdTestCase extends TestCase { #[Test] public function ensureStringEquals() { - $this->assert()->stringEquals('AsyncUnit', 'AsyncUnit'); + $this->assert->stringEquals('AsyncUnit', 'AsyncUnit'); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasExplicitTestSuite/MyTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasExplicitTestSuite/MyTestCase.php index d17b44f..c69580e 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasExplicitTestSuite/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasExplicitTestSuite/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\HasExplicitTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testSomething() { - $this->assert()->isFalse(false); + $this->assert->isFalse(false); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasImplicitTestSuite/MyTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasImplicitTestSuite/MyTestCase.php index 726e058..9ee5829 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasImplicitTestSuite/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/HasImplicitTestSuite/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\HasImplicitTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testSomething() { - $this->assert()->isTrue(true); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestCase.php index 7d117b1..38dc05c 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testSomething() { - $this->assert()->stringEquals('AsyncUnit', 'AsyncUnit'); + $this->assert->stringEquals('AsyncUnit', 'AsyncUnit'); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestSuite.php index 32bc253..71031f3 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDefinesNamespaceToAttach/MyTestSuite.php @@ -2,7 +2,7 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabled/FirstTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDisabled/FirstTestCase.php index ad919d0..185dde9 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabled/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabled/FirstTestCase.php @@ -3,9 +3,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(MyTestSuite::class)] class FirstTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabled/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteDisabled/MyTestSuite.php index e0cd0dd..4a9ee5c 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabled/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabled/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabled; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\TestSuite; #[Disabled] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabled/SecondTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDisabled/SecondTestCase.php index fd266a3..ea1e2a5 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabled/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabled/SecondTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(MyTestSuite::class)] class SecondTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestCase.php index 770ff3e..139ec8e 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestCase.php @@ -4,9 +4,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabledCustomMessage; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(MyTestSuite::class)] class MyTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestSuite.php index b45ebfb..bef9643 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabledCustomMessage/MyTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabledCustomMessage; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\TestSuite; #[Disabled('The AttachToTestSuite is disabled')] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestCase.php index 4ec241f..51f3e66 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabledHookNotInvoked; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(MyTestSuite::class)] class MyTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestSuite.php index f856b2d..5d2fceb 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteDisabledHookNotInvoked/MyTestSuite.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteDisabledHookNotInvoked; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\AfterEachTest; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEachTest; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\TestSuite; #[Disabled] class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/FirstTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/FirstTestCase.php index b9334ae..46c1e3c 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/FirstTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteHasTimeout; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/MyTestSuite.php index 3755c45..a9129a8 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteHasTimeout; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Timeout; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Timeout; +use Labrador\AsyncUnit\Framework\TestSuite; #[Timeout(125)] #[DefaultTestSuite] diff --git a/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/SecondTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/SecondTestCase.php index ed0672e..617ec66 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/SecondTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteHasTimeout/SecondTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteHasTimeout; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { diff --git a/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestCase.php index 0fb8f14..86357c1 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteHookPriority; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(MyTestSuite::class)] class MyTestCase extends TestCase { #[Test] public function testSomething() { - $this->assert()->isTrue(true); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestSuite.php index 048d6f8..6eb567f 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteHookPriority/MyTestSuite.php @@ -2,13 +2,13 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteHookPriority; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEachTest; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEachTest; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\AfterEachTest; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEachTest; +use Labrador\AsyncUnit\Framework\TestSuite; class MyTestSuite extends TestSuite { diff --git a/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/FirstTestCase.php b/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/FirstTestCase.php index 23edc4f..e85211a 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/FirstTestCase.php +++ b/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/FirstTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteStateBeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function checkTestSuiteData() { - $this->assert()->stringEquals('bar', $this->testSuite()->get('foo')); + $this->assert->stringEquals('bar', $this->testSuite->get('foo')); } } \ No newline at end of file diff --git a/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/MyTestSuite.php b/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/MyTestSuite.php index 8a10ccc..9fea270 100644 --- a/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/MyTestSuite.php +++ b/acme_src/ExplicitTestSuite/TestSuiteStateBeforeAll/MyTestSuite.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ExplicitTestSuite\TestSuiteStateBeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\DefaultTestSuite; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\DefaultTestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; #[DefaultTestSuite] class MyTestSuite extends TestSuite { diff --git a/acme_src/ImplicitDefaultTestSuite/CustomAssertions/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/CustomAssertions/MyTestCase.php index 6e556d2..02aa4c8 100644 --- a/acme_src/ImplicitDefaultTestSuite/CustomAssertions/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/CustomAssertions/MyTestCase.php @@ -2,16 +2,15 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\CustomAssertions; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function ensureCustomAssertionsPass() { - $this->assert()->theCustomAssertion('foo', 'bar'); - yield $this->asyncAssert()->theCustomAssertion('foo', new Success('bar')); + $this->assert->theCustomAssertion('foo', 'bar'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterAll/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterAll/MyTestCase.php index 6efa388..e21faf6 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterAll/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterAll/MyTestCase.php @@ -4,9 +4,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExceptionThrowingAfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterEach/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterEach/MyTestCase.php index db7dbaa..3be316a 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterEach/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingAfterEach/MyTestCase.php @@ -4,9 +4,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExceptionThrowingAfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeAll/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeAll/MyTestCase.php index 8cddd79..60ac922 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeAll/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeAll/MyTestCase.php @@ -4,9 +4,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExceptionThrowingBeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeEach/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeEach/MyTestCase.php index 41f5060..56b4b5d 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeEach/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingBeforeEach/MyTestCase.php @@ -4,9 +4,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExceptionThrowingBeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTest/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTest/MyTestCase.php index 9dce471..23a14d4 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTest/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTest/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExceptionThrowingTest; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTestWithAfterEachHook/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTestWithAfterEachHook/MyTestCase.php index c5d9b71..7678fa8 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTestWithAfterEachHook/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExceptionThrowingTestWithAfterEachHook/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExceptionThrowingTestWithAfterEachHook; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractFourthTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractFourthTestCase.php index 05a6b9b..596c105 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractFourthTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractFourthTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExtendedTestCases; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\Test; abstract class AbstractFourthTestCase extends ThirdTestCase { #[Test] public function fourthEnsureSomething() { - $this->assert()->isNull(null); - $this->assert()->isFalse(false); - $this->assert()->isTrue(true); - $this->assert()->stringEquals('AsyncUnit', 'AsyncUnit'); + $this->assert->isNull(null); + $this->assert->isFalse(false); + $this->assert->isTrue(true); + $this->assert->stringEquals('AsyncUnit', 'AsyncUnit'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractSecondTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractSecondTestCase.php index db0a3e1..c51fc92 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractSecondTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/AbstractSecondTestCase.php @@ -4,15 +4,15 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExtendedTestCases; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Test; abstract class AbstractSecondTestCase extends FirstTestCase { #[Test] public function secondEnsureSomething() { - $this->assert()->intEquals(42, 42); - yield $this->asyncAssert()->isFalse(new Success(false)); + $this->assert->intEquals(42, 42); + $this->assert->isFalse(false); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FifthTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FifthTestCase.php index 2a6c54e..6dcc70b 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FifthTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FifthTestCase.php @@ -2,17 +2,17 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExtendedTestCases; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\Test; class FifthTestCase extends AbstractFourthTestCase { #[Test] public function fifthEnsureSomething() { - $this->assert()->isFalse(false); - $this->assert()->not()->stringEquals('AsyncUnit', 'PHPUnit'); - $this->assert()->intEquals(1, 1); - $this->assert()->floatEquals(3.14, 3.14); - $this->assert()->isTrue(false); + $this->assert->isFalse(false); + $this->assert->not()->stringEquals('AsyncUnit', 'PHPUnit'); + $this->assert->intEquals(1, 1); + $this->assert->floatEquals(3.14, 3.14); + $this->assert->isTrue(false); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FirstTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FirstTestCase.php index 670d0d2..8f47105 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FirstTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/FirstTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExtendedTestCases; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { #[Test] public function firstEnsureSomething() { - $this->assert()->stringEquals('foo', 'foo'); + $this->assert->stringEquals('foo', 'foo'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/ThirdTestCase.php b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/ThirdTestCase.php index b55e188..0a37b7f 100644 --- a/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/ThirdTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/ExtendedTestCases/ThirdTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\ExtendedTestCases; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Test; class ThirdTestCase extends AbstractSecondTestCase { #[Test] public function thirdEnsureSomething() { - yield $this->asyncAssert()->arrayEquals([1,2,3], new Success([1,2,3])); - $this->assert()->stringEquals('bar', 'bar'); - $this->assert()->isNull(null); + $this->assert->arrayEquals([1,2,3], [1,2,3]); + $this->assert->stringEquals('bar', 'bar'); + $this->assert->isNull(null); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/FailedAssertion/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/FailedAssertion/MyTestCase.php index 44bd0f5..3907200 100644 --- a/acme_src/ImplicitDefaultTestSuite/FailedAssertion/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/FailedAssertion/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\FailedAssertion; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function alwaysFails() { - $this->assert()->stringEquals('foo', 'bar'); + $this->assert->stringEquals('foo', 'bar'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/FailedNotAssertion/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/FailedNotAssertion/MyTestCase.php index 0fa65fc..0c7d5d4 100644 --- a/acme_src/ImplicitDefaultTestSuite/FailedNotAssertion/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/FailedNotAssertion/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\FailedNotAssertion; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function checkFailedNotAssertion() { - $this->assert()->not()->stringEquals('foo', 'foo'); + $this->assert->not()->stringEquals('foo', 'foo'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/HandleNonPhpFiles/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HandleNonPhpFiles/MyTestCase.php index bcc7a53..9aeb0e5 100644 --- a/acme_src/ImplicitDefaultTestSuite/HandleNonPhpFiles/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HandleNonPhpFiles/MyTestCase.php @@ -2,15 +2,15 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HandleNonPhpFiles; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function checkAsyncNull() { - yield $this->asyncAssert()->isNull(new Success(null)); + $this->asyncAssert()->isNull(Future::complete()); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/HasAssertionPlugin/MyCustomAssertionPlugin.php b/acme_src/ImplicitDefaultTestSuite/HasAssertionPlugin/MyCustomAssertionPlugin.php deleted file mode 100644 index 2717e75..0000000 --- a/acme_src/ImplicitDefaultTestSuite/HasAssertionPlugin/MyCustomAssertionPlugin.php +++ /dev/null @@ -1,17 +0,0 @@ -registerAssertion('myOtherCustomAssertion', function() { - return new AssertIsTrue(true); - }); - return new Success(); - } - - public function __toString() { - return ''; - } - - public function count() { - return 0; - } -} \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/HasAssertionPlugin/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasAssertionPlugin/MyTestCase.php deleted file mode 100644 index 388425d..0000000 --- a/acme_src/ImplicitDefaultTestSuite/HasAssertionPlugin/MyTestCase.php +++ /dev/null @@ -1,15 +0,0 @@ -assert()->myOtherCustomAssertion(); - } - -} \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/HasDataProvider/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasDataProvider/MyTestCase.php index 5b3a067..ab0868f 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasDataProvider/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasDataProvider/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasDataProvider; -use Cspray\Labrador\AsyncUnit\Attribute\DataProvider; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\DataProvider; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { @@ -22,7 +22,7 @@ public function myDataProvider() : array { #[DataProvider('myDataProvider')] public function ensureStringsEqual(string $expected, string $actual) : void { $this->counter++; - $this->assert()->stringEquals($expected, $actual); + $this->assert->stringEquals($expected, $actual); } public function getCounter() : int { diff --git a/acme_src/ImplicitDefaultTestSuite/HasNotTestCaseObject/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasNotTestCaseObject/MyTestCase.php index 16d54f8..b20859d 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasNotTestCaseObject/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasNotTestCaseObject/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasNotTestCaseObject; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyResultPrinterPlugin.php b/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyResultPrinterPlugin.php index 92fed14..3465204 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyResultPrinterPlugin.php +++ b/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyResultPrinterPlugin.php @@ -2,19 +2,29 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasResultPrinterPlugin; -use Amp\ByteStream\OutputStream; -use Cspray\Labrador\AsyncEvent\EventEmitter; -use Cspray\Labrador\AsyncUnit\ResultPrinterPlugin; -use Cspray\Labrador\AsyncUnit\Event\TestProcessedEvent; -use Cspray\Labrador\AsyncUnit\Events; +use Amp\ByteStream\WritableStream; +use Amp\Future; +use Labrador\AsyncEvent\Emitter; +use Labrador\AsyncEvent\Event; +use Labrador\AsyncEvent\Listener; +use Labrador\AsyncUnit\Framework\Event\Events; +use Labrador\AsyncUnit\Framework\Plugin\ResultPrinterPlugin; +use Labrador\CompositeFuture\CompositeFuture; class MyResultPrinterPlugin implements ResultPrinterPlugin { - public function registerEvents(EventEmitter $emitter, OutputStream $output) : void { - $emitter->on(Events::TEST_PROCESSED, function(TestProcessedEvent $event) use($output) { - yield $output->write($event->getTarget()->getTestCase()::class . "\n"); - yield $output->write($event->getTarget()->getTestMethod() . "\n"); - }); + public function registerEvents(Emitter $emitter, WritableStream $output) : void { + $listener = new class($output) implements Listener { + public function __construct( + private readonly WritableStream $output + ) {} + + public function handle(Event $event) : Future|CompositeFuture|null { + $this->output->write($event->payload()->getTestCase()::class . "\n"); + $this->output->write($event->payload()->getTestMethod() . "\n"); + } + }; + $emitter->register(Events::TEST_PROCESSED, $listener); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyTestCase.php index a796f13..70dc81f 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasResultPrinterPlugin/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasResultPrinterPlugin; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function checkSomething() { - $this->assert()->stringEquals('foo', 'foo'); + $this->assert->stringEquals('foo', 'foo'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/HasSingleAfterAllHook/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasSingleAfterAllHook/MyTestCase.php index 551f227..ab3d13f 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasSingleAfterAllHook/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasSingleAfterAllHook/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasSingleAfterAllHook; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/HasSingleAfterEachHook/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasSingleAfterEachHook/MyTestCase.php index ae8b7ee..efadb3a 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasSingleAfterEachHook/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasSingleAfterEachHook/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasSingleAfterEachHook; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeAllHook/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeAllHook/MyTestCase.php index 4de93ba..58b4095 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeAllHook/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeAllHook/MyTestCase.php @@ -2,10 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasSingleBeforeAllHook; -use Amp\Delayed; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; use Generator; class MyTestCase extends TestCase { @@ -18,8 +17,7 @@ public function getName() : string { } #[BeforeAll] - public static function beforeAll() : Generator { - yield new Delayed(100); + public static function beforeAll() : void { self::$staticData[] = 'beforeAll'; } diff --git a/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeEachHook/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeEachHook/MyTestCase.php index e287454..7f92315 100644 --- a/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeEachHook/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/HasSingleBeforeEachHook/MyTestCase.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\HasSingleBeforeEachHook; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestCase.php index 1782ccb..3176330 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestCase.php @@ -2,23 +2,24 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink; +use Amp\Future; use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(FirstTestSuite::class)] class FirstTestCase extends TestCase { #[Test] public function testOne() { - $this->assert()->countEquals(3, [1, 2, 3]); + $this->assert->countEquals(3, [1, 2, 3]); } #[Test] public function testTwo() { - yield $this->asyncAssert()->countEquals(4, new Success(['a', 'b', 'c', 'd'])); + $this->assert->countEquals(4, ['a', 'b', 'c', 'd']); } #[Test] diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestSuite.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestSuite.php index 7e175a3..599133c 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestSuite.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/FirstTestSuite.php @@ -2,7 +2,7 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\TestSuite; class FirstTestSuite extends TestSuite { diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/BadTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/BadTestCase.php index 7b0398d..c66308c 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/BadTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/BadTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class BadTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/FoodAndBeverageTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/FoodAndBeverageTestCase.php index a7aa405..a60faf7 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/FoodAndBeverageTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondBreakfast/FoodAndBeverageTestCase.php @@ -2,10 +2,11 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast; +use Amp\Future; use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\DataProvider; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\DataProvider; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FoodAndBeverageTestCase extends TestCase { @@ -21,7 +22,7 @@ public function foodProvider() { #[Test] #[DataProvider('foodProvider')] public function checkFood(string $a, string $b) { - yield $this->asyncAssert()->stringEquals($a, new Success($b)); + $this->assert->stringEquals($a, $b); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondTestCase.php index a241e63..06e635a 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/SecondTestCase.php @@ -3,18 +3,19 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink; use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Assertion\AssertionContext; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(FirstTestSuite::class)] class SecondTestCase extends TestCase { #[Test] public function checkTwo() { - $this->assert()->instanceOf(TestCase::class, $this); - yield $this->asyncAssert()->instanceOf(TestCase::class, new Success($this)); + $this->assert->instanceOf(TestCase::class, $this); + $this->assert->instanceOf(AssertionContext::class, $this->assert); } #[Test] diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/BilboTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/BilboTestCase.php index c11df89..f0b9d0f 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/BilboTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/BilboTestCase.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink\WhatAbout; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(PotatoTestSuite::class)] class BilboTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/FrodoTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/FrodoTestCase.php index 8eba58b..dc796f9 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/FrodoTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/FrodoTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink\WhatAbout; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(PotatoTestSuite::class)] class FrodoTestCase extends TestCase { #[Test] public function isBestHobbit() { - $this->assert()->stringEquals('Frodo', $this->testSuite()->get('bestHobbit')); + $this->assert->stringEquals('Frodo', $this->testSuite->get('bestHobbit')); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/PotatoTestSuite.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/PotatoTestSuite.php index 4d2cac0..6f9e7b8 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/PotatoTestSuite.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/PotatoTestSuite.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink\WhatAbout; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\TestSuite; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\TestSuite; class PotatoTestSuite extends TestSuite { diff --git a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/SamwiseTestCase.php b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/SamwiseTestCase.php index 96a40d6..195fc18 100644 --- a/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/SamwiseTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/KitchenSink/WhatAbout/SamwiseTestCase.php @@ -3,16 +3,16 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\KitchenSink\WhatAbout; -use Cspray\Labrador\AsyncUnit\Attribute\AttachToTestSuite; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AttachToTestSuite; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[AttachToTestSuite(PotatoTestSuite::class)] class SamwiseTestCase extends TestCase { #[Test] public function isBestHobbit() { - $this->assert()->stringEquals('Samwise', $this->testSuite()->get('bestHobbit')); + $this->assert->stringEquals('Samwise', $this->testSuite->get('bestHobbit')); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/MockeryTestNoAssertion/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/MockeryTestNoAssertion/MyTestCase.php index 2ae99d0..a78dcd8 100644 --- a/acme_src/ImplicitDefaultTestSuite/MockeryTestNoAssertion/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MockeryTestNoAssertion/MyTestCase.php @@ -2,23 +2,21 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MockeryTestNoAssertion; -use Amp\Success; -use Cspray\Labrador\Application; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; -use Generator; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Configuration\Configuration; +use Labrador\AsyncUnit\Framework\TestCase; use Mockery\MockInterface; class MyTestCase extends TestCase { #[Test] - public function checkMockExpectations() : Generator { + public function checkMockExpectations() : void { /** @var MockInterface $mock */ - $mock = $this->mocks()->createMock(Application::class); + $mock = $this->mocks()->createMock(Configuration::class); - $mock->expects()->start()->andReturn(new Success()); + $mock->expects()->getTestDirectories()->andReturn([]); - yield $mock->start(); + $mock->getTestDirectories(); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/FirstTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/FirstTestCase.php index 4285080..26c483c 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/FirstTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/FirstTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleBeforeAllHooks; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FirstTestCase extends TestCase { @@ -17,7 +17,7 @@ public static function setState() : void { #[Test] public function checkState() { - $this->assert()->stringEquals(self::class, self::$state); + $this->assert->stringEquals(self::class, self::$state); } public function getState() : string { diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/SecondTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/SecondTestCase.php index f069ab1..47109cf 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/SecondTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleBeforeAllHooks/SecondTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleBeforeAllHooks; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class SecondTestCase extends TestCase { @@ -17,7 +17,7 @@ public static function setStateAgain() : void { #[Test] public function checkState() { - $this->assert()->stringEquals(self::class, self::$state); + $this->assert->stringEquals(self::class, self::$state); } public function getState() : string { diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTest/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTest/MyTestCase.php index 7ea5610..4d52e24 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTest/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTest/MyTestCase.php @@ -3,9 +3,11 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleTest; use Amp\Delayed; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use function Amp\async; use function Amp\call; +use function Amp\delay; class MyTestCase extends TestCase { @@ -13,22 +15,22 @@ class MyTestCase extends TestCase { #[Test] public function ensureSomethingHappens() { - yield new Delayed(100); + delay(0.100); $this->invoked[] = __METHOD__; - $this->assert()->stringEquals('foo', 'foo'); + $this->assert->stringEquals('foo', 'foo'); } #[Test] public function ensureSomethingHappensTwice() { $this->invoked[] = __METHOD__; - $this->assert()->not()->stringEquals('AsyncUnit', 'PHPUnit'); + $this->assert->not()->stringEquals('AsyncUnit', 'PHPUnit'); } #[Test] public function ensureSomethingHappensThreeTimes() { - return call(function() { + return async(function() { $this->invoked[] = self::class . '::ensureSomethingHappensThreeTimes'; - $this->assert()->intEquals(42, 42); + $this->assert->intEquals(42, 42); }); } diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BarTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BarTestCase.php index b06c744..c1d40f9 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BarTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BarTestCase.php @@ -5,8 +5,8 @@ use Amp\Delayed; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class BarTestCase extends TestCase { @@ -14,7 +14,6 @@ class BarTestCase extends TestCase { #[Test] public function ensureSomething() { - yield new Delayed(100); $this->testInvoked = true; } diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BazTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BazTestCase.php index 66d8d7e..0c4331c 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BazTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/BazTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleTestCase; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class BazTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/FooTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/FooTestCase.php index e64c684..f5d3e6f 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/FooTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTestCase/FooTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleTestCase; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; use function Amp\call; class FooTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/FirstTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/FirstTestCase.php index 49339e6..df504f1 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/FirstTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/FirstTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleTestsKnownDuration; -use Amp\Delayed; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use function Amp\delay; class FirstTestCase extends TestCase { #[Test] public function checkOne() { - yield new Delayed(100); - $this->assert()->arrayEquals([1, 2, 3], [1, 2, 3]); + delay(0.1); + $this->assert->arrayEquals([1, 2, 3], [1, 2, 3]); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/SecondTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/SecondTestCase.php index c6345bb..93a2741 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/SecondTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/SecondTestCase.php @@ -5,22 +5,24 @@ use Amp\Delayed; +use Amp\Future; use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use function Amp\delay; class SecondTestCase extends TestCase { #[Test] public function checkOne() { - yield new Delayed(100); - yield $this->asyncAssert()->isEmpty(new Success([])); + delay(0.1); + $this->asyncAssert()->isEmpty(Future::complete([])); } #[Test] public function checkTwo() { - yield new Delayed(100); - $this->assert()->isTrue(true); + delay(0.1); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/ThirdTestCase.php b/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/ThirdTestCase.php index 49ebb73..83f1fe6 100644 --- a/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/ThirdTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/MultipleTestsKnownDuration/ThirdTestCase.php @@ -3,28 +3,30 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\MultipleTestsKnownDuration; use Amp\Delayed; +use Amp\Future; use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; +use function Amp\delay; class ThirdTestCase extends TestCase { #[Test] public function checkOne() { - yield new Delayed(100); - $this->assert()->floatEquals(3.14, 3.14); + delay(0.1); + $this->assert->floatEquals(3.14, 3.14); } #[Test] public function checkTwo() { - yield new Delayed(100); - yield $this->asyncAssert()->stringEquals('AsyncUnit', new Success('AsyncUnit')); + delay(0.1); + $this->asyncAssert()->stringEquals('AsyncUnit', Future::complete('AsyncUnit')); } #[Test] public function checkThree() { - yield new Delayed(100); - $this->assert()->countEquals(2, ['a', 0]); + delay(0.1); + $this->assert->countEquals(2, ['a', 0]); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/NoAssertions/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/NoAssertions/MyTestCase.php index 8ed694b..9776062 100644 --- a/acme_src/ImplicitDefaultTestSuite/NoAssertions/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/NoAssertions/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\NoAssertions; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/TestOne.php b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/TestOne.php index c308dad..9e4edd5 100644 --- a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/TestOne.php +++ b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/TestOne.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\RecursiveTestLayout; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class TestOne extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/TestTwo.php b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/TestTwo.php index 2d66755..4ff6eb1 100644 --- a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/TestTwo.php +++ b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/TestTwo.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\RecursiveTestLayout\Two; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class TestTwo extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/Five/TestFive.php b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/Five/TestFive.php index a8ea157..6db5e35 100644 --- a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/Five/TestFive.php +++ b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/Five/TestFive.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\RecursiveTestLayout\Two\Three\Four\Five; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class TestFive extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/TestFour.php b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/TestFour.php index 6d34c57..2cf50d3 100644 --- a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/TestFour.php +++ b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/Four/TestFour.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\RecursiveTestLayout\Two\Three\Four; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class TestFour extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/TestThree.php b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/TestThree.php index 7f5a9a5..d510d5b 100644 --- a/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/TestThree.php +++ b/acme_src/ImplicitDefaultTestSuite/RecursiveTestLayout/Two/Three/TestThree.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\RecursiveTestLayout\Two\Three; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class TestThree extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/SingleMockTest/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/SingleMockTest/MyTestCase.php index 9028d67..e6eaca8 100644 --- a/acme_src/ImplicitDefaultTestSuite/SingleMockTest/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/SingleMockTest/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\SingleMockTest; -use Cspray\Labrador\Application; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Configuration\Configuration; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { @@ -12,8 +12,8 @@ class MyTestCase extends TestCase { #[Test] public function checkCreatingMockObject() { - $this->createdMock = $this->mocks()->createMock(Application::class); - $this->assert()->not()->isNull($this->createdMock); + $this->createdMock = $this->mocks()->createMock(Configuration::class); + $this->assert->not()->isNull($this->createdMock); } public function getCreatedMock() : ?object { diff --git a/acme_src/ImplicitDefaultTestSuite/SingleTest/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/SingleTest/MyTestCase.php index adb15df..fe2b8fe 100644 --- a/acme_src/ImplicitDefaultTestSuite/SingleTest/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/SingleTest/MyTestCase.php @@ -3,20 +3,20 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\SingleTest; -use Amp\Delayed; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; use Generator; +use function Amp\delay; class MyTestCase extends TestCase { private bool $testInvoked = false; #[Test] - public function ensureSomethingHappens() : Generator { - yield new Delayed(10); + public function ensureSomethingHappens() : void { + delay(0.5); $this->testInvoked = true; - $this->assert()->stringEquals('foo', 'foo'); + $this->assert->stringEquals('foo', 'foo'); } public function getTestInvoked() : bool { diff --git a/acme_src/ImplicitDefaultTestSuite/SingleTestAsyncAssertion/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/SingleTestAsyncAssertion/MyTestCase.php deleted file mode 100644 index fd5abf1..0000000 --- a/acme_src/ImplicitDefaultTestSuite/SingleTestAsyncAssertion/MyTestCase.php +++ /dev/null @@ -1,16 +0,0 @@ -asyncAssert()->stringEquals('foo', new Success('foo')); - } - -} \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/SingleTestDisabled/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/SingleTestDisabled/MyTestCase.php index ed49af8..d2e7a2a 100644 --- a/acme_src/ImplicitDefaultTestSuite/SingleTestDisabled/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/SingleTestDisabled/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\SingleTestDisabled; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestCaseDisabled/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestCaseDisabled/MyTestCase.php index 2d1ca7b..71d8c9c 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestCaseDisabled/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestCaseDisabled/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestCaseDisabled; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[Disabled] class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledCustomMessage/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledCustomMessage/MyTestCase.php index d676848..c8d7a7b 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledCustomMessage/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledCustomMessage/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestCaseDisabledCustomMessage; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[Disabled('The TestCase is disabled')] class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledHookNotInvoked/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledHookNotInvoked/MyTestCase.php index 808ce68..c9d62c0 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledHookNotInvoked/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestCaseDisabledHookNotInvoked/MyTestCase.php @@ -2,13 +2,13 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestCaseDisabledHookNotInvoked; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; #[Disabled] class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestCaseHasTimeout/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestCaseHasTimeout/MyTestCase.php index a92d012..26773d7 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestCaseHasTimeout/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestCaseHasTimeout/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestCaseHasTimeout; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\Timeout; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\Timeout; +use Labrador\AsyncUnit\Framework\TestCase; #[Timeout(150)] class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestCaseHooksPriority/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestCaseHooksPriority/MyTestCase.php index bb4c239..9e2d690 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestCaseHooksPriority/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestCaseHooksPriority/MyTestCase.php @@ -2,12 +2,12 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestCaseHooksPriority; -use Cspray\Labrador\AsyncUnit\Attribute\AfterAll; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeAll; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterAll; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\BeforeAll; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { @@ -47,7 +47,7 @@ public function beforeEachThree() { #[Test] public function testSomething() { - $this->assert()->stringEquals('AsyncUnit', 'AsyncUnit'); + $this->assert->stringEquals('AsyncUnit', 'AsyncUnit'); } #[AfterEach(1)] diff --git a/acme_src/ImplicitDefaultTestSuite/TestDisabled/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestDisabled/MyTestCase.php index 0d8a440..67b77a8 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestDisabled/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestDisabled/MyTestCase.php @@ -2,15 +2,15 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestDisabled; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function checkSomething() { - $this->assert()->stringEquals('AsyncUnit', 'AsyncUnit'); + $this->assert->stringEquals('AsyncUnit', 'AsyncUnit'); } #[Test] diff --git a/acme_src/ImplicitDefaultTestSuite/TestDisabledCustomMessage/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestDisabledCustomMessage/MyTestCase.php index fd6abe3..8c21b69 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestDisabledCustomMessage/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestDisabledCustomMessage/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestDisabledCustomMessage; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestDisabledEvents/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestDisabledEvents/MyTestCase.php index ffbbd45..f0e1f70 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestDisabledEvents/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestDisabledEvents/MyTestCase.php @@ -2,21 +2,21 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestDisabledEvents; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testFailingFloatEquals() { - yield $this->asyncAssert()->not()->floatEquals(3.14, new Success(3.14)); + $this->assert->not()->floatEquals(3.14, 3.14); } #[Test] public function testIsTrue() { - yield $this->asyncAssert()->isTrue(new Success(true)); + $this->assert->isTrue(true); } #[Test] diff --git a/acme_src/ImplicitDefaultTestSuite/TestDisabledHookNotInvoked/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestDisabledHookNotInvoked/MyTestCase.php index ea1a673..aaf7ecb 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestDisabledHookNotInvoked/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestDisabledHookNotInvoked/MyTestCase.php @@ -2,12 +2,13 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestDisabledHookNotInvoked; +use Amp\Future; use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\AfterEach; -use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach; -use Cspray\Labrador\AsyncUnit\Attribute\Disabled; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\AfterEach; +use Labrador\AsyncUnit\Framework\Attribute\BeforeEach; +use Labrador\AsyncUnit\Framework\Attribute\Disabled; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { @@ -21,7 +22,7 @@ public function before() { #[Test] public function enabledTest() { $this->state[] = 'enabled'; - yield $this->asyncAssert()->arrayEquals(['before', 'enabled'], new Success($this->state)); + $this->assert->arrayEquals(['before', 'enabled'], $this->state); } #[Test] diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionDoesNotThrow/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionDoesNotThrow/MyTestCase.php index 5b5f334..e60cbc1 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionDoesNotThrow/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionDoesNotThrow/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsExceptionDoesNotThrow; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Exception\InvalidArgumentException; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Exception\InvalidArgumentException; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { @@ -12,7 +12,7 @@ class MyTestCase extends TestCase { public function checkDoesNotThrow() { $this->expect()->exception(InvalidArgumentException::class); - $this->assert()->isEmpty([]); + $this->assert->isEmpty([]); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionMessage/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionMessage/MyTestCase.php index d2a8da6..587bace 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionMessage/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionMessage/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsExceptionMessage; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Exception\InvalidArgumentException; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Exception\InvalidArgumentException; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionOnly/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionOnly/MyTestCase.php index 22cd68b..c7009f2 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionOnly/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionOnly/MyTestCase.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsExceptionOnly; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Exception\Exception; -use Cspray\Labrador\AsyncUnit\Exception\InvalidArgumentException; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Exception\Exception; +use Labrador\AsyncUnit\Framework\Exception\InvalidArgumentException; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongMessage/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongMessage/MyTestCase.php index 4d6ef45..af8f6cb 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongMessage/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongMessage/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsExceptionWrongMessage; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Exception\InvalidArgumentException; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Exception\InvalidArgumentException; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongType/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongType/MyTestCase.php index 361a712..aaa183b 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongType/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsExceptionWrongType/MyTestCase.php @@ -2,10 +2,10 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsExceptionWrongType; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Exception\InvalidArgumentException; -use Cspray\Labrador\AsyncUnit\Exception\InvalidStateException; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Exception\InvalidArgumentException; +use Labrador\AsyncUnit\Framework\Exception\InvalidStateException; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertions/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertions/MyTestCase.php index 1ce077a..fff7707 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertions/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertions/MyTestCase.php @@ -2,8 +2,8 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsNoAssertions; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertionsAssertMade/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertionsAssertMade/MyTestCase.php index f7b49b9..c220a86 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertionsAssertMade/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAssertionsAssertMade/MyTestCase.php @@ -2,16 +2,16 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestExpectsNoAssertionsAssertMade; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testNoAssertionAssertionMade() : void { $this->expect()->noAssertions(); - $this->assert()->isNull(null); - $this->assert()->isTrue(true); + $this->assert->isNull(null); + $this->assert->isTrue(true); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAsyncAssertionsAssertMade/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAsyncAssertionsAssertMade/MyTestCase.php deleted file mode 100644 index fd806d4..0000000 --- a/acme_src/ImplicitDefaultTestSuite/TestExpectsNoAsyncAssertionsAssertMade/MyTestCase.php +++ /dev/null @@ -1,19 +0,0 @@ -expect()->noAssertions(); - - yield $this->asyncAssert()->isNull(new Success(null)); - yield $this->asyncAssert()->isEmpty(new Success([])); - } - -} \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/TestFailedExceptionThrowingTest/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestFailedExceptionThrowingTest/MyTestCase.php index 16daaa2..2c6ef1e 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestFailedExceptionThrowingTest/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestFailedExceptionThrowingTest/MyTestCase.php @@ -2,9 +2,9 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestFailedExceptionThrowingTest; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Exception\TestFailedException; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Exception\TestFailedException; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { diff --git a/acme_src/ImplicitDefaultTestSuite/TestHasOutput/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestHasOutput/MyTestCase.php index 2005e93..5e6eed2 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestHasOutput/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestHasOutput/MyTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestHasOutput; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testProducesOutput() { - $this->assert()->stringEquals('something', 'something'); + $this->assert->stringEquals('something', 'something'); echo __FUNCTION__; } diff --git a/acme_src/ImplicitDefaultTestSuite/TestHasTimeout/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestHasTimeout/MyTestCase.php index 372810b..7badc57 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestHasTimeout/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestHasTimeout/MyTestCase.php @@ -2,19 +2,18 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestHasTimeout; -use Amp\Delayed; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\Attribute\Timeout; -use Cspray\Labrador\AsyncUnit\TestCase; -use Generator; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\Attribute\Timeout; +use Labrador\AsyncUnit\Framework\TestCase; +use function Amp\delay; class MyTestCase extends TestCase { #[Test] #[Timeout(100)] - public function timeOutTest() : Generator { - yield new Delayed(200); - $this->assert()->stringEquals('a', 'a'); + public function timeOutTest() : void { + delay(0.500); + $this->assert->stringEquals('a', 'a'); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/TestKnownRunTime/MyTestCase.php b/acme_src/ImplicitDefaultTestSuite/TestKnownRunTime/MyTestCase.php index 8e03315..d879232 100644 --- a/acme_src/ImplicitDefaultTestSuite/TestKnownRunTime/MyTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/TestKnownRunTime/MyTestCase.php @@ -2,17 +2,15 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\TestKnownRunTime; -use Amp\Delayed; -use Amp\Success; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Amp\Future; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class MyTestCase extends TestCase { #[Test] public function testTiming() { - yield new Delayed(500); - yield $this->asyncAssert()->floatEquals(3.14, new Success(3.14)); + $this->asyncAssert()->floatEquals(3.14, Future::complete(3.14)); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Bar/FooTestCase.php b/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Bar/FooTestCase.php index adde7a7..ce65f9e 100644 --- a/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Bar/FooTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Bar/FooTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\WithAsyncUnitConfig\tests\Bar; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class FooTestCase extends TestCase { #[Test] public function testIntEquals() { - $this->assert()->intEquals(1, 1); + $this->assert->intEquals(1, 1); } } \ No newline at end of file diff --git a/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Foo/BarTestCase.php b/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Foo/BarTestCase.php index fb43ab0..a1bfb34 100644 --- a/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Foo/BarTestCase.php +++ b/acme_src/ImplicitDefaultTestSuite/WithAsyncUnitConfig/tests/Foo/BarTestCase.php @@ -2,14 +2,14 @@ namespace Acme\DemoSuites\ImplicitDefaultTestSuite\WithAsyncUnitConfig\tests\Foo; -use Cspray\Labrador\AsyncUnit\Attribute\Test; -use Cspray\Labrador\AsyncUnit\TestCase; +use Labrador\AsyncUnit\Framework\Attribute\Test; +use Labrador\AsyncUnit\Framework\TestCase; class BarTestCase extends TestCase { #[Test] public function ensureStringEquals() { - $this->assert()->not()->stringEquals('foo', 'bar'); + $this->assert->not()->stringEquals('foo', 'bar'); } } \ No newline at end of file diff --git a/bin/asyncunit b/bin/asyncunit index 8d59861..5511c4c 100755 --- a/bin/asyncunit +++ b/bin/asyncunit @@ -8,19 +8,17 @@ $cwd = getcwd(); require_once $cwd . '/vendor/autoload.php'; use Cspray\Labrador\AsyncUnitCli\AsyncUnitConsoleApplication; -use Cspray\Labrador\EnvironmentType; -use Cspray\Labrador\StandardEnvironment; +use Labrador\AsyncEvent\AmpEventEmitter; use Psr\Log\NullLogger; use function Amp\ByteStream\getStdout; use function Amp\File\filesystem; -$environment = new StandardEnvironment(EnvironmentType::Development()); $logger = new NullLogger(); $configurationFactory = new JsonConfigurationFactory(); $application = new AsyncUnitConsoleApplication( - $environment, $logger, + new AmpEventEmitter(), filesystem(), $configurationFactory, getStdout(), diff --git a/cli_src/AsyncUnitConsoleApplication.php b/cli_src/AsyncUnitConsoleApplication.php index 121f133..b49fbdf 100644 --- a/cli_src/AsyncUnitConsoleApplication.php +++ b/cli_src/AsyncUnitConsoleApplication.php @@ -3,25 +3,26 @@ namespace Cspray\Labrador\AsyncUnitCli; use Amp\ByteStream\OutputStream; -use Amp\File\Driver as FileDriver; +use Amp\ByteStream\WritableStream; +use Amp\File\Filesystem; use Cspray\Labrador\AsyncUnit\AsyncUnitApplication; use Cspray\Labrador\AsyncUnit\AsyncUnitFrameworkRunner; -use Cspray\Labrador\AsyncUnit\ConfigurationFactory; -use Cspray\Labrador\AsyncUnit\MockBridgeFactory; +use Cspray\Labrador\AsyncUnit\Configuration\ConfigurationFactory; use Cspray\Labrador\AsyncUnitCli\Command\GenerateConfigurationCommand; use Cspray\Labrador\AsyncUnitCli\Command\RunTestsCommand; use Cspray\Labrador\Environment; +use Labrador\AsyncEvent\EventEmitter; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Application as ConsoleApplication; final class AsyncUnitConsoleApplication extends ConsoleApplication { public function __construct( - private Environment $environment, private LoggerInterface $logger, - private FileDriver $fileDriver, + private EventEmitter $emitter, + private Filesystem $fileDriver, private ConfigurationFactory $configurationFactory, - private OutputStream $testResultOutput, + private WritableStream $testResultOutput, private string $configPath ) { parent::__construct('AsyncUnit', AsyncUnitApplication::VERSION); @@ -30,8 +31,8 @@ public function __construct( private function registerCommands() { $frameworkRunner = new AsyncUnitFrameworkRunner( - $this->environment, $this->logger, + $this->emitter, $this->configurationFactory, $this->testResultOutput ); diff --git a/cli_src/Command/GenerateConfigurationCommand.php b/cli_src/Command/GenerateConfigurationCommand.php index b47f88f..aa49c4b 100644 --- a/cli_src/Command/GenerateConfigurationCommand.php +++ b/cli_src/Command/GenerateConfigurationCommand.php @@ -2,8 +2,7 @@ namespace Cspray\Labrador\AsyncUnitCli\Command; -use Amp\File\Driver as FileDriver; -use Amp\Loop; +use Amp\File\Filesystem; use Cspray\Labrador\AsyncUnitCli\TerminalResultPrinter; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -13,7 +12,7 @@ class GenerateConfigurationCommand extends AbstractCommand { public function __construct( - private FileDriver $fileDriver, + private Filesystem $fileDriver, private string $configPath ) { parent::__construct(); @@ -24,39 +23,35 @@ protected function configure() { } public function execute(InputInterface $input, OutputInterface $output) : int { - $message = ''; - Loop::run(function() use($input, $output, &$message) { - $filePath = $input->getOption('file') ?? $this->configPath; - if (yield $this->fileDriver->isfile($filePath)) { - $output->writeln(sprintf( - 'A configuration already exists at %s.', - $filePath - )); - $replace = $this->confirm( - $input, - $output, - 'Would you like to create a new configuration?' - ); - if (!$replace) { - $message = 'Ok! No configuration was created.'; - return; - } else { - $output->writeln(sprintf( - 'Previous configuration moved to %s.', - $filePath . '.bak' - )); - yield $this->fileDriver->rename($filePath, $filePath . '.bak'); - } + $filePath = $input->getOption('file') ?? $this->configPath; + if ($this->fileDriver->isFile($filePath)) { + $output->writeln(sprintf( + 'A configuration already exists at %s.', + $filePath + )); + $replace = $this->confirm( + $input, + $output, + 'Would you like to create a new configuration?' + ); + if (!$replace) { + $output->writeln('Ok! No configuration was created.'); + return Command::SUCCESS; } - $config = [ - 'testDirectories' => ['./tests'], - 'resultPrinter' => TerminalResultPrinter::class, - 'plugins' => [] - ]; - yield $this->fileDriver->put($filePath, json_encode($config, JSON_PRETTY_PRINT)); - $message = sprintf('Ok! Configuration created at %s.', $filePath); - }); - $output->writeln($message); + + $output->writeln(sprintf( + 'Previous configuration moved to %s.', + $filePath . '.bak' + )); + $this->fileDriver->move($filePath, $filePath . '.bak'); + } + $config = [ + 'testDirectories' => ['./tests'], + 'resultPrinter' => TerminalResultPrinter::class, + 'plugins' => [] + ]; + $this->fileDriver->write($filePath, json_encode($config, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT)); + $output->writeln(sprintf('Ok! Configuration created at %s.', $filePath)); return Command::SUCCESS; } diff --git a/cli_src/Command/RunTestsCommand.php b/cli_src/Command/RunTestsCommand.php index f2c0fcb..e997063 100644 --- a/cli_src/Command/RunTestsCommand.php +++ b/cli_src/Command/RunTestsCommand.php @@ -2,9 +2,9 @@ namespace Cspray\Labrador\AsyncUnitCli\Command; -use Amp\File\Driver as FileDriver; -use Amp\Loop; +use Amp\File\Filesystem; use Cspray\Labrador\AsyncUnit\AsyncUnitFrameworkRunner; +use Revolt\EventLoop; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; @@ -15,7 +15,7 @@ class RunTestsCommand extends AbstractCommand { public function __construct( - private FileDriver $fileDriver, + private Filesystem $fileDriver, private AsyncUnitFrameworkRunner $frameworkRunner, private string $defaultConfigFile ) { @@ -29,31 +29,29 @@ protected function configure() { public function execute(InputInterface $input, OutputInterface $output) : int { $runTests = true; $configPath = $input->getOption('config') ?? $this->defaultConfigFile; - Loop::run(function() use($input, $output, &$runTests, $configPath) { - if (!yield $this->fileDriver->isfile($configPath)) { - $style = new SymfonyStyle($input, $output); - $style->writeln($this->getNoDefaultConfigurationMessage()); - $style->newLine(); + if (!$this->fileDriver->isFile($configPath)) { + $style = new SymfonyStyle($input, $output); + $style->writeln($this->getNoDefaultConfigurationMessage()); + $style->newLine(); - $generateConfig = $this->confirm( - $input, - $output, - 'Would you like to run \'config:generate\' now?', - true - ); + $generateConfig = $this->confirm( + $input, + $output, + 'Would you like to run \'config:generate\' now?', + true + ); - if (!$generateConfig) { - $style->writeln('Ok! Exiting.'); - $runTests = false; - } else { - $generateConfigCommand = $this->getApplication()->find('config:generate'); - $args = new ArrayInput([ - '--file' => $configPath - ]); - $generateConfigCommand->run($args, $output); - } + if (!$generateConfig) { + $style->writeln('Ok! Exiting.'); + $runTests = false; + } else { + $generateConfigCommand = $this->getApplication()->find('config:generate'); + $args = new ArrayInput([ + '--file' => $configPath + ]); + $generateConfigCommand->run($args, $output); } - }); + } if ($runTests) { $this->frameworkRunner->run($configPath); diff --git a/cli_src/Exception/Exception.php b/cli_src/Exception/Exception.php deleted file mode 100644 index 5c6e6cb..0000000 --- a/cli_src/Exception/Exception.php +++ /dev/null @@ -1,9 +0,0 @@ -green(); - $failedOutput = $output->backgroundRed(); - $erroredOutput = $output->red(); - $disabledOutput = $output->yellow(); - $emitter->once(Events::PROCESSING_STARTED, fn() => $this->testProcessingStarted($output)); - $emitter->on(Events::TEST_PASSED, fn() => $this->testPassed($successOutput)); - $emitter->on(Events::TEST_FAILED, fn($event) => $this->testFailed($event, $failedOutput)); - $emitter->on(Events::TEST_DISABLED, fn($event) => $this->testDisabled($event, $disabledOutput)); - $emitter->on(Events::TEST_ERRORED, fn($event) => $this->testErrored($event, $erroredOutput)); - $emitter->once(Events::PROCESSING_FINISHED, fn($event) => $this->testProcessingFinished($event, $output)); - } - - private function testProcessingStarted(TerminalOutputStream $output) : Generator { - $inspirationalMessages = [ - 'Let\'s run some asynchronous tests!', - 'Zoom, zoom... here we go!', - 'One Loop to rule them all.', - 'Alright, waking the hamsters up!', - ]; - $inspirationalMessage = $inspirationalMessages[array_rand($inspirationalMessages)]; - yield $output->writeln(sprintf("AsyncUnit v%s - %s\n", AsyncUnitApplication::VERSION, $inspirationalMessage)); - yield $output->writeln(sprintf("Runtime: PHP %s\n", phpversion())); - } - - private function testPassed(TerminalOutputStream $output) : Generator { - yield $output->write('.'); - } - - private function testDisabled(TestDisabledEvent $disabledEvent, OutputStream $output) : Generator { - $this->disabledTests[] = $disabledEvent; - yield $output->write('D'); - } - - private function testFailed(TestFailedEvent $failedEvent, OutputStream $output) : Generator { - $this->failedTests[] = $failedEvent; - yield $output->write('X'); - } - - private function testErrored(TestErroredEvent $erroredEvent, OutputStream $output) : Generator { - $this->erroredTests[] = $erroredEvent; - yield $output->write('E'); - } - - private function testProcessingFinished(ProcessingFinishedEvent $event, TerminalOutputStream $output) : Generator { - yield $output->br(2); - yield $output->writeln((new ResourceUsageFormatter())->resourceUsage($event->getTarget()->getDuration())); - yield $output->br(); - if ($event->getTarget()->getErroredTestCount() > 0) { - yield $output->writeln(sprintf('There was %d error:', $event->getTarget()->getErroredTestCount())); - yield $output->br(); - foreach ($this->erroredTests as $index => $erroredTestEvent) { - yield $output->writeln(sprintf( - '%d) %s::%s', - $index + 1, - $erroredTestEvent->getTarget()->getTestCase()::class, - $erroredTestEvent->getTarget()->getTestMethod() - )); - yield $output->writeln($erroredTestEvent->getTarget()->getException()->getMessage()); - yield $output->br(); - yield $output->writeln($erroredTestEvent->getTarget()->getException()->getTraceAsString()); - } - yield $output->br(); - yield $output->writeln('ERRORS'); - yield $output->writeln(sprintf( - 'Tests: %d, Errors: %d, Assertions: %d, Async Assertions: %d', - $event->getTarget()->getTotalTestCount(), - $event->getTarget()->getErroredTestCount(), - $event->getTarget()->getAssertionCount(), - $event->getTarget()->getAsyncAssertionCount() - )); - } - - if ($event->getTarget()->getFailedTestCount() > 0) { - yield $output->writeln(sprintf("There was %d failure:\n", $event->getTarget()->getFailedTestCount())); - foreach ($this->failedTests as $index => $failedTestEvent) { - yield $output->writeln(sprintf( - "%d) %s::%s", - $index + 1, - $failedTestEvent->getTarget()->getTestCase()::class, - $failedTestEvent->getTarget()->getTestMethod() - )); - $exception = $failedTestEvent->getTarget()->getException(); - if ($exception instanceof AssertionFailedException) { - yield $output->writeln($exception->getDetailedMessage()); - yield $output->br(); - yield $output->writeln(sprintf( - "%s:%d", - $exception->getAssertionFailureFile(), - $exception->getAssertionFailureLine() - )); - yield $output->br(); - } else if ($exception instanceof TestFailedException) { - yield $output->br(); - yield $output->writeln("Test failure message:"); - yield $output->br(); - yield $output->writeln($exception->getMessage()); - yield $output->br(); - yield $output->writeln($exception->getTraceAsString()); - yield $output->br(); - } else { - yield $output->writeln(sprintf( - "An unexpected %s was thrown in %s on line %d.", - $exception::class, - $exception->getFile(), - $exception->getLine() - )); - yield $output->br(); - yield $output->writeln(sprintf("\"%s\"", $exception->getMessage())); - yield $output->br(); - yield $output->writeln($exception->getTraceAsString()); - yield $output->br(); - } - } - - yield $output->write("FAILURES\n"); - yield $output->write(sprintf( - "Tests: %d, Failures: %d, Assertions: %d, Async Assertions: %d\n", - $event->getTarget()->getTotalTestCount(), - $event->getTarget()->getFailedTestCount(), - $event->getTarget()->getAssertionCount(), - $event->getTarget()->getAsyncAssertionCount() - )); - } - - if ($event->getTarget()->getDisabledTestCount() > 0) { - yield $output->write(sprintf("There was %d disabled test:\n", $event->getTarget()->getDisabledTestCount())); - yield $output->write("\n"); - foreach ($this->disabledTests as $index => $disabledEvent) { - yield $output->write(sprintf( - "%d) %s::%s\n", - $index + 1, - $disabledEvent->getTarget()->getTestCase()::class, - $disabledEvent->getTarget()->getTestMethod() - )); - } - yield $output->write("\n"); - yield $output->write(sprintf( - "Tests: %d, Disabled Tests: %d, Assertions: %d, Async Assertions: %d\n", - $event->getTarget()->getTotalTestCount(), - $event->getTarget()->getDisabledTestCount(), - $event->getTarget()->getAssertionCount(), - $event->getTarget()->getAsyncAssertionCount() - )); - } - - if ($event->getTarget()->getTotalTestCount() === $event->getTarget()->getPassedTestCount()) { - yield $output->write("OK!\n"); - yield $output->write(sprintf( - "Tests: %d, Assertions: %d, Async Assertions: %d\n", - $event->getTarget()->getTotalTestCount(), - $event->getTarget()->getAssertionCount(), - $event->getTarget()->getAsyncAssertionCount() - )); - } - } -} \ No newline at end of file diff --git a/cli_test/Command/BaseCommandTest.php b/cli_test/Command/BaseCommandTest.php index e80797c..6088499 100644 --- a/cli_test/Command/BaseCommandTest.php +++ b/cli_test/Command/BaseCommandTest.php @@ -4,31 +4,36 @@ use Amp\ByteStream\OutputBuffer; +use Amp\ByteStream\WritableBuffer; use Amp\File\Driver as FileDriver; +use Amp\File\Filesystem; +use Amp\File\FilesystemDriver; use Cspray\Labrador\AsyncUnit\JsonConfigurationFactory; -use Cspray\Labrador\AsyncUnit\SupportedMockBridgeFactory; +use Cspray\Labrador\AsyncUnit\NoConstructorMockBridgeFactory; use Cspray\Labrador\AsyncUnitCli\AsyncUnitConsoleApplication; use Cspray\Labrador\AsyncUnitCli\TerminalResultPrinter; -use Cspray\Labrador\EnvironmentType; -use Cspray\Labrador\StandardEnvironment; +use Labrador\AsyncEvent\AmpEventEmitter; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; +use function Amp\File\filesystem; abstract class BaseCommandTest extends TestCase { - protected FileDriver|MockObject $filesystem; + protected FilesystemDriver|MockObject|null $driver; - protected OutputBuffer $testResultBuffer; + protected WritableBuffer $testResultBuffer; - protected function createApplication(string $configPath, FileDriver $mockFileDriver = null) : AsyncUnitConsoleApplication { - $this->filesystem = $mockFileDriver ?? $this->createMock(FileDriver::class); + protected function createApplication(string $configPath, FilesystemDriver $driver = null) : AsyncUnitConsoleApplication { + if ($driver === null) { + $this->driver = $this->createMock(FilesystemDriver::class); + } return new AsyncUnitConsoleApplication( - new StandardEnvironment(EnvironmentType::Test()), new NullLogger(), - $this->filesystem, + new AmpEventEmitter(), + filesystem($driver ?? $this->driver), new JsonConfigurationFactory(), - $this->testResultBuffer = new OutputBuffer(), + $this->testResultBuffer = new WritableBuffer(), $configPath ); } diff --git a/cli_test/Command/GenerateConfigurationCommandTest.php b/cli_test/Command/GenerateConfigurationCommandTest.php index 1bf66d6..b51f3d0 100644 --- a/cli_test/Command/GenerateConfigurationCommandTest.php +++ b/cli_test/Command/GenerateConfigurationCommandTest.php @@ -2,7 +2,7 @@ namespace Cspray\Labrador\AsyncUnitCli\Command; -use Amp\Success; +use Amp\Future; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; @@ -10,15 +10,14 @@ class GenerateConfigurationCommandTest extends BaseCommandTest { public function testGenerateFileDoesNotExist() { $application = $this->createApplication($configPath = __DIR__ . '/async-unit.json'); - $this->filesystem->expects($this->once()) - ->method('isfile') + $this->driver->expects($this->once()) + ->method('getStatus') ->with($configPath) - ->willReturn(new Success(false)); + ->willReturn(null); - $this->filesystem->expects($this->once()) - ->method('put') - ->with($configPath, $this->getDefaultConfigurationJson()) - ->willReturn(new Success()); + $this->driver->expects($this->once()) + ->method('write') + ->with($configPath, $this->getDefaultConfigurationJson()); $command = $application->find('config:generate'); $commandTester = new CommandTester($command); @@ -33,16 +32,15 @@ public function testGenerateFileDoesNotExist() { } public function testGenerateFileDoesNotExistOverridesDefaultLocation() { - $application = $this->createApplication($configPath = __DIR__ . '/async-unit.json'); - $this->filesystem->expects($this->once()) - ->method('isfile') + $application = $this->createApplication(__DIR__ . '/async-unit.json'); + $this->driver->expects($this->once()) + ->method('getStatus') ->with('/my/overridden/path') - ->willReturn(new Success(false)); + ->willReturn(null); - $this->filesystem->expects($this->once()) - ->method('put') - ->with('/my/overridden/path', $this->getDefaultConfigurationJson()) - ->willReturn(new Success()); + $this->driver->expects($this->once()) + ->method('write') + ->with('/my/overridden/path', $this->getDefaultConfigurationJson()); $command = $application->find('config:generate'); $commandTester = new CommandTester($command); @@ -60,12 +58,12 @@ public function testGenerateFileDoesNotExistOverridesDefaultLocation() { public function testGenerateFileDoesExistNoReplace() { $application = $this->createApplication($configPath = __DIR__ . '/async-unit.json'); - $this->filesystem->expects($this->once()) - ->method('isfile') + $this->driver->expects($this->once()) + ->method('getStatus') ->with($configPath) - ->willReturn(new Success(true)); + ->willReturn(['mode' => 0100000]); - $this->filesystem->expects($this->never())->method('put'); + $this->driver->expects($this->never())->method('write'); $command = $application->find('config:generate'); $commandTester = new CommandTester($command); @@ -84,20 +82,18 @@ public function testGenerateFileDoesExistNoReplace() { public function testGenerateFilesDoesExistWillReplace() { $application = $this->createApplication($configPath = __DIR__ . '/async-unit.json'); - $this->filesystem->expects($this->once()) - ->method('isfile') + $this->driver->expects($this->once()) + ->method('getStatus') ->with($configPath) - ->willReturn(new Success(true)); + ->willReturn(['mode' => 0100000]); - $this->filesystem->expects($this->once()) - ->method('rename') - ->with($configPath, $configPath . '.bak') - ->willReturn(new Success()); + $this->driver->expects($this->once()) + ->method('move') + ->with($configPath, $configPath . '.bak'); - $this->filesystem->expects($this->once()) - ->method('put') - ->with($configPath, $this->getDefaultConfigurationJson()) - ->willReturn(new Success()); + $this->driver->expects($this->once()) + ->method('write') + ->with($configPath, $this->getDefaultConfigurationJson()); $command = $application->find('config:generate'); $commandTester = new CommandTester($command); diff --git a/cli_test/Command/RunTestsCommandTest.php b/cli_test/Command/RunTestsCommandTest.php index 83bdfaf..32c443c 100644 --- a/cli_test/Command/RunTestsCommandTest.php +++ b/cli_test/Command/RunTestsCommandTest.php @@ -2,9 +2,8 @@ namespace Cspray\Labrador\AsyncUnitCli\Command; -use Amp\Loop; -use Amp\Success; -// Need to figure out how to share this properly between the 2 codebases +use Amp\File\Driver\BlockingFilesystemDriver; +use Amp\Future; use Cspray\Labrador\AsyncUnit\UsesAcmeSrc; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; @@ -16,10 +15,10 @@ class RunTestsCommandTest extends BaseCommandTest { public function testRunningCommandWithNoConfigurationPromptsToGenerateOne() { $application = $this->createApplication($configPath = __DIR__ . '/not-found.json'); - $this->filesystem->expects($this->once()) - ->method('isfile') + $this->driver->expects($this->once()) + ->method('getStatus') ->with($configPath) - ->willReturn(new Success(false)); + ->willReturn(null); $command = $application->find('run'); $commandTester = new CommandTester($command); @@ -39,10 +38,10 @@ public function testRunningCommandWithNoConfigurationPromptsToGenerateOne() { public function testConfigOptionOverridesLocationOfConfigurationFile() { $application = $this->createApplication(__DIR__ . '/not-found.json'); - $this->filesystem->expects($this->once()) - ->method('isfile') + $this->driver->expects($this->once()) + ->method('getStatus') ->with('/my/overridden/path') - ->willReturn(new Success(false)); + ->willReturn(null); $command = $application->find('run'); $commandTester = new CommandTester($command); @@ -65,12 +64,12 @@ public function testConfigOptionOverridesLocationOfConfigurationFile() { public function testRunningCommandWithNoConfigurationGeneratesWhenPromptAnswersYes() { return $this->markTestSkipped('This will require a more thorough solution for file system mocking.'); $application = $this->createApplication($configPath = __DIR__ . '/not-found.json'); - $this->filesystem->expects($this->exactly(2)) + $this->driver->expects($this->exactly(2)) ->method('isfile') ->with($configPath) ->willReturn(new Success(false)); - $this->filesystem->expects($this->once()) + $this->driver->expects($this->once()) ->method('put') ->with($configPath, $this->getDefaultConfigurationJson()) ->willReturn(new Success()); @@ -94,7 +93,7 @@ public function testRunningCommandWithNoConfigurationGeneratesWhenPromptAnswersY public function testRunningCommandWithConfigRunsTests() { $application = $this->createApplication( $this->implicitDefaultTestSuitePath('SingleTest/async-unit.json'), - filesystem() + new BlockingFilesystemDriver() ); $command = $application->find('run'); @@ -104,11 +103,7 @@ public function testRunningCommandWithConfigRunsTests() { $this->assertSame('', $actual); $this->assertSame(Command::SUCCESS, $commandTester->getStatusCode()); - $testResultOutput = ''; - Loop::run(function() use(&$testResultOutput) { - Loop::defer(fn() => yield $this->testResultBuffer->end()); - $testResultOutput .= yield $this->testResultBuffer; - }); + $testResultOutput = $this->testResultBuffer->buffer(); // Actual style of output will be tested in an integration test $this->assertNotEmpty($testResultOutput); } diff --git a/composer.json b/composer.json index 9e20f26..91a3497 100644 --- a/composer.json +++ b/composer.json @@ -1,39 +1,36 @@ { - "name": "cspray/labrador-async-unit", + "name": "labrador-kennel/async-unit", "description": "An async unit and integration testing framework written on top of PHP8", "bin": [ "bin/asyncunit" ], "require": { "php": "^8.2", - "amphp/amp": "^2", - "nikic/php-parser": "^4.10", - "cspray/labrador-async-event": "^2.3", - "cspray/labrador": "^3.2", - "symfony/console": "^5.2", + "amphp/amp": "^3", + "amphp/byte-stream": "^v2.0", + "amphp/file": "^3.0", + "labrador-kennel/async-event": "^4.1", + "cspray/labrador-styled-byte-stream": "^0.2", "opis/json-schema": "^2.0", - "amphp/byte-stream": "^1.8", - "cspray/yape": "^3.1", - "phpunit/php-timer": "^5.0", - "amphp/file": "^1.0", - "cspray/labrador-styled-byte-stream": "^0.1.0" + "nikic/php-parser": "^4.10", + "phpunit/php-timer": "^6.0", + "psr/log": "^2.0 || ^3.0" }, "require-dev": { "roave/security-advisories": "dev-latest", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10", "phpspec/prophecy": "^1.13", - "mockery/mockery": "^1.4" + "mockery/mockery": "^1.4", + "psalm/phar": "^5" }, "autoload": { "psr-4": { - "Cspray\\Labrador\\AsyncUnit\\": "framework_src", - "Cspray\\Labrador\\AsyncUnitCli\\": "cli_src" + "Labrador\\AsyncUnit\\": "src" } }, "autoload-dev": { "psr-4": { - "Cspray\\Labrador\\AsyncUnit\\": "framework_test", - "Cspray\\Labrador\\AsyncUnitCli\\": "cli_test", + "Labrador\\AsyncUnit\\Test\\": "tests", "Acme\\DemoSuites\\": "acme_src", "Acme\\Examples\\SimpleEquals\\": "examples/simple_equals_src", "Acme\\Examples\\CustomAssertion\\": "examples/custom_assertion_src", diff --git a/composer.lock b/composer.lock index 98935a2..044dfb6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,100 +4,40 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "09abc9946a80626597c8fdd5a660d854", + "content-hash": "9122679203539eb44cabc5f2f97a367a", "packages": [ - { - "name": "adbario/php-dot-notation", - "version": "2.5.0", - "source": { - "type": "git", - "url": "https://github.com/adbario/php-dot-notation.git", - "reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae", - "reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": "^5.5 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8|^5.7|^6.6|^7.5|^8.5|^9.5", - "squizlabs/php_codesniffer": "^3.6" - }, - "type": "library", - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Adbar\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Riku Särkinen", - "email": "riku@adbar.io" - } - ], - "description": "PHP dot notation access to arrays", - "homepage": "https://github.com/adbario/php-dot-notation", - "keywords": [ - "ArrayAccess", - "dotnotation" - ], - "support": { - "issues": "https://github.com/adbario/php-dot-notation/issues", - "source": "https://github.com/adbario/php-dot-notation/tree/2.5.0" - }, - "time": "2022-10-14T20:31:46+00:00" - }, { "name": "amphp/amp", - "version": "v2.6.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb" + "reference": "138801fb68cfc9c329da8a7b39d01ce7291ee4b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", - "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", + "url": "https://api.github.com/repos/amphp/amp/zipball/138801fb68cfc9c329da8a7b39d01ce7291ee4b0", + "reference": "138801fb68cfc9c329da8a7b39d01ce7291ee4b0", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^7 | ^8 | ^9", - "psalm/phar": "^3.11@dev", - "react/promise": "^2" + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "autoload": { "files": [ - "lib/functions.php", - "lib/Internal/functions.php" + "src/functions.php", + "src/Future/functions.php", + "src/Internal/functions.php" ], "psr-4": { - "Amp\\": "lib" + "Amp\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -105,10 +45,6 @@ "MIT" ], "authors": [ - { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" @@ -120,6 +56,10 @@ { "name": "Niklas Keller", "email": "me@kelunik.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" } ], "description": "A non-blocking concurrency framework for PHP applications.", @@ -136,9 +76,8 @@ "promise" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.2" + "source": "https://github.com/amphp/amp/tree/v3.0.2" }, "funding": [ { @@ -146,46 +85,45 @@ "type": "github" } ], - "time": "2022-02-20T17:52:18+00:00" + "time": "2024-05-10T21:37:46+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.8.1", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + "reference": "daa00f2efdbd71565bf64ffefa89e37542addf93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/daa00f2efdbd71565bf64ffefa89e37542addf93", + "reference": "daa00f2efdbd71565bf64ffefa89e37542addf93", "shasum": "" }, "require": { - "amphp/amp": "^2", - "php": ">=7.1" + "amphp/amp": "^3", + "amphp/parser": "^1.1", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2.3" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.22.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "files": [ - "lib/functions.php" + "src/functions.php", + "src/Internal/functions.php" ], "psr-4": { - "Amp\\ByteStream\\": "lib" + "Amp\\ByteStream\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -203,7 +141,7 @@ } ], "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "http://amphp.org/byte-stream", + "homepage": "https://amphp.org/byte-stream", "keywords": [ "amp", "amphp", @@ -213,9 +151,8 @@ "stream" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + "source": "https://github.com/amphp/byte-stream/tree/v2.1.1" }, "funding": [ { @@ -223,47 +160,111 @@ "type": "github" } ], - "time": "2021-03-30T17:13:30+00:00" + "time": "2024-02-17T04:49:38+00:00" }, { - "name": "amphp/file", - "version": "v1.0.2", + "name": "amphp/cache", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/amphp/file.git", - "reference": "54dcef2a3e38f445ae78ea44ff12c95738e46420" + "url": "https://github.com/amphp/cache.git", + "reference": "46912e387e6aa94933b61ea1ead9cf7540b7797c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/file/zipball/54dcef2a3e38f445ae78ea44ff12c95738e46420", - "reference": "54dcef2a3e38f445ae78ea44ff12c95738e46420", + "url": "https://api.github.com/repos/amphp/cache/zipball/46912e387e6aa94933b61ea1ead9cf7540b7797c", + "reference": "46912e387e6aa94933b61ea1ead9cf7540b7797c", "shasum": "" }, "require": { - "amphp/amp": "^2.2", - "amphp/byte-stream": "^1.6.1", - "amphp/parallel": "^1.2", - "php": ">=7.1" + "amphp/amp": "^3", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.1", - "ext-eio": "^2", - "ext-uv": "^0.3 || ^0.2", - "phpunit/phpunit": "^8 || ^7" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" + "autoload": { + "psr-4": { + "Amp\\Cache\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + } + ], + "description": "A fiber-aware cache API based on Amp and Revolt.", + "homepage": "https://amphp.org/cache", + "support": { + "issues": "https://github.com/amphp/cache/issues", + "source": "https://github.com/amphp/cache/tree/v2.0.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" } + ], + "time": "2024-04-19T03:38:06+00:00" + }, + { + "name": "amphp/dns", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/dns.git", + "reference": "04c88e67bef804203df934703bd422ea72f46b0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/dns/zipball/04c88e67bef804203df934703bd422ea72f46b0e", + "reference": "04c88e67bef804203df934703bd422ea72f46b0e", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parser": "^1", + "amphp/windows-registry": "^1.0.1", + "daverandom/libdns": "^2.0.2", + "ext-filter": "*", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.20" }, + "type": "library", "autoload": { "files": [ "src/functions.php" ], "psr-4": { - "Amp\\File\\": "src" + "Amp\\Dns\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -271,35 +272,40 @@ "MIT" ], "authors": [ + { + "name": "Chris Wright", + "email": "addr@daverandom.com" + }, { "name": "Daniel Lowrey", "email": "rdlowrey@php.net" }, { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" }, { "name": "Niklas Keller", "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" } ], - "description": "Allows non-blocking access to the filesystem for Amp.", - "homepage": "https://github.com/amphp/file", + "description": "Async DNS resolution for Amp.", + "homepage": "https://github.com/amphp/dns", "keywords": [ "amp", "amphp", "async", - "disk", - "file", - "filesystem", - "io", - "non-blocking", - "static" + "client", + "dns", + "resolve" ], "support": { - "issues": "https://github.com/amphp/file/issues", - "source": "https://github.com/amphp/file/tree/v1.0.2" + "issues": "https://github.com/amphp/dns/issues", + "source": "https://github.com/amphp/dns/tree/v2.1.2" }, "funding": [ { @@ -307,33 +313,40 @@ "type": "github" } ], - "time": "2020-07-14T15:15:32+00:00" + "time": "2024-04-19T03:49:29+00:00" }, { - "name": "amphp/log", - "version": "v1.2.0", + "name": "amphp/file", + "version": "v3.1.0", "source": { "type": "git", - "url": "https://github.com/amphp/log.git", - "reference": "c067b03281f5e018ca4bd05f5d161208685cbc03" + "url": "https://github.com/amphp/file.git", + "reference": "1d51235bd8cb4973c7908e645b62c638d8c081fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/log/zipball/c067b03281f5e018ca4bd05f5d161208685cbc03", - "reference": "c067b03281f5e018ca4bd05f5d161208685cbc03", + "url": "https://api.github.com/repos/amphp/file/zipball/1d51235bd8cb4973c7908e645b62c638d8c081fe", + "reference": "1d51235bd8cb4973c7908e645b62c638d8c081fe", "shasum": "" }, "require": { - "amphp/amp": "^2", - "amphp/byte-stream": "^1.3", - "monolog/monolog": "^3|^2|^1.23", - "php": ">=7.2", - "psr/log": "^3|^2|^1" + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parallel": "^2.1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.1", - "phpunit/phpunit": "^8 || ^7" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.22.2" + }, + "suggest": { + "ext-eio": "^2 || ^3", + "ext-uv": "^0.3 || ^0.2" }, "type": "library", "autoload": { @@ -341,7 +354,7 @@ "src/functions.php" ], "psr-4": { - "Amp\\Log\\": "src" + "Amp\\File\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -349,6 +362,10 @@ "MIT" ], "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" @@ -358,20 +375,22 @@ "email": "me@kelunik.com" } ], - "description": "Non-blocking logging for PHP based on Amp and Monolog.", - "homepage": "https://github.com/amphp/log", + "description": "Non-blocking access to the filesystem based on Amp and Revolt.", + "homepage": "https://github.com/amphp/file", "keywords": [ "amp", "amphp", "async", - "log", - "logger", - "logging", - "non-blocking" + "disk", + "file", + "filesystem", + "io", + "non-blocking", + "static" ], "support": { - "issues": "https://github.com/amphp/log/issues", - "source": "https://github.com/amphp/log/tree/v1.2.0" + "issues": "https://github.com/amphp/file/issues", + "source": "https://github.com/amphp/file/tree/v3.1.0" }, "funding": [ { @@ -379,45 +398,51 @@ "type": "github" } ], - "time": "2023-02-03T01:46:14+00:00" + "time": "2024-04-21T14:53:24+00:00" }, { "name": "amphp/parallel", - "version": "v1.4.2", + "version": "v2.2.9", "source": { "type": "git", "url": "https://github.com/amphp/parallel.git", - "reference": "75853e1623efa5aa5e65e986ec9a97db573a5267" + "reference": "73d293f1fc4df1bebc3c4fce1432e82dd7032238" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parallel/zipball/75853e1623efa5aa5e65e986ec9a97db573a5267", - "reference": "75853e1623efa5aa5e65e986ec9a97db573a5267", + "url": "https://api.github.com/repos/amphp/parallel/zipball/73d293f1fc4df1bebc3c4fce1432e82dd7032238", + "reference": "73d293f1fc4df1bebc3c4fce1432e82dd7032238", "shasum": "" }, "require": { - "amphp/amp": "^2", - "amphp/byte-stream": "^1.6.1", + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", "amphp/parser": "^1", - "amphp/process": "^1", + "amphp/pipeline": "^1", + "amphp/process": "^2", "amphp/serialization": "^1", - "amphp/sync": "^1.0.1", - "php": ">=7.1" + "amphp/socket": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.1", - "phpunit/phpunit": "^8 || ^7" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.18" }, "type": "library", "autoload": { "files": [ - "lib/Context/functions.php", - "lib/Sync/functions.php", - "lib/Worker/functions.php" + "src/Context/functions.php", + "src/Context/Internal/functions.php", + "src/Ipc/functions.php", + "src/Worker/functions.php" ], "psr-4": { - "Amp\\Parallel\\": "lib" + "Amp\\Parallel\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -429,6 +454,10 @@ "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, { "name": "Stephen Coakley", "email": "me@stephencoakley.com" @@ -445,7 +474,7 @@ ], "support": { "issues": "https://github.com/amphp/parallel/issues", - "source": "https://github.com/amphp/parallel/tree/v1.4.2" + "source": "https://github.com/amphp/parallel/tree/v2.2.9" }, "funding": [ { @@ -453,20 +482,20 @@ "type": "github" } ], - "time": "2022-12-30T00:21:42+00:00" + "time": "2024-03-24T18:27:44+00:00" }, { "name": "amphp/parser", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/amphp/parser.git", - "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151" + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parser/zipball/ff1de4144726c5dad5fab97f66692ebe8de3e151", - "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151", + "url": "https://api.github.com/repos/amphp/parser/zipball/3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7", "shasum": "" }, "require": { @@ -507,7 +536,74 @@ ], "support": { "issues": "https://github.com/amphp/parser/issues", - "source": "https://github.com/amphp/parser/tree/v1.1.0" + "source": "https://github.com/amphp/parser/tree/v1.1.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T19:16:53+00:00" + }, + { + "name": "amphp/pipeline", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/pipeline.git", + "reference": "f1c2ce35d27ae86ead018adb803eccca7421dd9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/pipeline/zipball/f1c2ce35d27ae86ead018adb803eccca7421dd9b", + "reference": "f1c2ce35d27ae86ead018adb803eccca7421dd9b", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.18" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Pipeline\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Asynchronous iterators and operators.", + "homepage": "https://amphp.org/pipeline", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "iterator", + "non-blocking" + ], + "support": { + "issues": "https://github.com/amphp/pipeline/issues", + "source": "https://github.com/amphp/pipeline/tree/v1.2.0" }, "funding": [ { @@ -515,39 +611,42 @@ "type": "github" } ], - "time": "2022-12-30T18:08:47+00:00" + "time": "2024-03-10T14:48:16+00:00" }, { "name": "amphp/process", - "version": "v1.1.4", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/amphp/process.git", - "reference": "76e9495fd6818b43a20167cb11d8a67f7744ee0f" + "reference": "52e08c09dec7511d5fbc1fb00d3e4e79fc77d58d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/process/zipball/76e9495fd6818b43a20167cb11d8a67f7744ee0f", - "reference": "76e9495fd6818b43a20167cb11d8a67f7744ee0f", + "url": "https://api.github.com/repos/amphp/process/zipball/52e08c09dec7511d5fbc1fb00d3e4e79fc77d58d", + "reference": "52e08c09dec7511d5fbc1fb00d3e4e79fc77d58d", "shasum": "" }, "require": { - "amphp/amp": "^2", - "amphp/byte-stream": "^1.4", - "php": ">=7" + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "phpunit/phpunit": "^6" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" }, "type": "library", "autoload": { "files": [ - "lib/functions.php" + "src/functions.php" ], "psr-4": { - "Amp\\Process\\": "lib" + "Amp\\Process\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -568,11 +667,11 @@ "email": "me@kelunik.com" } ], - "description": "Asynchronous process manager.", - "homepage": "https://github.com/amphp/process", + "description": "A fiber-aware process manager based on Amp and Revolt.", + "homepage": "https://amphp.org/process", "support": { "issues": "https://github.com/amphp/process/issues", - "source": "https://github.com/amphp/process/tree/v1.1.4" + "source": "https://github.com/amphp/process/tree/v2.0.3" }, "funding": [ { @@ -580,7 +679,7 @@ "type": "github" } ], - "time": "2022-07-06T23:50:12+00:00" + "time": "2024-04-19T03:13:44+00:00" }, { "name": "amphp/serialization", @@ -641,36 +740,46 @@ "time": "2020-03-25T21:39:07+00:00" }, { - "name": "amphp/sync", - "version": "v1.4.2", + "name": "amphp/socket", + "version": "v2.3.1", "source": { "type": "git", - "url": "https://github.com/amphp/sync.git", - "reference": "85ab06764f4f36d63b1356b466df6111cf4b89cf" + "url": "https://github.com/amphp/socket.git", + "reference": "58e0422221825b79681b72c50c47a930be7bf1e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/sync/zipball/85ab06764f4f36d63b1356b466df6111cf4b89cf", - "reference": "85ab06764f4f36d63b1356b466df6111cf4b89cf", + "url": "https://api.github.com/repos/amphp/socket/zipball/58e0422221825b79681b72c50c47a930be7bf1e1", + "reference": "58e0422221825b79681b72c50c47a930be7bf1e1", "shasum": "" }, "require": { - "amphp/amp": "^2.2", - "php": ">=7.1" + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/dns": "^2", + "ext-openssl": "*", + "kelunik/certificate": "^1.1", + "league/uri": "^6.5 | ^7", + "league/uri-interfaces": "^2.3 | ^7", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.1", - "phpunit/phpunit": "^9 || ^8 || ^7" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "amphp/process": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "5.20" }, "type": "library", "autoload": { "files": [ "src/functions.php", - "src/ConcurrentIterator/functions.php" + "src/Internal/functions.php", + "src/SocketAddress/functions.php" ], "psr-4": { - "Amp\\Sync\\": "src" + "Amp\\Socket\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -678,27 +787,108 @@ "MIT" ], "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@gmail.com" + }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" }, { - "name": "Stephen Coakley", - "email": "me@stephencoakley.com" + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "Mutex, Semaphore, and other synchronization tools for Amp.", - "homepage": "https://github.com/amphp/sync", + "description": "Non-blocking socket connection / server implementations based on Amp and Revolt.", + "homepage": "https://github.com/amphp/socket", "keywords": [ + "amp", "async", - "asynchronous", - "mutex", + "encryption", + "non-blocking", + "sockets", + "tcp", + "tls" + ], + "support": { + "issues": "https://github.com/amphp/socket/issues", + "source": "https://github.com/amphp/socket/tree/v2.3.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-04-21T14:33:03+00:00" + }, + { + "name": "amphp/sync", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/sync.git", + "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/sync/zipball/375ef5b54a0d12c38e12728dde05a55e30f2fbec", + "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Sync\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Non-blocking synchronization primitives for PHP based on Amp and Revolt.", + "homepage": "https://github.com/amphp/sync", + "keywords": [ + "async", + "asynchronous", + "mutex", "semaphore", "synchronization" ], "support": { "issues": "https://github.com/amphp/sync/issues", - "source": "https://github.com/amphp/sync/tree/v1.4.2" + "source": "https://github.com/amphp/sync/tree/v2.2.0" }, "funding": [ { @@ -706,45 +896,35 @@ "type": "github" } ], - "time": "2021-10-25T18:29:10+00:00" + "time": "2024-03-12T01:00:01+00:00" }, { - "name": "cspray/labrador", - "version": "3.2.1", + "name": "amphp/windows-registry", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/labrador-kennel/core.git", - "reference": "63ad537f4dbcee5409fce683f44fb75efb6f4e8e" + "url": "https://github.com/amphp/windows-registry.git", + "reference": "0d569e8f256cca974e3842b6e78b4e434bf98306" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/labrador-kennel/core/zipball/63ad537f4dbcee5409fce683f44fb75efb6f4e8e", - "reference": "63ad537f4dbcee5409fce683f44fb75efb6f4e8e", + "url": "https://api.github.com/repos/amphp/windows-registry/zipball/0d569e8f256cca974e3842b6e78b4e434bf98306", + "reference": "0d569e8f256cca974e3842b6e78b4e434bf98306", "shasum": "" }, "require": { - "adbario/php-dot-notation": "^2.2", - "amphp/amp": "^2.4", - "amphp/log": "^1.1", - "cspray/labrador-async-event": "^2.3", - "cspray/labrador-exceptions": "^1.2", - "cspray/yape": "^3.1", - "ext-json": "*", - "monolog/monolog": "^2.0", - "php": "^7.2|^8.0", - "rdlowrey/auryn": "^1.4" + "amphp/byte-stream": "^2", + "amphp/process": "^2", + "php": ">=8.1" }, "require-dev": { - "amphp/phpunit-util": "^1.2", - "cspray/labrador-coding-standard": "^0.2", - "phpunit/phpunit": "~9.1" + "amphp/php-cs-fixer-config": "^2", + "psalm/phar": "^5.4" }, "type": "library", "autoload": { "psr-4": { - "Cspray\\Labrador\\": [ - "src/" - ] + "Amp\\WindowsRegistry\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -753,52 +933,49 @@ ], "authors": [ { - "name": "Charles Sprayberry", - "email": "contact@labrador-kennel.io", - "homepage": "https://labrador-kennel.io", - "role": "Project Maintainer" + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "Core functionality powering Labrador Kennel Applications through Plugins, Events, and Engines", - "keywords": [ - "amphp", - "labrador-kennel" - ], + "description": "Windows Registry Reader.", "support": { - "issues": "https://github.com/labrador-kennel/core/issues", - "source": "https://github.com/labrador-kennel/core/tree/3.2.1" + "issues": "https://github.com/amphp/windows-registry/issues", + "source": "https://github.com/amphp/windows-registry/tree/v1.0.1" }, - "time": "2021-06-17T10:21:30+00:00" + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-01-30T23:01:51+00:00" }, { - "name": "cspray/labrador-async-event", - "version": "2.3.0", + "name": "cspray/labrador-styled-byte-stream", + "version": "0.2.0", "source": { "type": "git", - "url": "https://github.com/labrador-kennel/async-event.git", - "reference": "1ee7a8849012be7e5d25e08fe343efa447f09e21" + "url": "https://github.com/labrador-kennel/styled-byte-stream.git", + "reference": "dab7aa1c4a82067bbf1edaf1b41e5daa52f143b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/labrador-kennel/async-event/zipball/1ee7a8849012be7e5d25e08fe343efa447f09e21", - "reference": "1ee7a8849012be7e5d25e08fe343efa447f09e21", + "url": "https://api.github.com/repos/labrador-kennel/styled-byte-stream/zipball/dab7aa1c4a82067bbf1edaf1b41e5daa52f143b9", + "reference": "dab7aa1c4a82067bbf1edaf1b41e5daa52f143b9", "shasum": "" }, "require": { - "amphp/amp": "~2.0", - "cspray/labrador-exceptions": "~1.2", - "cspray/yape": "^3.1", - "php": ">=7.2" + "amphp/byte-stream": "^v2.0", + "php": "^8.0" }, "require-dev": { - "amphp/phpunit-util": "~1.1", - "cspray/labrador-coding-standard": "0.2.0", - "phpunit/phpunit": "~8" + "phpunit/phpunit": "^9.6", + "roave/security-advisories": "dev-latest" }, "type": "library", "autoload": { "psr-4": { - "Cspray\\Labrador\\AsyncEvent\\": "src/" + "Cspray\\Labrador\\StyledByteStream\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -813,43 +990,88 @@ "role": "Project Maintainer" } ], - "description": "Trigger semantic application events powered by Amp Event Loop", + "description": "Create colorized and formatted terminal text with Amp's OutputStream!", + "support": { + "issues": "https://github.com/labrador-kennel/styled-byte-stream/issues", + "source": "https://github.com/labrador-kennel/styled-byte-stream/tree/0.2.0" + }, + "time": "2023-02-25T12:57:54+00:00" + }, + { + "name": "daverandom/libdns", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/DaveRandom/LibDNS.git", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DaveRandom/LibDNS/zipball/b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "Required for IDN support" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "LibDNS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "DNS protocol implementation written in pure PHP", "keywords": [ - "amphp", - "emitter", - "event", - "labrador-kennel" + "dns" ], "support": { - "issues": "https://github.com/labrador-kennel/async-event/issues", - "source": "https://github.com/labrador-kennel/async-event/tree/2.3.0" + "issues": "https://github.com/DaveRandom/LibDNS/issues", + "source": "https://github.com/DaveRandom/LibDNS/tree/v2.1.0" }, - "abandoned": "labrador-kennel/async-event", - "time": "2021-03-20T02:57:59+00:00" + "time": "2024-04-12T12:12:48+00:00" }, { - "name": "cspray/labrador-exceptions", - "version": "1.2.0", + "name": "kelunik/certificate", + "version": "v1.1.3", "source": { "type": "git", - "url": "https://github.com/labrador-kennel/exception.git", - "reference": "e8c2bcbc87ae7229c9f7c305e2abd72bf6304078" + "url": "https://github.com/kelunik/certificate.git", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/labrador-kennel/exception/zipball/e8c2bcbc87ae7229c9f7c305e2abd72bf6304078", - "reference": "e8c2bcbc87ae7229c9f7c305e2abd72bf6304078", + "url": "https://api.github.com/repos/kelunik/certificate/zipball/7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-openssl": "*", + "php": ">=7.0" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^6 | 7 | ^8 | ^9" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, "autoload": { "psr-4": { - "Cspray\\Labrador\\Exception\\": [ - "src/" - ] + "Kelunik\\Certificate\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -858,43 +1080,59 @@ ], "authors": [ { - "name": "Charles Sprayberry", - "email": "cspray+labrador@gmail.com", - "homepage": "http://labrador.cspray.net", - "role": "Benevolent Dictator For Life" + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], + "description": "Access certificate details and transform between different formats.", + "keywords": [ + "DER", + "certificate", + "certificates", + "openssl", + "pem", + "x509" + ], "support": { - "issues": "https://github.com/labrador-kennel/exception/issues", - "source": "https://github.com/labrador-kennel/exception/tree/1.2.0" + "issues": "https://github.com/kelunik/certificate/issues", + "source": "https://github.com/kelunik/certificate/tree/v1.1.3" }, - "time": "2021-03-19T21:46:48+00:00" + "time": "2023-02-03T21:26:53+00:00" }, { - "name": "cspray/labrador-styled-byte-stream", - "version": "0.1.0", + "name": "labrador-kennel/async-event", + "version": "v4.1.0", "source": { "type": "git", - "url": "https://github.com/labrador-kennel/styled-byte-stream.git", - "reference": "93bd8866d3cebda9cb57250b92caa9ec21e1b513" + "url": "https://github.com/labrador-kennel/async-event.git", + "reference": "f7a625c3be9812d2cb9a58d2b4e08f6b81d69207" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/labrador-kennel/styled-byte-stream/zipball/93bd8866d3cebda9cb57250b92caa9ec21e1b513", - "reference": "93bd8866d3cebda9cb57250b92caa9ec21e1b513", + "url": "https://api.github.com/repos/labrador-kennel/async-event/zipball/f7a625c3be9812d2cb9a58d2b4e08f6b81d69207", + "reference": "f7a625c3be9812d2cb9a58d2b4e08f6b81d69207", "shasum": "" }, "require": { - "amphp/byte-stream": "^v1.8", - "php": "^8.0" + "amphp/amp": "~v3.0", + "labrador-kennel/composite-future": "^1.2", + "php": "^8.2" }, "require-dev": { - "phpunir/phpunit": "^9" + "amphp/phpunit-util": "dev-phpunit-10-support", + "cspray/labrador-coding-standard": "0.2.0", + "mockery/mockery": "^1.6", + "phpunit/phpunit": "^10", + "psalm/phar": "^5.6", + "roave/security-advisories": "dev-latest" + }, + "suggest": { + "labrador-kennel/async-event-autowire": "If using cspray/annotated-container will allow you to automatically register Listener implementations into your Emitter." }, "type": "library", "autoload": { "psr-4": { - "Cspray\\Labrador\\StyledByteStream\\": "src" + "Labrador\\AsyncEvent\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -909,41 +1147,103 @@ "role": "Project Maintainer" } ], - "description": "Create colorized and formatted terminal text with Amp's OutputStream!", + "description": "Trigger semantic application events powered by Amp Event Loop", + "keywords": [ + "amphp", + "event-emitter", + "labrador-kennel" + ], "support": { - "issues": "https://github.com/labrador-kennel/styled-byte-stream/issues", - "source": "https://github.com/labrador-kennel/styled-byte-stream/tree/0.1.0" + "issues": "https://github.com/labrador-kennel/async-event/issues", + "source": "https://github.com/labrador-kennel/async-event/tree/v4.1.0" }, - "time": "2021-05-11T21:48:22+00:00" + "time": "2024-05-31T15:11:57+00:00" }, { - "name": "cspray/yape", - "version": "3.1.0", + "name": "labrador-kennel/composite-future", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/cspray/yape.git", - "reference": "5d919f3300480086f63a92b5e821702e6ec9d6f6" + "url": "https://github.com/labrador-kennel/composite-future.git", + "reference": "f7edacc32c06d16a3f84d6707f88c64b2f7c69d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cspray/yape/zipball/5d919f3300480086f63a92b5e821702e6ec9d6f6", - "reference": "5d919f3300480086f63a92b5e821702e6ec9d6f6", + "url": "https://api.github.com/repos/labrador-kennel/composite-future/zipball/f7edacc32c06d16a3f84d6707f88c64b2f7c69d1", + "reference": "f7edacc32c06d16a3f84d6707f88c64b2f7c69d1", "shasum": "" }, "require": { - "php": ">=7.2" + "amphp/amp": "~3.0" }, "require-dev": { - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9.5", + "psalm/phar": "^4.27", + "roave/security-advisories": "dev-latest" + }, + "type": "library", + "autoload": { + "psr-4": { + "Labrador\\CompositeFuture\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Charles Sprayberry", + "email": "me@cspray.io" + } + ], + "description": "Compose Amp Futures and await them however you want with a type-safe CompositeFuture object.", + "support": { + "issues": "https://github.com/labrador-kennel/composite-future/issues", + "source": "https://github.com/labrador-kennel/composite-future/tree/1.3.0" + }, + "time": "2023-01-26T18:18:04+00:00" + }, + { + "name": "league/uri", + "version": "7.4.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/bedb6e55eff0c933668addaa7efa1e1f2c417cc4", + "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4", + "shasum": "" + }, + "require": { + "league/uri-interfaces": "^7.3", + "php": "^8.1" + }, + "conflict": { + "league/uri-schemes": "^1.0" }, "suggest": { - "cspray/yape-cli": "A CLI tool to generate Enum code for you.", - "cspray/yape-dbal": "A yape extension that allows storing Enums in Doctrine." + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, "autoload": { "psr-4": { - "Cspray\\Yape\\": "src" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -952,89 +1252,84 @@ ], "authors": [ { - "name": "Charles Sprayberry", - "email": "yape@cspray.io", - "homepage": "http://cspray.io", - "role": "Developer" + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" } ], - "description": "Type-safe, object-backed enum implementation in userland PHP.", - "homepage": "https://cspray.io/yape", + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", "keywords": [ - "enum" + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "uri-template", + "url", + "ws" ], "support": { - "issues": "https://github.com/cspray/yape/issues", - "source": "https://github.com/cspray/yape/tree/3.1.0" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.4.1" }, - "time": "2021-03-19T21:42:16+00:00" + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2024-03-23T07:42:40+00:00" }, { - "name": "monolog/monolog", - "version": "2.9.1", + "name": "league/uri-interfaces", + "version": "7.4.1", "source": { "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "8d43ef5c841032c87e2de015972c06f3865ef718" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/8d43ef5c841032c87e2de015972c06f3865ef718", + "reference": "8d43ef5c841032c87e2de015972c06f3865ef718", "shasum": "" }, "require": { - "php": ">=7.2", - "psr/log": "^1.0.1 || ^2.0 || ^3.0" - }, - "provide": { - "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^7 || ^8", - "ext-json": "*", - "graylog2/gelf-php": "^1.4.2 || ^2@dev", - "guzzlehttp/guzzle": "^7.4", - "guzzlehttp/psr7": "^2.2", - "mongodb/mongodb": "^1.8", - "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1 || ^2.0", - "rollbar/rollbar": "^1.3 || ^2 || ^3", - "ruflin/elastica": "^7", - "swiftmailer/swiftmailer": "^5.3|^6.0", - "symfony/mailer": "^5.4 || ^6", - "symfony/mime": "^5.4 || ^6" + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" }, "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", - "ext-mbstring": "Allow to work properly with unicode symbols", - "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", - "ext-openssl": "Required to send log messages using SSL", - "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "Monolog\\": "src/Monolog" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1043,51 +1338,63 @@ ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" } ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "https://github.com/Seldaek/monolog", + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", "keywords": [ - "log", - "logging", - "psr-3" + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "url", + "ws" ], "support": { - "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.9.1" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.1" }, "funding": [ { - "url": "https://github.com/Seldaek", + "url": "https://github.com/sponsors/nyamsprod", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", - "type": "tidelift" } ], - "time": "2023-02-06T13:44:46+00:00" + "time": "2024-03-23T07:42:40+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.19.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.1" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", @@ -1123,9 +1430,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2024-03-17T08:10:35+00:00" }, { "name": "opis/json-schema", @@ -1319,28 +1626,28 @@ }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1366,7 +1673,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -1374,34 +1681,35 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { - "name": "psr/container", - "version": "2.0.2", + "name": "psr/http-factory", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1414,37 +1722,38 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2021-11-05T16:47:00+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { - "name": "psr/log", - "version": "2.0.0", + "name": "psr/http-message", + "version": "2.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { @@ -1454,7 +1763,7 @@ }, "autoload": { "psr-4": { - "Psr\\Log\\": "src" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1467,44 +1776,47 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "log", + "http", + "http-message", "psr", - "psr-3" + "psr-7", + "request", + "response" ], "support": { - "source": "https://github.com/php-fig/log/tree/2.0.0" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2021-07-14T16:41:46+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { - "name": "rdlowrey/auryn", - "version": "v1.4.4", + "name": "psr/log", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/rdlowrey/auryn.git", - "reference": "dae57592229d313b59414a2c8334e61e6eb00928" + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rdlowrey/auryn/zipball/dae57592229d313b59414a2c8334e61e6eb00928", - "reference": "dae57592229d313b59414a2c8334e61e6eb00928", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "athletic/athletic": "~0.1", - "fabpot/php-cs-fixer": "~1.9", - "phpunit/phpunit": "^4.8" + "php": ">=8.0.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "autoload": { "psr-4": { - "Auryn\\": "lib/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1513,736 +1825,55 @@ ], "authors": [ { - "name": "Daniel Lowrey", - "email": "rdlowrey@gmail.com", - "homepage": "https://github.com/rdlowrey", - "role": "Creator / Main Developer" - }, - { - "name": "Levi Morrison", - "email": "levim@php.net", - "homepage": "http://morrisonlevi.github.com/", - "role": "Developer" - }, - { - "name": "Dan Ackroyd", - "email": "Danack@basereality.com", - "homepage": "http://www.basereality.com", - "role": "Developer" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Auryn is a dependency injector for bootstrapping object-oriented PHP applications.", - "homepage": "https://github.com/rdlowrey/auryn", - "keywords": [ - "dependency injection", - "dic", - "ioc" - ], - "support": { - "issues": "https://github.com/rdlowrey/auryn/issues", - "source": "https://github.com/rdlowrey/auryn/tree/v1.4.4" - }, - "time": "2021-03-04T20:26:52+00:00" - }, - { - "name": "symfony/console", - "version": "v5.4.19", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" - }, - "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v5.4.19" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-01-01T08:32:19+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.3-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-25T10:21:52+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" ], - "time": "2022-11-03T14:55:06+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" }, { - "name": "symfony/service-contracts", - "version": "v3.2.0", + "name": "revolt/event-loop", + "version": "v1.0.6", "source": { "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "url": "https://github.com/revoltphp/event-loop.git", + "reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/revoltphp/event-loop/zipball/25de49af7223ba039f64da4ae9a28ec2d10d0254", + "reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/container": "^2.0" - }, - "conflict": { - "ext-psr": "<1.1|>=2" + "php": ">=8.1" }, - "suggest": { - "symfony/service-implementation": "" + "require-dev": { + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.15" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "dev-main": "1.x-dev" } }, "autoload": { "psr-4": { - "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + "Revolt\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2250,131 +1881,87 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" }, { - "url": "https://github.com/fabpot", - "type": "github" + "name": "Christian Lück", + "email": "christian@clue.engineering" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "time": "2022-11-25T10:21:52+00:00" - }, + "description": "Rock-solid event loop for concurrent PHP applications.", + "keywords": [ + "async", + "asynchronous", + "concurrency", + "event", + "event-loop", + "non-blocking", + "scheduler" + ], + "support": { + "issues": "https://github.com/revoltphp/event-loop/issues", + "source": "https://github.com/revoltphp/event-loop/tree/v1.0.6" + }, + "time": "2023-11-30T05:34:44+00:00" + } + ], + "packages-dev": [ { - "name": "symfony/string", - "version": "v6.2.5", + "name": "doctrine/deprecations", + "version": "1.1.3", "source": { "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0" + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/translation-contracts": "<2.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" }, "type": "library", "autoload": { - "files": [ - "Resources/functions.php" - ], "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", "support": { - "source": "https://github.com/symfony/string/tree/v6.2.5" + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-01-01T08:38:09+00:00" - } - ], - "packages-dev": [ + "time": "2024-01-30T19:34:25+00:00" + }, { "name": "doctrine/instantiator", "version": "2.0.0", @@ -2498,38 +2085,38 @@ }, { "name": "mockery/mockery", - "version": "1.5.1", + "version": "1.6.12", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e" + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e", - "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.3 || ^8.0" + "php": ">=7.3" }, "conflict": { "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.3" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, "autoload": { - "psr-0": { - "Mockery": "library/" + "files": [ + "library/helpers.php", + "library/Mockery.php" + ], + "psr-4": { + "Mockery\\": "library/Mockery" } }, "notification-url": "https://packagist.org/downloads/", @@ -2540,12 +2127,20 @@ { "name": "Pádraic Brady", "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "homepage": "https://github.com/padraic", + "role": "Author" }, { "name": "Dave Marshall", "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], "description": "Mockery is a simple yet flexible PHP mock object framework", @@ -2563,23 +2158,26 @@ "testing" ], "support": { + "docs": "https://docs.mockery.io/", "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.5.1" + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories", + "source": "https://github.com/mockery/mockery" }, - "time": "2022-09-07T15:32:08+00:00" + "time": "2024-05-16T03:13:13+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -2617,7 +2215,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -2625,24 +2223,25 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -2683,9 +2282,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -2793,28 +2398,35 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.1", "ext-filter": "*", - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", + "phpdocumentor/type-resolver": "^1.7", + "phpstan/phpdoc-parser": "^1.7", "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "mockery/mockery": "~1.3.5", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^5.13" }, "type": "library", "extra": { @@ -2838,36 +2450,39 @@ }, { "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "email": "opensource@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2021-10-19T17:43:47+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "153ae662783729388a584b4361f2545e4d841e3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", + "reference": "153ae662783729388a584b4361f2545e4d841e3c", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -2899,35 +2514,35 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2024-02-23T11:10:43+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.17.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", - "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "type": "library", "extra": { @@ -2960,6 +2575,7 @@ "keywords": [ "Double", "Dummy", + "dev", "fake", "mock", "spy", @@ -2967,50 +2583,97 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.19.0" + }, + "time": "2024-02-29T11:52:51+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.29.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" }, - "time": "2023-02-02T15:41:36+00:00" + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" + }, + "time": "2024-05-31T08:52:43+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.24", + "version": "10.1.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.1" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -3038,7 +2701,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" }, "funding": [ { @@ -3046,32 +2710,32 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2024-03-12T15:33:41+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3098,7 +2762,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -3106,28 +2771,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -3135,7 +2800,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3161,7 +2826,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -3169,32 +2834,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3220,7 +2885,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -3228,24 +2894,23 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.3", + "version": "10.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -3255,27 +2920,26 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -3283,7 +2947,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "10.5-dev" } }, "autoload": { @@ -3314,7 +2978,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" }, "funding": [ { @@ -3330,7 +2995,42 @@ "type": "tidelift" } ], - "time": "2023-02-04T13:37:15+00:00" + "time": "2024-04-24T06:32:35+00:00" + }, + { + "name": "psalm/phar", + "version": "5.24.0", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "6ca1cbe47bbda0759b22ffe555594b547ff8351b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/6ca1cbe47bbda0759b22ffe555594b547ff8351b", + "reference": "6ca1cbe47bbda0759b22ffe555594b547ff8351b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.24.0" + }, + "time": "2024-05-01T20:28:41+00:00" }, { "name": "roave/security-advisories", @@ -3338,53 +3038,72 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "9206ad5e9490993f471ef1503f630afd7a849170" + "reference": "255803f702f07bee1a4edb0b079348c198603514" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/9206ad5e9490993f471ef1503f630afd7a849170", - "reference": "9206ad5e9490993f471ef1503f630afd7a849170", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/255803f702f07bee1a4edb0b079348c198603514", + "reference": "255803f702f07bee1a4edb0b079348c198603514", "shasum": "" }, "conflict": { "3f/pygmentize": "<1.2", - "admidio/admidio": "<4.1.9", + "admidio/admidio": "<4.2.13", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", - "aheinze/cockpit": "<=2.2.1", + "aheinze/cockpit": "<2.2", + "aimeos/aimeos-core": ">=2022.04.1,<2022.10.17|>=2023.04.1,<2023.10.17|>=2024.04.1,<2024.04.7", + "aimeos/aimeos-typo3": "<19.10.12|>=20,<20.10.5", + "airesvsg/acf-to-rest-api": "<=3.1", "akaunting/akaunting": "<2.1.13", "akeneo/pim-community-dev": "<5.0.119|>=6,<6.0.53", - "alextselegidis/easyappointments": "<=1.4.3", + "alextselegidis/easyappointments": "<1.5", "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", "amazing/media2click": ">=1,<1.3.3", "amphp/artax": "<1.0.6|>=2,<2.0.6", - "amphp/http": "<1.0.1", + "amphp/http": "<=1.7.2|>=2,<=2.1", "amphp/http-client": ">=4,<4.4", "anchorcms/anchor-cms": "<=0.12.7", "andreapollastri/cipi": "<=3.1.15", + "andrewhaine/silverstripe-form-capture": ">=0.2,<=0.2.3|>=1,<1.0.2|>=2,<2.2.5", + "apache-solr-for-typo3/solr": "<2.8.3", "apereo/phpcas": "<1.6", - "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", - "appwrite/server-ce": "<0.11.1|>=0.12,<0.12.2", + "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6|>=2.6,<2.7.10|>=3,<3.0.12|>=3.1,<3.1.3", + "appwrite/server-ce": "<=1.2.1", "arc/web": "<3", "area17/twill": "<1.2.5|>=2,<2.5.3", - "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", - "automad/automad": "<1.8", + "artesaos/seotools": "<0.17.2", + "asymmetricrypt/asymmetricrypt": "<9.9.99", + "athlon1600/php-proxy": "<=5.1", + "athlon1600/php-proxy-app": "<=3", + "austintoddj/canvas": "<=3.4.2", + "automad/automad": "<=1.10.9", + "automattic/jetpack": "<9.8", "awesome-support/awesome-support": "<=6.0.7", - "aws/aws-sdk-php": ">=3,<3.2.1", - "backdrop/backdrop": "<=1.23", + "aws/aws-sdk-php": "<3.288.1", + "azuracast/azuracast": "<0.18.3", + "backdrop/backdrop": "<1.24.2", + "backpack/crud": "<3.4.9", + "bacula-web/bacula-web": "<8.0.0.0-RC2-dev", "badaso/core": "<2.7", - "bagisto/bagisto": "<0.1.5", + "bagisto/bagisto": "<2.1", "barrelstrength/sprout-base-email": "<1.2.7", "barrelstrength/sprout-forms": "<3.9", "barryvdh/laravel-translation-manager": "<0.6.2", "barzahlen/barzahlen-php": "<2.0.1", - "baserproject/basercms": "<4.7.2", + "baserproject/basercms": "<5.0.9", "bassjobsen/bootstrap-3-typeahead": ">4.0.2", - "billz/raspap-webgui": "<=2.6.6", + "bbpress/bbpress": "<2.6.5", + "bcosca/fatfree": "<3.7.2", + "bedita/bedita": "<4", + "bigfork/silverstripe-form-capture": ">=3,<3.1.1", + "billz/raspap-webgui": "<2.9.5", "bk2k/bootstrap-package": ">=7.1,<7.1.2|>=8,<8.0.8|>=9,<9.0.4|>=9.1,<9.1.3|>=10,<10.0.10|>=11,<11.0.3", + "blueimp/jquery-file-upload": "==6.4.4", "bmarshall511/wordpress_zero_spam": "<5.2.13", "bolt/bolt": "<3.7.2", "bolt/core": "<=4.2", "bottelet/flarepoint": "<2.2.1", + "bref/bref": "<2.1.17", "brightlocal/phpwhois": "<=4.2.5", "brotkrueml/codehighlight": "<2.7", "brotkrueml/schema": "<1.13.1|>=2,<2.5.1", @@ -3393,362 +3112,509 @@ "bugsnag/bugsnag-laravel": ">=2,<2.0.2", "bytefury/crater": "<6.0.2", "cachethq/cachet": "<2.5.1", - "cakephp/cakephp": "<3.10.3|>=4,<4.0.10|>=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10|= 1.3.7|>=4.1,<4.1.4", + "cakephp/cakephp": "<3.10.3|>=4,<4.0.10|>=4.1,<4.1.4|>=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10", "cakephp/database": ">=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10", "cardgate/magento2": "<2.0.33", + "cardgate/woocommerce": "<=3.1.15", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cart2quote/module-quotation-encoded": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", "catfan/medoo": "<1.7.5", - "centreon/centreon": "<22.10-beta.1", + "causal/oidc": "<2.1", + "cecil/cecil": "<7.47.1", + "centreon/centreon": "<22.10.15", "cesnet/simplesamlphp-module-proxystatistics": "<3.1", - "cockpit-hq/cockpit": "<2.3.9", + "chriskacerguis/codeigniter-restserver": "<=2.7.1", + "civicrm/civicrm-core": ">=4.2,<4.2.9|>=4.3,<4.3.3", + "ckeditor/ckeditor": "<4.24", + "cockpit-hq/cockpit": "<2.7|==2.7", "codeception/codeception": "<3.1.3|>=4,<4.1.22", - "codeigniter/framework": "<=3.0.6", - "codeigniter4/framework": "<4.2.11", - "codeigniter4/shield": "= 1.0.0-beta", + "codeigniter/framework": "<3.1.9", + "codeigniter4/framework": "<4.4.7", + "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", - "composer/composer": "<1.10.26|>=2-alpha.1,<2.2.12|>=2.3,<2.3.5", - "concrete5/concrete5": "<=9.1.3|>= 9.0.0RC1, < 9.1.3", + "composer/composer": "<1.10.27|>=2,<2.2.23|>=2.3,<2.7", + "concrete5/concrete5": "<9.2.8", "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", - "contao/contao": ">=4,<4.4.56|>=4.5,<4.9.18|>=4.10,<4.11.7|>=4.13,<4.13.3", - "contao/core": ">=2,<3.5.39", - "contao/core-bundle": "<4.9.18|>=4.10,<4.11.7|>=4.13,<4.13.3|= 4.10.0", - "contao/listing-bundle": ">=4,<4.4.8", + "contao/comments-bundle": ">=2,<4.13.40|>=5.0.0.0-RC1-dev,<5.3.4", + "contao/contao": ">=3,<3.5.37|>=4,<4.4.56|>=4.5,<4.9.40|>=4.10,<4.11.7|>=4.13,<4.13.21|>=5.1,<5.1.4", + "contao/core": "<3.5.39", + "contao/core-bundle": "<4.13.40|>=5,<5.3.4", + "contao/listing-bundle": ">=3,<=3.5.30|>=4,<4.4.8", "contao/managed-edition": "<=1.5", - "craftcms/cms": "<3.7.55.2|>= 4.0.0-RC1, < 4.2.1", - "croogo/croogo": "<3.0.7", + "corveda/phpsandbox": "<1.3.5", + "cosenary/instagram": "<=2.3", + "craftcms/cms": "<4.6.2", + "croogo/croogo": "<4", "cuyz/valinor": "<0.12", "czproject/git-php": "<4.0.3", + "dapphp/securimage": "<3.6.6", "darylldoyle/safe-svg": "<1.9.10", "datadog/dd-trace": ">=0.30,<0.30.2", + "datatables/datatables": "<1.10.10", "david-garcia/phpwhois": "<=4.3.1", "dbrisinajumi/d2files": "<1", + "dcat/laravel-admin": "<=2.1.3.0-beta", "derhansen/fe_change_pwd": "<2.0.5|>=3,<3.0.3", - "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1", - "directmailteam/direct-mail": "<5.2.4", - "doctrine/annotations": ">=1,<1.2.7", + "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1|>=7,<7.4", + "desperado/xml-bundle": "<=0.1.7", + "devgroup/dotplant": "<2020.09.14-dev", + "directmailteam/direct-mail": "<6.0.3|>=7,<7.0.3|>=8,<9.5.2", + "doctrine/annotations": "<1.2.7", "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", - "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", + "doctrine/common": "<2.4.3|>=2.5,<2.5.1", "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2|>=3,<3.1.4", "doctrine/doctrine-bundle": "<1.5.2", - "doctrine/doctrine-module": "<=0.7.1", - "doctrine/mongodb-odm": ">=1,<1.0.2", - "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", - "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", - "dolibarr/dolibarr": "<16|>=16.0.1,<16.0.3|= 12.0.5|>= 3.3.beta1, < 13.0.2", - "dompdf/dompdf": "<2.0.2|= 2.0.2", - "drupal/core": ">=7,<7.91|>=8,<9.3.19|>=9.4,<9.4.3", - "drupal/drupal": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", + "doctrine/doctrine-module": "<0.7.2", + "doctrine/mongodb-odm": "<1.0.2", + "doctrine/mongodb-odm-bundle": "<3.0.1", + "doctrine/orm": ">=1,<1.2.4|>=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", + "dolibarr/dolibarr": "<=19", + "dompdf/dompdf": "<2.0.4", + "doublethreedigital/guest-entries": "<3.1.2", + "drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<10.1.8|>=10.2,<10.2.2", + "drupal/drupal": ">=5,<5.11|>=6,<6.38|>=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", + "duncanmcclean/guest-entries": "<3.1.2", "dweeves/magmi": "<=0.7.24", + "ec-cube/ec-cube": "<2.4.4|>=2.11,<=2.17.1|>=3,<=3.0.18.0-patch4|>=4,<=4.1.2", "ecodev/newsletter": "<=4", "ectouch/ectouch": "<=2.7.2", - "elefant/cms": "<1.3.13", + "egroupware/egroupware": "<16.1.20170922", + "elefant/cms": "<2.0.7", "elgg/elgg": "<3.3.24|>=4,<4.0.5", + "elijaa/phpmemcacheadmin": "<=1.3", + "encore/laravel-admin": "<=1.8.19", "endroid/qr-code-bundle": "<3.4.2", + "enhavo/enhavo-app": "<=0.13.1", "enshrined/svg-sanitize": "<0.15", "erusev/parsedown": "<1.7.2", "ether/logs": "<3.0.4", + "evolutioncms/evolution": "<=3.2.3", "exceedone/exment": "<4.4.3|>=5,<5.0.3", - "exceedone/laravel-admin": "= 3.0.0|<2.2.3", - "ezsystems/demobundle": ">=5.4,<5.4.6.1", + "exceedone/laravel-admin": "<2.2.3|==3", + "ezsystems/demobundle": ">=5.4,<5.4.6.1-dev", "ezsystems/ez-support-tools": ">=2.2,<2.2.3", - "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", - "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", + "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1-dev", + "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1-dev|>=5.4,<5.4.11.1-dev|>=2017.12,<2017.12.0.1-dev", "ezsystems/ezplatform": "<=1.13.6|>=2,<=2.5.24", "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<1.5.29|>=2.3,<2.3.26", "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", - "ezsystems/ezplatform-graphql": ">=1-rc.1,<1.0.13|>=2-beta.1,<2.3.12", - "ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<1.3.26", + "ezsystems/ezplatform-graphql": ">=1.0.0.0-RC1-dev,<1.0.13|>=2.0.0.0-beta1,<2.3.12", + "ezsystems/ezplatform-kernel": "<1.2.5.1-dev|>=1.3,<1.3.35", "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<1.3.8", - "ezsystems/ezplatform-richtext": ">=2.3,<=2.3.7", + "ezsystems/ezplatform-richtext": ">=2.3,<2.3.7.1-dev", + "ezsystems/ezplatform-solr-search-engine": ">=1.7,<1.7.12|>=2,<2.0.2|>=3.3,<3.3.15", "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.30", - "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.3.5.1", + "ezsystems/ezpublish-kernel": "<6.13.8.2-dev|>=7,<7.5.31", + "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.03.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", - "ezsystems/repository-forms": ">=2.3,<2.3.2.1|>=2.5,<2.5.15", + "ezsystems/repository-forms": ">=2.3,<2.3.2.1-dev|>=2.5,<2.5.15", "ezyang/htmlpurifier": "<4.1.1", "facade/ignition": "<1.16.15|>=2,<2.4.2|>=2.5,<2.5.2", - "facturascripts/facturascripts": "<=2022.8", + "facturascripts/facturascripts": "<=2022.08", + "fastly/magento2": "<1.2.26", "feehi/cms": "<=2.1.1", "feehi/feehicms": "<=2.1.1", "fenom/fenom": "<=2.12.1", "filegator/filegator": "<7.8", + "filp/whoops": "<2.1.13", + "fineuploader/php-traditional-server": "<=1.2.2", "firebase/php-jwt": "<6", "fixpunkt/fp-masterquiz": "<2.2.1|>=3,<3.5.2", "fixpunkt/fp-newsletter": "<1.1.1|>=2,<2.1.2|>=2.2,<3.2.6", - "flarum/core": "<1.6.3", + "flarum/core": "<1.8.5", + "flarum/flarum": "<0.1.0.0-beta8", + "flarum/framework": "<1.8.5", "flarum/mentions": "<1.6.3", - "flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15", - "flarum/tags": "<=0.1-beta.13", + "flarum/sticky": ">=0.1.0.0-beta14,<=0.1.0.0-beta15", + "flarum/tags": "<=0.1.0.0-beta13", + "floriangaerber/magnesium": "<0.3.1", "fluidtypo3/vhs": "<5.1.1", - "fof/byobu": ">=0.3-beta.2,<1.1.7", + "fof/byobu": ">=0.3.0.0-beta2,<1.1.7", "fof/upload": "<1.2.3", + "foodcoopshop/foodcoopshop": ">=3.2,<3.6.1", "fooman/tcpdf": "<6.2.22", "forkcms/forkcms": "<5.11.1", "fossar/tcpdf-parser": "<6.2.22", - "francoisjacquet/rosariosis": "<10.1", + "francoisjacquet/rosariosis": "<=11.5.1", + "frappant/frp-form-answers": "<3.1.2|>=4,<4.0.2", "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", - "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "friendsofsymfony/user-bundle": ">=1,<1.3.5", + "friendsofsymfony1/swiftmailer": ">=4,<5.4.13|>=6,<6.2.5", + "friendsofsymfony1/symfony1": ">=1.1,<1.15.19", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", - "froala/wysiwyg-editor": "<3.2.7", - "froxlor/froxlor": "<2.0.11", + "friendsoftypo3/openid": ">=4.5,<4.5.31|>=4.7,<4.7.16|>=6,<6.0.11|>=6.1,<6.1.6", + "froala/wysiwyg-editor": "<3.2.7|>=4.0.1,<=4.1.3", + "froxlor/froxlor": "<2.1.9", + "frozennode/administrator": "<=5.0.12", "fuel/core": "<1.8.1", + "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", - "getgrav/grav": "<1.7.34", - "getkirby/cms": "= 3.8.0|<3.5.8.2|>=3.6,<3.6.6.2|>=3.7,<3.7.5.1", + "getformwork/formwork": "<1.13", + "getgrav/grav": "<1.7.46", + "getkirby/cms": "<4.1.1", + "getkirby/kirby": "<=2.5.12", "getkirby/panel": "<2.5.14", "getkirby/starterkit": "<=3.7.0.2", - "gilacms/gila": "<=1.11.4", + "gilacms/gila": "<=1.15.4", + "gleez/cms": "<=1.3|==2", "globalpayments/php-sdk": "<2", + "gogentooss/samlbase": "<1.2.7", "google/protobuf": "<3.15", "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", - "gree/jose": "<=2.2", + "gree/jose": "<2.2.1", "gregwar/rst": "<1.0.3", - "grumpydictator/firefly-iii": "<5.8", + "grumpydictator/firefly-iii": "<6.1.7", + "gugoan/economizzer": "<=0.9.0.0-beta1", "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", - "guzzlehttp/psr7": "<1.8.4|>=2,<2.1.1", + "guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5", + "haffner/jh_captcha": "<=2.1.3|>=3,<=3.0.2", "harvesthq/chosen": "<1.8.7", - "helloxz/imgurl": "= 2.31|<=2.31", + "helloxz/imgurl": "<=2.31", + "hhxsv5/laravel-s": "<3.7.36", "hillelcoren/invoice-ninja": "<5.3.35", "himiklab/yii2-jqgrid-widget": "<1.0.8", "hjue/justwriting": "<=1", "hov/jobfair": "<1.0.13|>=2,<2.0.2", + "httpsoft/http-message": "<1.0.12", "hyn/multi-tenant": ">=5.6,<5.7.2", "ibexa/admin-ui": ">=4.2,<4.2.3", - "ibexa/core": ">=4,<4.0.7|>=4.1,<4.1.4|>=4.2,<4.2.3", + "ibexa/core": ">=4,<4.0.7|>=4.1,<4.1.4|>=4.2,<4.2.3|>=4.5,<4.5.6|>=4.6,<4.6.2", "ibexa/graphql": ">=2.5,<2.5.31|>=3.3,<3.3.28|>=4.2,<4.2.3", "ibexa/post-install": "<=1.0.4", + "ibexa/solr": ">=4.5,<4.5.4", + "ibexa/user": ">=4,<4.4.3", "icecoder/icecoder": "<=8.1", "idno/known": "<=1.3.1", - "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", - "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", + "ilicmiljan/secure-props": ">=1.2,<1.2.2", + "illuminate/auth": "<5.5.10", + "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<6.18.31|>=7,<7.22.4", "illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", - "impresscms/impresscms": "<=1.4.3", - "in2code/femanager": "<5.5.3|>=6,<6.3.4|>=7,<7.1", + "imdbphp/imdbphp": "<=5.1.1", + "impresscms/impresscms": "<=1.4.5", + "impresspages/impresspages": "<=1.0.12", + "in2code/femanager": "<5.5.3|>=6,<6.3.4|>=7,<7.2.3", + "in2code/ipandlanguageredirect": "<5.1.2", "in2code/lux": "<17.6.1|>=18,<24.0.2", "innologi/typo3-appointments": "<2.0.6", - "intelliants/subrion": "<=4.2.1", + "intelliants/subrion": "<4.2.2", + "inter-mediator/inter-mediator": "==5.5", "islandora/islandora": ">=2,<2.4.1", "ivankristianto/phpwhois": "<=4.3", "jackalope/jackalope-doctrine-dbal": "<1.7.4", "james-heinrich/getid3": "<1.9.21", + "james-heinrich/phpthumb": "<1.7.12", "jasig/phpcas": "<1.3.3", + "jcbrand/converse.js": "<3.3.3", + "johnbillion/wp-crontrol": "<1.16.2", + "joomla/application": "<1.0.13", "joomla/archive": "<1.1.12|>=2,<2.0.1", "joomla/filesystem": "<1.6.2|>=2,<2.0.1", "joomla/filter": "<1.4.4|>=2,<2.0.1", + "joomla/framework": "<1.5.7|>=2.5.4,<=3.8.12", "joomla/input": ">=2,<2.0.2", + "joomla/joomla-cms": ">=2.5,<3.9.12", "joomla/session": "<1.3.1", "joyqi/hyper-down": "<=2.4.27", "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", + "juzaweb/cms": "<=3.4", "kazist/phpwhois": "<=4.2.6", "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", - "kimai/kimai": "<1.1", - "kitodo/presentation": "<3.1.2", + "khodakhah/nodcms": "<=3", + "kimai/kimai": "<2.16", + "kitodo/presentation": "<3.2.3|>=3.3,<3.3.4", "klaviyo/magento2-extension": ">=1,<3", + "knplabs/knp-snappy": "<=1.4.2", + "kohana/core": "<3.3.3", "krayin/laravel-crm": "<1.2.2", "kreait/firebase-php": ">=3.2,<3.8.1", + "kumbiaphp/kumbiapp": "<=1.1.1", "la-haute-societe/tcpdf": "<6.2.22", - "laminas/laminas-diactoros": "<2.11.1", + "laminas/laminas-diactoros": "<2.18.1|==2.19|==2.20|==2.21|==2.22|==2.23|>=2.24,<2.24.2|>=2.25,<2.25.2", "laminas/laminas-form": "<2.17.1|>=3,<3.0.2|>=3.1,<3.1.1", "laminas/laminas-http": "<2.14.2", "laravel/fortify": "<1.11.1", - "laravel/framework": "<6.20.42|>=7,<7.30.6|>=8,<8.75", - "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "laravel/framework": "<6.20.44|>=7,<7.30.6|>=8,<8.75", + "laravel/laravel": ">=5.4,<5.4.22", + "laravel/socialite": ">=1,<2.0.10", "latte/latte": "<2.10.8", - "lavalite/cms": "<=5.8", + "lavalite/cms": "<=9|==10.1", "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", "league/commonmark": "<0.18.3", "league/flysystem": "<1.1.4|>=2,<2.1.1", + "league/oauth2-server": ">=8.3.2,<8.4.2|>=8.5,<8.5.3", "lexik/jwt-authentication-bundle": "<2.10.7|>=2.11,<2.11.3", - "librenms/librenms": "<22.10", + "libreform/libreform": ">=2,<=2.0.8", + "librenms/librenms": "<2017.08.18", "liftkit/database": "<2.13.2", + "lightsaml/lightsaml": "<1.3.5", "limesurvey/limesurvey": "<3.27.19", "livehelperchat/livehelperchat": "<=3.91", - "livewire/livewire": ">2.2.4,<2.2.6", + "livewire/livewire": ">2.2.4,<2.2.6|>=3.3.5,<3.4.9", "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", "luyadev/yii-helpers": "<1.2.1", - "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", - "magento/magento1ce": "<1.9.4.3", - "magento/magento1ee": ">=1,<1.14.4.3", - "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", + "magento/community-edition": "<2.4.3.0-patch3|>=2.4.4,<2.4.5", + "magento/core": "<=1.9.4.5", + "magento/magento1ce": "<1.9.4.3-dev", + "magento/magento1ee": ">=1,<1.14.4.3-dev", + "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2.0-patch2", + "magneto/core": "<1.9.4.4-dev", "maikuolan/phpmussel": ">=1,<1.6", + "mainwp/mainwp": "<=4.4.3.3", + "mantisbt/mantisbt": "<2.26.2", "marcwillmann/turn": "<0.3.3", "matyhtf/framework": "<3.0.6", - "mautic/core": "<4.3|= 2.13.1", - "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", + "mautic/core": "<4.4.12|>=5.0.0.0-alpha,<5.0.4", + "mdanter/ecc": "<2", + "mediawiki/core": "<1.36.2", "mediawiki/matomo": "<2.4.3", + "mediawiki/semantic-media-wiki": "<4.0.2", "melisplatform/melis-asset-manager": "<5.0.1", "melisplatform/melis-cms": "<5.0.1", "melisplatform/melis-front": "<5.0.1", "mezzio/mezzio-swoole": "<3.7|>=4,<4.3", "mgallegos/laravel-jqgrid": "<=1.3", - "microweber/microweber": "<1.3.2", + "microsoft/microsoft-graph": ">=1.16,<1.109.1|>=2,<2.0.1", + "microsoft/microsoft-graph-beta": "<2.0.1", + "microsoft/microsoft-graph-core": "<2.0.2", + "microweber/microweber": "<=2.0.4", + "mikehaertl/php-shellcommand": "<1.6.1", "miniorange/miniorange-saml": "<1.4.3", "mittwald/typo3_forum": "<1.2.1", "mobiledetect/mobiledetectlib": "<2.8.32", - "modx/revolution": "<= 2.8.3-pl|<2.8", + "modx/revolution": "<=2.8.3.0-patch", "mojo42/jirafeau": "<4.4", + "mongodb/mongodb": ">=1,<1.9.2", "monolog/monolog": ">=1.8,<1.12", - "moodle/moodle": "<4.0.5", + "moodle/moodle": "<=4.3.3", + "mos/cimage": "<0.7.19", + "movim/moxl": ">=0.8,<=0.10", + "movingbytes/social-network": "<=1.2.1", + "mpdf/mpdf": "<=7.1.7", + "munkireport/comment": "<4.1", + "munkireport/managedinstalls": "<2.6", + "munkireport/munki_facts": "<1.5", + "munkireport/munkireport": ">=2.5.3,<5.6.3", + "munkireport/reportdata": "<3.5", + "munkireport/softwareupdate": "<1.6", "mustache/mustache": ">=2,<2.14.1", "namshi/jose": "<2.2", "neoan3-apps/template": "<1.1.1", - "neorazorx/facturascripts": "<2022.4", + "neorazorx/facturascripts": "<2022.04", "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", "neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3", - "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", - "neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", + "neos/media-browser": "<7.3.19|>=8,<8.0.16|>=8.1,<8.1.11|>=8.2,<8.2.11|>=8.3,<8.3.9", + "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", + "neos/swiftmailer": "<5.4.5", "netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", - "nilsteampassnet/teampass": "<=2.1.27.36", + "nilsteampassnet/teampass": "<3.0.10", + "nonfiction/nterchange": "<4.1.1", "notrinos/notrinos-erp": "<=0.7", "noumo/easyii": "<=0.9", - "nukeviet/nukeviet": "<4.5.2", + "novaksolutions/infusionsoft-php-sdk": "<1", + "nukeviet/nukeviet": "<4.5.02", + "nyholm/psr7": "<1.6.1", "nystudio107/craft-seomatic": "<3.4.12", + "nzedb/nzedb": "<0.8", "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", "october/backend": "<1.1.2", - "october/cms": "= 1.1.1|= 1.0.471|= 1.0.469|>=1.0.319,<1.0.469", - "october/october": ">=1.0.319,<1.0.466|>=2.1,<2.1.12", + "october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1", + "october/october": "<=3.4.4", "october/rain": "<1.0.472|>=1.1,<1.1.2", - "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.0.66", + "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.2", + "omeka/omeka-s": "<4.0.3", "onelogin/php-saml": "<2.10.4", - "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", + "oneup/uploader-bundle": ">=1,<1.9.3|>=2,<2.1.5", "open-web-analytics/open-web-analytics": "<1.7.4", - "opencart/opencart": "<=3.0.3.7", + "opencart/opencart": "<=3.0.3.7|>=4,<4.0.2.3-dev", "openid/php-openid": "<2.3", - "openmage/magento-lts": "<19.4.22|>=20,<20.0.19", - "orchid/platform": ">=9,<9.4.4", - "oro/commerce": ">=4.1,<5.0.6", + "openmage/magento-lts": "<20.5", + "opensolutions/vimbadmin": "<=3.0.15", + "opensource-workshop/connect-cms": "<1.7.2|>=2,<2.3.2", + "orchid/platform": ">=9,<9.4.4|>=14.0.0.0-alpha4,<14.5", + "oro/calendar-bundle": ">=4.2,<=4.2.6|>=5,<=5.0.6|>=5.1,<5.1.1", + "oro/commerce": ">=4.1,<5.0.11|>=5.1,<5.1.1", "oro/crm": ">=1.7,<1.7.4|>=3.1,<4.1.17|>=4.2,<4.2.7", - "oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<4.2.8", + "oro/crm-call-bundle": ">=4.2,<=4.2.5|>=5,<5.0.4|>=5.1,<5.1.1", + "oro/customer-portal": ">=4.1,<=4.1.13|>=4.2,<=4.2.10|>=5,<=5.0.11|>=5.1,<=5.1.3", + "oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<=4.2.10|>=5,<=5.0.12|>=5.1,<=5.1.3", + "oxid-esales/oxideshop-ce": "<4.5", + "oxid-esales/paymorrow-module": ">=1,<1.0.2|>=2,<2.0.1", "packbackbooks/lti-1-3-php-library": "<5", "padraic/humbug_get_contents": "<1.1.2", - "pagarme/pagarme-php": ">=0,<3", + "pagarme/pagarme-php": "<3", "pagekit/pagekit": "<=1.0.18", + "paragonie/ecc": "<2.0.1", "paragonie/random_compat": "<2", - "passbolt/passbolt_api": "<2.11", + "passbolt/passbolt_api": "<4.6.2", + "paypal/adaptivepayments-sdk-php": "<=3.9.2", + "paypal/invoice-sdk-php": "<=3.9", "paypal/merchant-sdk-php": "<3.12", + "paypal/permissions-sdk-php": "<=3.9.1", "pear/archive_tar": "<1.4.14", + "pear/auth": "<1.2.4", "pear/crypt_gpg": "<1.6.7", + "pear/pear": "<=1.10.1", "pegasus/google-for-jobs": "<1.5.1|>=2,<2.1.1", "personnummer/personnummer": "<3.0.2", "phanan/koel": "<5.1.4", + "phenx/php-svg-lib": "<0.5.2", + "php-censor/php-censor": "<2.0.13|>=2.1,<2.1.5", "php-mod/curl": "<2.3.2", + "phpbb/phpbb": "<3.2.10|>=3.3,<3.3.1", + "phpems/phpems": ">=6,<=6.1.3", "phpfastcache/phpfastcache": "<6.1.5|>=7,<7.1.2|>=8,<8.0.7", "phpmailer/phpmailer": "<6.5", "phpmussel/phpmussel": ">=1,<1.6", "phpmyadmin/phpmyadmin": "<5.2.1", - "phpmyfaq/phpmyfaq": "<=3.1.7", + "phpmyfaq/phpmyfaq": "<3.2.5|==3.2.5", + "phpoffice/common": "<0.2.9", "phpoffice/phpexcel": "<1.8", "phpoffice/phpspreadsheet": "<1.16", - "phpseclib/phpseclib": "<2.0.31|>=3,<3.0.7", - "phpservermon/phpservermon": "<=3.5.2", - "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5,<5.6.3", + "phpseclib/phpseclib": "<2.0.47|>=3,<3.0.36", + "phpservermon/phpservermon": "<3.6", + "phpsysinfo/phpsysinfo": "<3.4.3", + "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", "phpxmlrpc/phpxmlrpc": "<4.9.2", + "pi/pi": "<=2.5", + "pimcore/admin-ui-classic-bundle": "<1.3.4", + "pimcore/customer-management-framework-bundle": "<4.0.6", "pimcore/data-hub": "<1.2.4", - "pimcore/pimcore": "<10.5.17", + "pimcore/demo": "<10.3", + "pimcore/ecommerce-framework-bundle": "<1.0.10", + "pimcore/perspective-editor": "<1.5.1", + "pimcore/pimcore": "<11.1.6.5-dev|>=11.2,<11.2.3", + "pixelfed/pixelfed": "<0.11.11", + "plotly/plotly.js": "<2.25.2", "pocketmine/bedrock-protocol": "<8.0.2", - "pocketmine/pocketmine-mp": "<4.12.5|>= 4.0.0-BETA5, < 4.4.2", + "pocketmine/pocketmine-mp": "<5.11.2", + "pocketmine/raklib": ">=0.14,<0.14.6|>=0.15,<0.15.1", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", + "prestashop/blockreassurance": "<=5.1.3", "prestashop/blockwishlist": ">=2,<2.1.1", "prestashop/contactform": ">=1.0.1,<4.3", "prestashop/gamification": "<2.3.2", - "prestashop/prestashop": "<1.7.8.8", + "prestashop/prestashop": "<8.1.6", "prestashop/productcomments": "<5.0.2", "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<3.4.1", "prestashop/ps_linklist": "<3.1", "privatebin/privatebin": "<1.4", - "processwire/processwire": "<=3.0.200", - "propel/propel": ">=2-alpha.1,<=2-alpha.7", + "processwire/processwire": "<=3.0.210", + "propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7", "propel/propel1": ">=1,<=1.7.1", - "pterodactyl/panel": "<1.7", + "pterodactyl/panel": "<1.11.6", + "ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2", "ptrofimov/beanstalk_console": "<1.7.14", + "pubnub/pubnub": "<6.1", "pusher/pusher-php-server": "<2.2.1", - "pwweb/laravel-core": "<=0.3.6-beta", + "pwweb/laravel-core": "<=0.3.6.0-beta", "pyrocms/pyrocms": "<=3.9.1", + "qcubed/qcubed": "<=3.1.1", + "quickapps/cms": "<=2.0.0.0-beta2", + "rainlab/blog-plugin": "<1.4.1", "rainlab/debugbar-plugin": "<3.1", + "rainlab/user-plugin": "<=1.4.5", "rankmath/seo-by-rank-math": "<=1.0.95", - "react/http": ">=0.7,<1.7", - "remdex/livehelperchat": "<3.99", + "rap2hpoutre/laravel-log-viewer": "<0.13", + "react/http": ">=0.7,<1.9", + "really-simple-plugins/complianz-gdpr": "<6.4.2", + "redaxo/source": "<=5.15.1", + "remdex/livehelperchat": "<4.29", + "reportico-web/reportico": "<=8.1", + "rhukster/dom-sanitizer": "<1.0.7", "rmccue/requests": ">=1.6,<1.8", - "robrichards/xmlseclibs": "<3.0.4", + "robrichards/xmlseclibs": ">=1,<3.0.4", "roots/soil": "<4.1", "rudloff/alltube": "<3.0.3", "s-cart/core": "<6.9", "s-cart/s-cart": "<6.9", "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", - "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", - "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", + "sabre/dav": ">=1.6,<1.7.11|>=1.8,<1.8.9", + "scheb/two-factor-bundle": "<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", - "shopware/core": "<=6.4.18", - "shopware/platform": "<=6.4.18", + "sfroemken/url_redirect": "<=1.2.1", + "sheng/yiicms": "<=1.2", + "shopware/core": "<6.5.8.8-dev|>=6.6.0.0-RC1-dev,<6.6.1", + "shopware/platform": "<6.5.8.8-dev|>=6.6.0.0-RC1-dev,<6.6.1", "shopware/production": "<=6.3.5.2", - "shopware/shopware": "<=5.7.14", - "shopware/storefront": "<=6.4.8.1", + "shopware/shopware": "<6.2.3", + "shopware/storefront": "<=6.4.8.1|>=6.5.8,<6.5.8.7-dev", "shopxo/shopxo": "<2.2.6", "showdoc/showdoc": "<2.10.4", - "silverstripe/admin": ">=1,<1.11.3", + "silverstripe-australia/advancedreports": ">=1,<=2", + "silverstripe/admin": "<1.13.19|>=2,<2.1.8", "silverstripe/assets": ">=1,<1.11.1", "silverstripe/cms": "<4.11.3", - "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", + "silverstripe/comments": ">=1.3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": "<4.11.14", - "silverstripe/graphql": "<3.5.2|>=4-alpha.1,<4-alpha.2|= 4.0.0-alpha1", + "silverstripe/framework": "<4.13.39|>=5,<5.1.11", + "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.8.2|>=4,<4.3.7|>=5,<5.1.3", "silverstripe/hybridsessions": ">=1,<2.4.1|>=2.5,<2.5.1", + "silverstripe/recipe-cms": ">=4.5,<4.5.3", "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", - "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", + "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4|>=2.1,<2.1.2", "silverstripe/silverstripe-omnipay": "<2.5.2|>=3,<3.0.2|>=3.1,<3.1.4|>=3.2,<3.2.1", "silverstripe/subsites": ">=2,<2.6.1", "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", - "silverstripe/userforms": "<3", + "silverstripe/userforms": "<3|>=5,<5.4.2", "silverstripe/versioned-admin": ">=1,<1.11.1", "simple-updates/phpwhois": "<=1", - "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", + "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4|==5.0.0.0-alpha12", "simplesamlphp/simplesamlphp": "<1.18.6", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "simplesamlphp/simplesamlphp-module-openid": "<1", "simplesamlphp/simplesamlphp-module-openidprovider": "<0.9", + "simplesamlphp/xml-security": "==1.6.11", "simplito/elliptic-php": "<1.0.6", + "sitegeist/fluid-components": "<3.5", + "sjbr/sr-freecap": "<2.4.6|>=2.5,<2.5.3", + "slim/psr7": "<1.4.1|>=1.5,<1.5.1|>=1.6,<1.6.1", "slim/slim": "<2.6", - "smarty/smarty": "<3.1.47|>=4,<4.2.1", - "snipe/snipe-it": "<=6.0.14|>= 6.0.0-RC-1, <= 6.0.0-RC-5", + "slub/slub-events": "<3.0.3", + "smarty/smarty": "<4.5.3|>=5,<5.1.1", + "snipe/snipe-it": "<=6.2.2", "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", "spatie/browsershot": "<3.57.4", - "spipu/html2pdf": "<5.2.4", + "spatie/image-optimizer": "<1.7.3", + "spipu/html2pdf": "<5.2.8", + "spoon/library": "<1.4.1", "spoonity/tcpdf": "<6.2.22", "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", - "ssddanbrown/bookstack": "<22.2.3", - "statamic/cms": "<3.2.39|>=3.3,<3.3.2", - "stormpath/sdk": ">=0,<9.9.99", - "studio-42/elfinder": "<2.1.59", - "subrion/cms": "<=4.2.1", + "ssddanbrown/bookstack": "<22.02.3", + "statamic/cms": "<4.46", + "stormpath/sdk": "<9.9.99", + "studio-42/elfinder": "<2.1.62", + "subhh/libconnect": "<7.0.8|>=8,<8.1", "sukohi/surpass": "<1", - "sulu/sulu": "= 2.4.0-RC1|<1.6.44|>=2,<2.2.18|>=2.3,<2.3.8", + "sulu/sulu": "<1.6.44|>=2,<2.4.17|>=2.5,<2.5.13", "sumocoders/framework-user-bundle": "<1.4", + "superbig/craft-audit": "<3.0.2", "swag/paypal": "<5.4.4", - "swiftmailer/swiftmailer": ">=4,<5.4.5", + "swiftmailer/swiftmailer": "<6.2.5", + "swiftyedit/swiftyedit": "<1.2", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", - "sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2", - "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", + "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", + "sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2|>=1.12.0.0-alpha1,<1.12.16|>=1.13.0.0-alpha1,<1.13.1", + "symbiote/silverstripe-multivaluefield": ">=3,<3.1", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-seed": "<6.0.3", "symbiote/silverstripe-versionedfiles": "<=2.0.3", @@ -3757,7 +3623,7 @@ "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4", "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", - "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=5.3.14,<=5.3.14|>=5.4.3,<=5.4.3|>=6.0.3,<=6.0.3|= 6.0.3|= 5.4.3|= 5.3.14", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=5.3.14,<5.3.15|>=5.4.3,<5.4.4|>=6.0.3,<6.0.4", "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", "symfony/http-kernel": ">=2,<4.4.50|>=5,<5.4.20|>=6,<6.0.20|>=6.1,<6.1.12|>=6.2,<6.2.6", "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", @@ -3773,76 +3639,113 @@ "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.9", "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-guard": ">=2.8,<3.4.48|>=4,<4.4.23|>=5,<5.2.8", - "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7|>=5.1,<5.2.8|>=5.3,<5.3.2", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7|>=5.1,<5.2.8|>=5.3,<5.3.2|>=5.4,<5.4.31|>=6,<6.3.8", "symfony/serializer": ">=2,<2.0.11|>=4.1,<4.4.35|>=5,<5.3.12", - "symfony/symfony": ">=2,<4.4.50|>=5,<5.4.20|>=6,<6.0.20|>=6.1,<6.1.12|>=6.2,<6.2.6", + "symfony/symfony": ">=2,<4.4.51|>=5,<5.4.31|>=6,<6.3.8", "symfony/translation": ">=2,<2.0.17", + "symfony/twig-bridge": ">=2,<4.4.51|>=5,<5.4.31|>=6,<6.3.8", + "symfony/ux-autocomplete": "<2.11.2", "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", - "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", - "t3/dce": ">=2.2,<2.6.2", + "symfony/webhook": ">=6.3,<6.3.8", + "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7|>=2.2.0.0-beta1,<2.2.0.0-beta2", + "symphonycms/symphony-2": "<2.6.4", + "t3/dce": "<0.11.5|>=2.2,<2.6.2", "t3g/svg-sanitizer": "<1.0.3", + "t3s/content-consent": "<1.0.3|>=2,<2.0.2", "tastyigniter/tastyigniter": "<3.3", - "tecnickcom/tcpdf": "<6.2.22", + "tcg/voyager": "<=1.4", + "tecnickcom/tcpdf": "<=6.7.4", "terminal42/contao-tablelookupwizard": "<3.3.5", "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1-beta.1,<2.1.3", + "thelia/thelia": ">=2.1,<2.1.3", "theonedemon/phpwhois": "<=4.2.5", - "thinkcmf/thinkcmf": "<=5.1.7", - "thorsten/phpmyfaq": "<3.1.11", - "tinymce/tinymce": "<5.10.7|>=6,<6.3.1", + "thinkcmf/thinkcmf": "<6.0.8", + "thorsten/phpmyfaq": "<3.2.2", + "tikiwiki/tiki-manager": "<=17.1", + "timber/timber": ">=0.16.6,<1.23.1|>=1.24,<1.24.1|>=2,<2.1", + "tinymce/tinymce": "<7", "tinymighty/wiki-seo": "<1.2.2", - "titon/framework": ">=0,<9.9.99", - "tobiasbg/tablepress": "<= 2.0-RC1", - "topthink/framework": "<6.0.14", + "titon/framework": "<9.9.99", + "tobiasbg/tablepress": "<=2.0.0.0-RC1", + "topthink/framework": "<6.0.17|>=6.1,<6.1.5|>=8,<8.0.4", "topthink/think": "<=6.1.1", "topthink/thinkphp": "<=3.2.3", - "tribalsystems/zenario": "<=9.3.57595", + "torrentpier/torrentpier": "<=2.4.1", + "tpwd/ke_search": "<4.0.3|>=4.1,<4.6.6|>=5,<5.0.2", + "tribalsystems/zenario": "<9.5.60602", "truckersmp/phpwhois": "<=4.3.1", "ttskch/pagination-service-provider": "<1", "twig/twig": "<1.44.7|>=2,<2.15.3|>=3,<3.4.3", - "typo3/cms": "<2.0.5|>=3,<3.0.3|>=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", - "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", - "typo3/cms-core": "<8.7.51|>=9,<9.5.40|>=10,<10.4.36|>=11,<11.5.23|>=12,<12.2", + "typo3/cms": "<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", + "typo3/cms-backend": "<4.1.14|>=4.2,<4.2.15|>=4.3,<4.3.7|>=4.4,<4.4.4|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/cms-core": "<=8.7.56|>=9,<=9.5.47|>=10,<=10.4.44|>=11,<=11.5.36|>=12,<=12.4.14|>=13,<=13.1", + "typo3/cms-extbase": "<6.2.24|>=7,<7.6.8|==8.1.1", + "typo3/cms-fluid": "<4.3.4|>=4.4,<4.4.1", "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/cms-frontend": "<4.3.9|>=4.4,<4.4.5", + "typo3/cms-install": "<4.1.14|>=4.2,<4.2.16|>=4.3,<4.3.9|>=4.4,<4.4.5|>=12.2,<12.4.8", + "typo3/cms-rte-ckeditor": ">=9.5,<9.5.42|>=10,<10.4.39|>=11,<11.5.30", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", - "typo3/html-sanitizer": ">=1,<1.5|>=2,<2.1.1", + "typo3/html-sanitizer": ">=1,<=1.5.2|>=2,<=2.1.3", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.3.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", "typo3/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", "ua-parser/uap-php": "<3.8", - "unisharp/laravel-filemanager": "<=2.5.1", + "uasoft-indonesia/badaso": "<=2.9.7", + "unisharp/laravel-filemanager": "<2.6.4", "userfrosting/userfrosting": ">=0.3.1,<4.6.3", "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", + "uvdesk/community-skeleton": "<=1.1.1", + "uvdesk/core-framework": "<=1.1.1", "vanilla/safecurl": "<0.9.2", - "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", + "verbb/comments": "<1.5.5", + "verbb/formie": "<2.1.6", + "verbb/image-resizer": "<2.0.9", + "verbb/knock-knock": "<1.2.8", + "verot/class.upload.php": "<=2.1.6", + "villagedefrance/opencart-overclocked": "<=1.11.1", "vova07/yii2-fileapi-widget": "<0.1.9", "vrana/adminer": "<4.8.1", + "vufind/vufind": ">=2,<9.1.1", + "waldhacker/hcaptcha": "<2.1.2", "wallabag/tcpdf": "<6.2.22", - "wallabag/wallabag": "<2.5.4", + "wallabag/wallabag": "<2.6.7", "wanglelecc/laracms": "<=1.0.3", "web-auth/webauthn-framework": ">=3.3,<3.3.4", + "web-feet/coastercms": "==5.5", "webbuilders-group/silverstripe-kapost-bridge": "<0.4", "webcoast/deferred-image-processing": "<1.0.2", + "webklex/laravel-imap": "<5.3", + "webklex/php-imap": "<5.3", "webpa/webpa": "<3.1.2", + "wikibase/wikibase": "<=1.39.3", "wikimedia/parsoid": "<0.12.2", "willdurand/js-translation-bundle": "<2.1.1", - "wintercms/winter": "<1.0.475|>=1.1,<1.1.10|>=1.2,<1.2.1", + "winter/wn-backend-module": "<1.2.4", + "winter/wn-dusk-plugin": "<2.1", + "winter/wn-system-module": "<1.2.4", + "wintercms/winter": "<=1.2.3", "woocommerce/woocommerce": "<6.6", - "wp-cli/wp-cli": "<2.5", - "wp-graphql/wp-graphql": "<0.3.5", + "wp-cli/wp-cli": ">=0.12,<2.5", + "wp-graphql/wp-graphql": "<=1.14.5", + "wp-premium/gravityforms": "<2.4.21", "wpanel/wpanel4-cms": "<=4.3.1", - "wwbn/avideo": "<12.4", + "wpcloud/wp-stateless": "<3.2", + "wpglobus/wpglobus": "<=1.9.6", + "wwbn/avideo": "<14.3", "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", + "yab/quarx": "<2.4.5", "yeswiki/yeswiki": "<4.1", "yetiforce/yetiforce-crm": "<=6.4", "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", - "yiisoft/yii": "<1.1.27", + "yiisoft/yii": "<1.1.29", "yiisoft/yii2": "<2.0.38", + "yiisoft/yii2-authclient": "<2.2.15", "yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-dev": "<2.0.43", "yiisoft/yii2-elasticsearch": "<2.0.5", @@ -3852,11 +3755,13 @@ "yikesinc/yikes-inc-easy-mailchimp-extender": "<6.8.6", "yoast-seo-for-typo3/yoast_seo": "<7.2.3", "yourls/yourls": "<=1.8.2", + "yuan1994/tpadmin": "<=1.3.12", + "zencart/zencart": "<=1.5.7.0-beta", "zendesk/zendesk_api_client_php": "<2.2.11", "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", - "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-db": "<2.2.10|>=2.3,<2.3.5", "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", "zendframework/zend-diactoros": "<1.8.4", "zendframework/zend-feed": "<2.10.3", @@ -3864,7 +3769,7 @@ "zendframework/zend-http": "<2.8.1", "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", - "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", + "zendframework/zend-mail": "<2.4.11|>=2.5,<2.7.2", "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", "zendframework/zend-validator": ">=2.3,<2.3.6", @@ -3872,13 +3777,22 @@ "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", "zendframework/zendframework": "<=3", "zendframework/zendframework1": "<1.12.20", - "zendframework/zendopenid": ">=2,<2.0.2", + "zendframework/zendopenid": "<2.0.2", + "zendframework/zendrest": "<2.0.2", + "zendframework/zendservice-amazon": "<2.0.3", + "zendframework/zendservice-api": "<1", + "zendframework/zendservice-audioscrobbler": "<2.0.2", + "zendframework/zendservice-nirvanix": "<2.0.2", + "zendframework/zendservice-slideshare": "<2.0.2", + "zendframework/zendservice-technorati": "<2.0.2", + "zendframework/zendservice-windowsazure": "<2.0.2", "zendframework/zendxml": ">=1,<1.0.1", + "zenstruck/collection": "<0.2.1", "zetacomponents/mail": "<1.8.2", "zf-commons/zfc-user": "<1.2.2", "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", "zfr/zfr-oauth2-server-module": "<0.1.2", - "zoujingli/thinkadmin": "<6.0.22" + "zoujingli/thinkadmin": "<=6.1.53" }, "default-branch": true, "type": "metapackage", @@ -3899,6 +3813,9 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", + "keywords": [ + "dev" + ], "support": { "issues": "https://github.com/Roave/SecurityAdvisories/issues", "source": "https://github.com/Roave/SecurityAdvisories/tree/latest" @@ -3913,32 +3830,32 @@ "type": "tidelift" } ], - "time": "2023-02-17T21:04:14+00:00" + "time": "2024-05-29T19:04:21+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -3961,7 +3878,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" }, "funding": [ { @@ -3969,32 +3887,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T07:12:49+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -4017,7 +3935,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -4025,32 +3943,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -4072,7 +3990,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -4080,34 +3998,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4146,7 +4066,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -4154,33 +4075,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -4203,7 +4124,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -4211,33 +4133,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -4269,7 +4191,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -4277,27 +4200,27 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-03-02T07:15:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -4305,7 +4228,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -4324,7 +4247,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -4332,7 +4255,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" }, "funding": [ { @@ -4340,34 +4264,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-03-23T08:47:14+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -4409,7 +4333,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" }, "funding": [ { @@ -4417,38 +4342,35 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T07:17:12+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -4467,13 +4389,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" }, "funding": [ { @@ -4481,33 +4404,33 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2024-03-02T07:19:19+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -4530,7 +4453,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -4538,34 +4462,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4587,7 +4511,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -4595,32 +4519,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -4642,7 +4566,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -4650,32 +4574,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4705,62 +4629,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -4768,32 +4637,32 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4816,7 +4685,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -4824,29 +4693,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4869,7 +4738,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -4877,20 +4746,20 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -4919,7 +4788,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -4927,7 +4796,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "webmozart/assert", diff --git a/framework_src/Assertion/AbstractAsyncAssertion.php b/framework_src/Assertion/AbstractAsyncAssertion.php deleted file mode 100644 index 9eb9287..0000000 --- a/framework_src/Assertion/AbstractAsyncAssertion.php +++ /dev/null @@ -1,25 +0,0 @@ - $this->actual); - $assertion = $this->getAssertion($actual); - return $assertion->assert(); - }); - } - - abstract protected function getAssertion(mixed $resolvedActual) : Assertion; -} \ No newline at end of file diff --git a/framework_src/Assertion/AsyncAssertArrayEquals.php b/framework_src/Assertion/AsyncAssertArrayEquals.php deleted file mode 100644 index 08c7886..0000000 --- a/framework_src/Assertion/AsyncAssertArrayEquals.php +++ /dev/null @@ -1,20 +0,0 @@ -expected, $resolvedActual); - } -} \ No newline at end of file diff --git a/framework_src/Assertion/AsyncAssertCountEquals.php b/framework_src/Assertion/AsyncAssertCountEquals.php deleted file mode 100644 index 9641b82..0000000 --- a/framework_src/Assertion/AsyncAssertCountEquals.php +++ /dev/null @@ -1,19 +0,0 @@ -expected, $resolvedActual); - } -} \ No newline at end of file diff --git a/framework_src/Assertion/AsyncAssertFloatEquals.php b/framework_src/Assertion/AsyncAssertFloatEquals.php deleted file mode 100644 index 9e32ac8..0000000 --- a/framework_src/Assertion/AsyncAssertFloatEquals.php +++ /dev/null @@ -1,19 +0,0 @@ -expected, $actual); - } -} \ No newline at end of file diff --git a/framework_src/Assertion/AsyncAssertInstanceOf.php b/framework_src/Assertion/AsyncAssertInstanceOf.php deleted file mode 100644 index 7caa768..0000000 --- a/framework_src/Assertion/AsyncAssertInstanceOf.php +++ /dev/null @@ -1,27 +0,0 @@ -expected, $resolvedActual); - } -} \ No newline at end of file diff --git a/framework_src/Assertion/AsyncAssertIntEquals.php b/framework_src/Assertion/AsyncAssertIntEquals.php deleted file mode 100644 index 978a5c1..0000000 --- a/framework_src/Assertion/AsyncAssertIntEquals.php +++ /dev/null @@ -1,19 +0,0 @@ -expected, $actual); - } -} \ No newline at end of file diff --git a/framework_src/Assertion/AsyncAssertIsEmpty.php b/framework_src/Assertion/AsyncAssertIsEmpty.php deleted file mode 100644 index e87a0fa..0000000 --- a/framework_src/Assertion/AsyncAssertIsEmpty.php +++ /dev/null @@ -1,14 +0,0 @@ -expected, $resolvedActual); - } -} \ No newline at end of file diff --git a/framework_src/AsyncAssertion.php b/framework_src/AsyncAssertion.php deleted file mode 100644 index 7eb0cc6..0000000 --- a/framework_src/AsyncAssertion.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - public function assert() : Promise; - -} \ No newline at end of file diff --git a/framework_src/AsyncUnitApplication.php b/framework_src/AsyncUnitApplication.php deleted file mode 100644 index ba954fc..0000000 --- a/framework_src/AsyncUnitApplication.php +++ /dev/null @@ -1,99 +0,0 @@ -pluginManager = $pluggable; - $this->configurationFactory = $configurationFactory; - $this->configurationValidator = $configurationValidator; - $this->parser = $parser; - $this->testSuiteRunner = $testSuiteRunner; - $this->configFilePath = $configFilePath; - } - - protected function doStart() : Promise { - return call(function() { - /** @var Configuration $configuration */ - $configuration = yield $this->configurationFactory->make($this->configFilePath); - yield $this->validateConfiguration($configuration); - $parserResults = yield $this->parser->parse($configuration->getTestDirectories()); - - gc_collect_cycles(); - - yield $this->loadDynamicPlugins($configuration, $parserResults); - - $this->testSuiteRunner->setMockBridgeClass($configuration->getMockBridge()); - - yield $this->testSuiteRunner->runTestSuites($parserResults); - }); - } - - private function validateConfiguration(Configuration $configuration) : Promise { - return call(function() use($configuration) { - /** @var ConfigurationValidationResults $validationResults */ - $validationResults = yield $this->configurationValidator->validate($configuration); - if (!$validationResults->isValid()) { - $firstLine = sprintf( - "The configuration at path \"%s\" has the following errors:\n\n", - $this->configFilePath - ); - $errorMessages = []; - foreach ($validationResults->getValidationErrors() as $messages) { - $errorMessages = array_merge( - $errorMessages, - array_map(fn(string $msg) => "- $msg", $messages) - ); - } - $errorList = join( - PHP_EOL, - $errorMessages - ); - $lastLine = "\n\nPlease fix the errors listed above and try running your tests again."; - - throw new InvalidConfigurationException(sprintf('%s%s%s', $firstLine, $errorList, $lastLine)); - } - }); - } - - private function loadDynamicPlugins(Configuration $configuration, ParserResult $parserResults) : Promise { - return call(function() use($configuration, $parserResults) { - // This absolutely no good ugly hack is going to be necessary until Labrador Core has support for dynamic Plugin loading - // Please see https://github.com/labrador-kennel/core/issues/110 - $reflectedPluginManager = new ReflectionObject($this->pluginManager); - $loadPlugin = $reflectedPluginManager->getMethod('loadPlugin'); - $loadPlugin->setAccessible(true); - - yield $loadPlugin->invoke($this->pluginManager, $configuration->getResultPrinter()); - }); - } - - -} \ No newline at end of file diff --git a/framework_src/AsyncUnitApplicationObjectGraph.php b/framework_src/AsyncUnitApplicationObjectGraph.php deleted file mode 100644 index cb06c04..0000000 --- a/framework_src/AsyncUnitApplicationObjectGraph.php +++ /dev/null @@ -1,61 +0,0 @@ -newInstanceWithoutConstructor(); - $injector->share($customAssertionContext); - - $injector->share(StaticAnalysisParser::class); - $injector->alias(Parser::class, StaticAnalysisParser::class); - $injector->share(TestSuiteRunner::class); - $injector->share(new ShuffleRandomizer()); - $injector->alias(Randomizer::class, ShuffleRandomizer::class); - $injector->share(ConfigurationValidator::class); - $injector->alias(ConfigurationValidator::class, AsyncUnitConfigurationValidator::class); - $injector->share($this->configurationFactory); - $injector->alias(ConfigurationFactory::class, get_class($this->configurationFactory)); - $mockBridgeFactory = $this->mockBridgeFactory ?? new SupportedMockBridgeFactory($injector); - $injector->share($mockBridgeFactory); - $injector->alias(MockBridgeFactory::class, get_class($mockBridgeFactory)); - - $injector->share(Application::class); - $injector->alias(Application::class, AsyncUnitApplication::class); - $injector->define(AsyncUnitApplication::class, [':configFilePath' => $this->configFilePath]); - $injector->prepare(Application::class, function(Application $application) use($injector) { - $application->registerPluginLoadHandler(CustomAssertionPlugin::class, function(CustomAssertionPlugin $plugin) use($injector) { - yield $injector->execute([$plugin, 'registerCustomAssertions']); - }); - $application->registerPluginLoadHandler(ResultPrinterPlugin::class, function(ResultPrinterPlugin $resultPrinterPlugin) use($injector) { - $injector->execute([$resultPrinterPlugin, 'registerEvents'], [':output' => $this->testResultOutput]); - }); - }); - - return $injector; - } -} \ No newline at end of file diff --git a/framework_src/AsyncUnitConfigurationValidator.php b/framework_src/AsyncUnitConfigurationValidator.php deleted file mode 100644 index 7e12438..0000000 --- a/framework_src/AsyncUnitConfigurationValidator.php +++ /dev/null @@ -1,63 +0,0 @@ -filesystem = filesystem(); - } - - public function validate(Configuration $configuration): Promise { - return call(function() use($configuration) { - $errors = []; - - yield from $this->validateTestDirectories($configuration, $errors); - $this->validateResultPrinterClass($configuration, $errors); - return new ConfigurationValidationResults($errors); - }); - } - - private function validateTestDirectories(Configuration $configuration, array &$errors) : Generator { - $testDirs = $configuration->getTestDirectories(); - if (empty($testDirs)) { - $errors['testDirectories'] = ['Must provide at least one directory to scan but none were provided.']; - } else { - foreach ($testDirs as $testDir) { - if (!yield $this->filesystem->isdir($testDir)) { - if (!isset($errors['testDirectories'])) { - $errors['testDirectories'] = []; - } - $errors['testDirectories'][] = sprintf( - 'A configured directory to scan, "%s", is not a directory.', - $testDir - ); - } - } - } - } - - private function validateResultPrinterClass(Configuration $configuration, array &$errors) : void { - $resultPrinterClass = $configuration->getResultPrinter(); - if (!class_exists($resultPrinterClass)) { - $errors['resultPrinter'] = [sprintf( - 'The result printer "%s" is not a class that can be found. Please ensure this class is configured to be autoloaded through Composer.', - $resultPrinterClass - )]; - } else if (!in_array(ResultPrinterPlugin::class, class_implements($resultPrinterClass))) { - $errors['resultPrinter'] = [sprintf( - 'The result printer "%s" is not a %s. Please ensure your result printer implements this interface.', - $resultPrinterClass, - ResultPrinterPlugin::class - )]; - } - } -} \ No newline at end of file diff --git a/framework_src/AsyncUnitFrameworkRunner.php b/framework_src/AsyncUnitFrameworkRunner.php deleted file mode 100644 index 3dfd21d..0000000 --- a/framework_src/AsyncUnitFrameworkRunner.php +++ /dev/null @@ -1,50 +0,0 @@ -environment, - $this->logger, - $this->configurationFactory, - $this->testResultOutput, - $configFile, - $this->mockBridgeFactory - ))->wireObjectGraph(); - - $emitter = $injector->make(EventEmitter::class); - $hasFailedTests = false; - $emitter->once(Events::PROCESSING_FINISHED, function(ProcessingFinishedEvent $event) use(&$hasFailedTests) { - $hasFailedTests = $event->getTarget()->getFailedTestCount() !== 0; - }); - - $injector->execute(Engine::class . '::run'); - return !$hasFailedTests; - } - -} \ No newline at end of file diff --git a/framework_src/Attribute/AfterAll.php b/framework_src/Attribute/AfterAll.php deleted file mode 100644 index d4b6a1b..0000000 --- a/framework_src/Attribute/AfterAll.php +++ /dev/null @@ -1,13 +0,0 @@ - - */ - public function make(string $path) : Promise; - -} \ No newline at end of file diff --git a/framework_src/ConfigurationValidator.php b/framework_src/ConfigurationValidator.php deleted file mode 100644 index 3db3180..0000000 --- a/framework_src/ConfigurationValidator.php +++ /dev/null @@ -1,11 +0,0 @@ -count += $assertionCount; - } - - public function arrayEquals(array $expected, array $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertArrayEquals($expected, $actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function floatEquals(float $expected, float $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertFloatEquals($expected, $actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function intEquals(int $expected, int $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertIntEquals($expected, $actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function stringEquals(string $expected, string $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertStringEquals($expected, $actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function countEquals(int $expected, array|Countable $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertCountEquals($expected, $actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function instanceOf(string|object $expected, object $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $assert = new AssertInstanceOf($expected, $actual); - $results = $assert->assert(); - $this->handleAssertionResults($results, $isNot, $message); - } - - public function isEmpty(mixed $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertIsEmpty($actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function isTrue(bool $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertIsTrue($actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function isFalse(bool $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertIsFalse($actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function isNull(mixed $actual, string $message = null) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $assert = new AssertIsNull($actual); - $results = $assert->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - } - - public function __call(string $methodName, array $args) : void { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $results = $this->customAssertionContext->createAssertion($methodName, ...$args)->assert(); - - $this->handleAssertionResults($results, $isNot, null); - } - -} \ No newline at end of file diff --git a/framework_src/Context/AsyncAssertionContext.php b/framework_src/Context/AsyncAssertionContext.php deleted file mode 100644 index 16cb033..0000000 --- a/framework_src/Context/AsyncAssertionContext.php +++ /dev/null @@ -1,139 +0,0 @@ -isNot; - $this->invokedAssertionContext(); - - $results = yield (new AsyncAssertArrayEquals($expected, $actual))->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function floatEquals(float $expected, Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($expected, $actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $results = yield (new AsyncAssertFloatEquals($expected, $actual))->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function intEquals(int $expected, Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($expected, $actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - - $results = yield (new AsyncAssertIntEquals($expected, $actual))->assert(); - - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - /** - * Compare that an $actual string resolved from a promisor is equal to $expected. - * - * @param string $expected - * @param Promise|Generator|Coroutine $actual - * @param string|null $message - * @return Promise - */ - public function stringEquals(string $expected, Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($expected, $actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertStringEquals($expected, $actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function countEquals(int $expected, Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($expected, $actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertCountEquals($expected, $actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function instanceOf(string $expected, Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($expected, $actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertInstanceOf($expected, $actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function isTrue(Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertIsTrue($actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function isFalse(Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertIsFalse($actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function isNull(Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function () use($actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertIsNull($actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function isEmpty(Promise|Generator|Coroutine $actual, string $message = null) : Promise { - return call(function() use($actual, $message) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield (new AsyncAssertIsEmpty($actual))->assert(); - $this->handleAssertionResults($results, $isNot, $message); - }); - } - - public function __call(string $methodName, array $args) : Promise { - return call(function() use($methodName, $args) { - $isNot = $this->isNot; - $this->invokedAssertionContext(); - $results = yield $this->customAssertionContext->createAsyncAssertion($methodName, ...$args)->assert(); - $this->handleAssertionResults($results, $isNot, null); - }); - } -} \ No newline at end of file diff --git a/framework_src/Context/CustomAssertionContext.php b/framework_src/Context/CustomAssertionContext.php deleted file mode 100644 index d51f9da..0000000 --- a/framework_src/Context/CustomAssertionContext.php +++ /dev/null @@ -1,92 +0,0 @@ -ensureValidMethodName($methodName, 'assertion'); - $this->assertions[$methodName] = $assertionFactory; - } - - public function hasRegisteredAssertion(string $methodName) : bool { - return array_key_exists($methodName, $this->assertions); - } - - public function createAssertion(string $methodName, mixed ...$args) : Assertion { - if (!$this->hasRegisteredAssertion($methodName)) { - throw new InvalidArgumentException(sprintf( - 'There is no custom assertion registered for "%s".', - $methodName - )); - } - $assertion = $this->assertions[$methodName](...$args); - if (!$assertion instanceof Assertion) { - $msg = sprintf( - 'The factory for custom assertion "%s" must return an instance of %s', - $methodName, - Assertion::class - ); - throw new InvalidStateException($msg); - } - return $assertion; - } - - public function registerAsyncAssertion(string $methodName, callable $asyncAssertionFactory) : void { - $this->ensureValidMethodName($methodName, 'async assertion'); - $this->asyncAssertions[$methodName] = $asyncAssertionFactory; - } - - public function hasRegisteredAsyncAssertion(string $methodName) : bool { - return array_key_exists($methodName, $this->asyncAssertions); - } - - public function createAsyncAssertion(string $methodName, mixed ...$args) : AsyncAssertion { - if (!$this->hasRegisteredAsyncAssertion($methodName)) { - throw new InvalidArgumentException(sprintf( - 'There is no custom async assertion registered for "%s".', - $methodName - )); - } - $assertion = $this->asyncAssertions[$methodName](...$args); - if (!$assertion instanceof AsyncAssertion) { - $msg = sprintf( - 'The factory for custom async assertion "%s" must return an instance of %s', - $methodName, - AsyncAssertion::class - ); - throw new InvalidStateException($msg); - } - return $assertion; - } - - private function ensureValidMethodName(string $methodName, string $assertionType) : void { - if (!preg_match(self::VALID_METHOD_NAME_REGEX, $methodName)) { - $msg = sprintf( - 'A registered custom %s must have a valid method name but "%s" was provided', - $assertionType, - $methodName - ); - throw new InvalidArgumentException($msg); - } - } - - -} \ No newline at end of file diff --git a/framework_src/Context/LastAssertionCalledTrait.php b/framework_src/Context/LastAssertionCalledTrait.php deleted file mode 100644 index 31090bc..0000000 --- a/framework_src/Context/LastAssertionCalledTrait.php +++ /dev/null @@ -1,30 +0,0 @@ -lastAssertionFile = $file; - } - - public function getLastAssertionFile() : ?string { - return $this->lastAssertionFile; - } - - public function setLastAssertionLine(int $line) : void { - $this->lastAssertionLine = $line; - } - - public function getLastAssertionLine() : int { - return $this->lastAssertionLine; - } - -} \ No newline at end of file diff --git a/framework_src/Context/SharedAssertionContextTrait.php b/framework_src/Context/SharedAssertionContextTrait.php deleted file mode 100644 index 2bf48c5..0000000 --- a/framework_src/Context/SharedAssertionContextTrait.php +++ /dev/null @@ -1,43 +0,0 @@ -count; - } - - public function not() : self { - $this->isNot = true; - return $this; - } - - private function getDefaultFailureMessage(string $assertionString) : string { - return sprintf("Failed %s", $assertionString); - } - - private function invokedAssertionContext() : void { - $this->count++; - $this->isNot = false; - } - - private function handleAssertionResults(AssertionResult $result, bool $isNot, ?string $customMessage) { - if (($isNot && $result->isSuccessful()) || (!$isNot && !$result->isSuccessful())) { - throw new AssertionFailedException( - $customMessage ?? $this->getDefaultFailureMessage($isNot ? $result->getSummary()->toNotString() : $result->getSummary()->toString()), - $this->getDefaultFailureMessage($isNot ? $result->getDetails()->toNotString() : $result->getDetails()->toString()), - $this->getLastAssertionFile(), - $this->getLastAssertionLine() - ); - } - } - -} \ No newline at end of file diff --git a/framework_src/CustomAssertionPlugin.php b/framework_src/CustomAssertionPlugin.php deleted file mode 100644 index 312b208..0000000 --- a/framework_src/CustomAssertionPlugin.php +++ /dev/null @@ -1,17 +0,0 @@ -validator = new Validator(); - $this->validator->resolver()->registerFile( - 'https://labrador-kennel.io/dev/async-unit/schema/cli-config.json', - dirname(__DIR__) . '/resources/schema/cli-config.json' - ); - $schema = $this->validator->loader()->loadSchemaById( - Uri::parse('https://labrador-kennel.io/dev/async-unit/schema/cli-config.json') - ); - if (is_null($schema)) { - throw new InvalidConfigurationException('Could not locate the schema for validating CLI configurations'); - } - $this->schema = $schema; - $this->filesystem = filesystem(); - } - - public function make(string $configFile) : Promise { - return call(function() use($configFile) { - $contents = yield $this->filesystem->get($configFile); - $configJson = json_decode($contents); - $results = $this->validator->validate($configJson, $this->schema); - if ($results->hasError()) { - $msg = sprintf( - 'The JSON file at "%s" does not adhere to the JSON Schema https://labrador-kennel.io/dev/async-unit/schema/cli-config.json', - $configFile - ); - throw new InvalidConfigurationException($msg); - } - - $absoluteTestDirs = []; - foreach ($configJson->testDirs as $testDir) { - $absoluteTestDirs[] = realpath($testDir); - } - $configJson->testDirs = $absoluteTestDirs; - - return new class($configJson) implements Configuration { - - public function __construct(private stdClass $config) {} - - public function getTestDirectories() : array { - return $this->config->testDirs; - } - - public function getPlugins() : array { - return $this->config->plugins ?? []; - } - - public function getResultPrinter(): string { - return $this->config->resultPrinter; - } - - public function getMockBridge(): ?string { - return $this->config->mockBridge ?? null; - } - }; - }); - } - -} \ No newline at end of file diff --git a/framework_src/Model/HookAware.php b/framework_src/Model/HookAware.php deleted file mode 100644 index a94c55e..0000000 --- a/framework_src/Model/HookAware.php +++ /dev/null @@ -1,28 +0,0 @@ -hooks[$hookType->toString()] ?? []; - } - - public function addHook(HookModel $hook) : void { - if (!isset($this->hooks[$hook->getType()->toString()])) { - $this->hooks[$hook->getType()->toString()] = []; - } - $this->hooks[$hook->getType()->toString()][] = $hook; - } - -} \ No newline at end of file diff --git a/framework_src/Model/PluginModel.php b/framework_src/Model/PluginModel.php deleted file mode 100644 index 3cd160b..0000000 --- a/framework_src/Model/PluginModel.php +++ /dev/null @@ -1,19 +0,0 @@ -pluginClass; - } - -} \ No newline at end of file diff --git a/framework_src/Parser/AsyncUnitModelNodeVisitor.php b/framework_src/Parser/AsyncUnitModelNodeVisitor.php deleted file mode 100644 index c73e975..0000000 --- a/framework_src/Parser/AsyncUnitModelNodeVisitor.php +++ /dev/null @@ -1,307 +0,0 @@ -namespacedName->toString(); - if (is_subclass_of($class, TestSuite::class)) { - $defaultTestSuiteAttribute = $this->findAttribute(DefaultTestSuite::class, ...$node->attrGroups); - $testSuiteModel = new TestSuiteModel($class, !is_null($defaultTestSuiteAttribute)); - if ($disabledAttribute = $this->findAttribute(Disabled::class, ...$node->attrGroups)) { - $reason = null; - if (count($disabledAttribute->args) === 1) { - // TODO Make sure that the disabled value is a string, otherwise throw an error - $reason = $disabledAttribute->args[0]->value->value; - } - $testSuiteModel->markDisabled($reason); - } - if ($timeoutAttribute = $this->findAttribute(Timeout::class, ...$node->attrGroups)) { - $testSuiteModel->setTimeout($timeoutAttribute->args[0]->value->value); - } - $this->collector->attachTestSuite($testSuiteModel); - } else if (is_subclass_of($class, TestCase::class)) { - if ($node->isAbstract()) { - return; - } - $testSuiteAttribute = $this->findAttribute(AttachToTestSuite::class, ...$node->attrGroups); - $testSuiteClassName = null; - if (!is_null($testSuiteAttribute)) { - // TODO Ensure that a string can be passed to AttachToTestSuite as well as ::class, any other type should throw error - $testSuiteClassName = $testSuiteAttribute->args[0]->value->class->toString(); - } - $testCaseModel = new TestCaseModel($class, $testSuiteClassName); - if ($disabledAttribute = $this->findAttribute(Disabled::class, ...$node->attrGroups)) { - $reason = null; - if (count($disabledAttribute->args) === 1) { - // TODO Make sure that the disabled value is a string, otherwise throw an error - $reason = $disabledAttribute->args[0]->value->value; - } - $testCaseModel->markDisabled($reason); - } - if ($timeoutAttribute = $this->findAttribute(Timeout::class, ...$node->attrGroups)) { - // TODO make sure we add more error checks around the presence of an argument and its value matching expected types - $testCaseModel->setTimeout($timeoutAttribute->args[0]->value->value); - } - - $this->collector->attachTestCase($testCaseModel); - } else { - foreach ($validPluginTypes as $validPluginType) { - if (is_subclass_of($class, $validPluginType)) { - $this->collector->attachPlugin(new PluginModel($class)); - } - } - } - } else if ($node instanceof Node\Stmt\ClassMethod) { - $this->collectIfHasAnyAsyncUnitAttribute($node); - } - } - - private function collectIfHasAnyAsyncUnitAttribute(Node\Stmt\ClassMethod $classMethod) : void { - $validAttributes = [ - Test::class => fn() => $this->validateTest($classMethod), - BeforeAll::class => fn(Node\Attribute $attribute) => $this->validateBeforeAll($attribute, $classMethod), - BeforeEach::class => fn(Node\Attribute $attribute) => $this->validateBeforeEach($attribute, $classMethod), - AfterAll::class => fn(Node\Attribute $attribute) => $this->validateAfterAll($attribute, $classMethod), - AfterEach::class => fn(Node\Attribute $attribute) => $this->validateAfterEach($attribute, $classMethod), - BeforeEachTest::class => fn(Node\Attribute $attribute) => $this->validateBeforeEachTest($attribute, $classMethod), - AfterEachTest::class => fn(Node\Attribute $attribute) => $this->validateAfterEachTest($attribute, $classMethod) - ]; - foreach ($validAttributes as $validAttribute => $validator) { - $attribute = $this->findAttribute($validAttribute, ...$classMethod->attrGroups); - if (!is_null($attribute)) { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - if (!class_exists($className)) { - $msg = sprintf( - 'Failure compiling %s. The class cannot be autoloaded. Please ensure your Composer autoloader settings have been configured correctly', - $className - ); - throw new TestCompilationException($msg); - } - $validator($attribute); - } - } - } - - private function validateTest(Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - if (!is_subclass_of($className, TestCase::class)) { - $msg = sprintf( - 'Failure compiling "%s". The method "%s" is annotated with #[Test] but this class does not extend "%s".', - $className, - $classMethod->name->toString(), - TestCase::class - ); - throw new TestCompilationException($msg); - } - - $testModel = new TestModel((string) $className, $classMethod->name->toString()); - if ($disabledAttribute = $this->findAttribute(Disabled::class, ...$classMethod->attrGroups)) { - $reason = null; - if (count($disabledAttribute->args) === 1) { - // TODO Make sure that the disabled value is a string, otherwise throw an error - $reason = $disabledAttribute->args[0]->value->value; - } - $testModel->markDisabled($reason); - } - $dataProviderAttribute = $this->findAttribute(DataProvider::class, ...$classMethod->attrGroups); - if (!is_null($dataProviderAttribute)) { - // TODO Make sure that the data provider value is a string, otherwise throw an error - $testModel->setDataProvider($dataProviderAttribute->args[0]->value->value); - } - if ($timeoutAttribute = $this->findAttribute(Timeout::class, ...$classMethod->attrGroups)) { - $value = $timeoutAttribute->args[0]->value->value; - $testModel->setTimeout($value); - } - - $this->collector->attachTest($testModel); - } - - private function validateBeforeEach(Node\Attribute $attribute, Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { - $msg = sprintf( - 'Failure compiling "%s". The method "%s" is annotated with #[BeforeEach] but this class does not extend "%s" or "%s".', - $className, - $classMethod->name->toString(), - TestSuite::class, - TestCase::class - ); - throw new TestCompilationException($msg); - } - - $this->collector->attachHook( - new HookModel( - (string) $className, - $classMethod->name->toString(), - HookType::BeforeEach(), - $this->getPriority($attribute) - ) - ); - } - - private function validateAfterEach(Node\Attribute $attribute, Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { - $msg = sprintf( - 'Failure compiling "%s". The method "%s" is annotated with #[AfterEach] but this class does not extend "%s" or "%s".', - $className, - $classMethod->name->toString(), - TestSuite::class, - TestCase::class - ); - throw new TestCompilationException($msg); - } - - $this->collector->attachHook( - new HookModel( - (string) $className, - $classMethod->name->toString(), - HookType::AfterEach(), - $this->getPriority($attribute) - ) - ); - } - - private function validateBeforeAll(Node\Attribute $attribute, Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { - $msg = sprintf( - 'Failure compiling "%s". The method "%s" is annotated with #[BeforeAll] but this class does not extend "%s" or "%s".', - $className, - $classMethod->name->toString(), - TestSuite::class, - TestCase::class - ); - throw new TestCompilationException($msg); - } else if (is_subclass_of($className, TestCase::class)) { - if (!$classMethod->isStatic()) { - $msg = sprintf( - 'Failure compiling "%s". The non-static method "%s" cannot be used as a #[BeforeAll] hook.', - $classMethod->getAttribute('parent')->namespacedName->toString(), - $classMethod->name->toString(), - ); - throw new TestCompilationException($msg); - } - } - - - $this->collector->attachHook( - new HookModel( - (string) $className, - $classMethod->name->toString(), - HookType::BeforeAll(), - $this->getPriority($attribute) - ) - ); - } - - private function validateAfterAll(Node\Attribute $attribute, Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { - $msg = sprintf( - 'Failure compiling "%s". The method "%s" is annotated with #[AfterAll] but this class does not extend "%s" or "%s".', - $className, - $classMethod->name->toString(), - TestSuite::class, - TestCase::class - ); - throw new TestCompilationException($msg); - } else if (is_subclass_of($className, TestCase::class)) { - if (!$classMethod->isStatic()) { - $msg = sprintf( - 'Failure compiling "%s". The non-static method "%s" cannot be used as a #[AfterAll] hook.', - $classMethod->getAttribute('parent')->namespacedName->toString(), - $classMethod->name->toString(), - ); - throw new TestCompilationException($msg); - } - } - - $this->collector->attachHook( - new HookModel( - $className, - $classMethod->name->toString(), - HookType::AfterAll(), - $this->getPriority($attribute) - ) - ); - } - - private function validateBeforeEachTest(Node\Attribute $attribute, Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - $this->collector->attachHook( - new HookModel( - $className, - $classMethod->name->toString(), - HookType::BeforeEachTest(), - $this->getPriority($attribute) - ) - ); - } - - private function validateAfterEachTest(Node\Attribute $attribute, Node\Stmt\ClassMethod $classMethod) : void { - $className = $classMethod->getAttribute('parent')->namespacedName->toString(); - $this->collector->attachHook( - new HookModel( - $className, - $classMethod->name->toString(), - HookType::AfterEachTest(), - $this->getPriority($attribute) - ) - ); - } - - private function getPriority(Node\Attribute $attribute) : int { - $priority = 0; - if (count($attribute->args) === 1) { - // TODO make sure this is an integer value - $priority = $attribute->args[0]->value->value; - } - - return $priority; - } -} \ No newline at end of file diff --git a/framework_src/Parser/Parser.php b/framework_src/Parser/Parser.php deleted file mode 100644 index 01bc639..0000000 --- a/framework_src/Parser/Parser.php +++ /dev/null @@ -1,15 +0,0 @@ - - */ - public function parse(array|string $dirs) : Promise; - -} \ No newline at end of file diff --git a/framework_src/Parser/StaticAnalysisParser.php b/framework_src/Parser/StaticAnalysisParser.php deleted file mode 100644 index e6ecc1b..0000000 --- a/framework_src/Parser/StaticAnalysisParser.php +++ /dev/null @@ -1,101 +0,0 @@ -phpParser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); - $this->nodeTraverser = new NodeTraverser(); - $this->filesystem = filesystem(); - } - - /** - * @param string|array $dirs - * @return Promise - */ - public function parse(string|array $dirs) : Promise { - return call(function() use($dirs) { - $dirs = is_string($dirs) ? [$dirs] : $dirs; - - $collector = new AsyncUnitModelCollector(); - $nodeConnectingVisitor = new NodeConnectingVisitor(); - $nameResolver = new NameResolver(); - $asyncUnitVisitor = new AsyncUnitModelNodeVisitor($collector); - - $this->nodeTraverser->addVisitor($nameResolver); - $this->nodeTraverser->addVisitor($nodeConnectingVisitor); - $this->nodeTraverser->addVisitor($asyncUnitVisitor); - - foreach ($dirs as $dir) { - yield $this->traverseDir($dir); - } - - if (!$collector->hasDefaultTestSuite()) { - $collector->attachTestSuite(new TestSuiteModel(ImplicitTestSuite::class, true)); - } - $collector->finishedCollection(); - - return new ParserResult($collector); - }); - } - - private function traverseDir(string $dir) : Promise { - return call(function() use($dir) { - $files = yield $this->filesystem->scandir($dir); - - foreach ($files as $fileOrDir) { - $fullPath = $dir . '/' . $fileOrDir; - if (yield $this->filesystem->isdir($fullPath)) { - yield $this->traverseDir($fullPath); - } else { - $pathFragments = explode(DIRECTORY_SEPARATOR, $fullPath); - $lastPathFragment = array_pop($pathFragments); - if (!strpos($lastPathFragment, '.')) { // intentionally treating 0 as false because a hidden file shouldn't be tested - continue; - } - $extension = strtolower(explode('.', $lastPathFragment, 2)[1]); - if ($extension !== 'php') { - continue; - } - /** @var File $handle */ - $handle = yield $this->filesystem->open($fullPath, 'r'); - $contents = yield (new Payload($handle))->buffer(); - $statements = $this->phpParser->parse($contents); - $this->nodeTraverser->traverse($statements); - yield $handle->close(); - unset($handle); - unset($contents); - } - } - }); - } - -} \ No newline at end of file diff --git a/framework_src/Prototype/AfterEachPrototype.php b/framework_src/Prototype/AfterEachPrototype.php deleted file mode 100644 index a66c98b..0000000 --- a/framework_src/Prototype/AfterEachPrototype.php +++ /dev/null @@ -1,21 +0,0 @@ -injector = $injector; - } - - public function make(string $mockBridgeClass): MockBridge { - return $this->injector->make($mockBridgeClass); - } - -} \ No newline at end of file diff --git a/framework_src/TestCase.php b/framework_src/TestCase.php deleted file mode 100644 index ec3b40c..0000000 --- a/framework_src/TestCase.php +++ /dev/null @@ -1,84 +0,0 @@ -testSuite; - } - - final public function getAssertionCount() : int { - return $this->assertionContext->getAssertionCount(); - } - - final public function getAsyncAssertionCount() : int { - return $this->asyncAssertionContext->getAssertionCount(); - } - - final protected function assert() : AssertionContext { - return $this->setAssertionFileAndLine($this->assertionContext, __FUNCTION__, debug_backtrace(10)); - } - - final protected function asyncAssert() : AsyncAssertionContext { - return $this->setAssertionFileAndLine($this->asyncAssertionContext, __FUNCTION__, debug_backtrace(10)); - } - - final protected function expect() : TestExpector { - return $this->expectationContext; - } - - final public function mocks() : MockBridge { - if (is_null($this->testMocker)) { - $msg = 'Attempted to create a mock but no MockBridge was defined. Please ensure you\'ve configured a mockBridge in your configuration.'; - throw new InvalidStateException($msg); - } - - return $this->testMocker; - } - - private function setAssertionFileAndLine(AssertionContext|AsyncAssertionContext $context, string $method, array $backtrace) : AssertionContext|AsyncAssertionContext { - foreach ($backtrace as $trace) { - if (!isset($trace['class']) && !isset($trace['function'])) { - continue; - } - if ($trace['class'] === self::class && $trace['function'] === $method) { - $context->setLastAssertionFile($trace['file']); - $context->setLastAssertionLine($trace['line']); - break; - } - } - return $context; - } - -} \ No newline at end of file diff --git a/framework_src/TestState.php b/framework_src/TestState.php deleted file mode 100644 index 25c0b2e..0000000 --- a/framework_src/TestState.php +++ /dev/null @@ -1,31 +0,0 @@ -mockBridgeClass = $mockBridge; - } - - public function runTestSuites(ParserResult $parserResult) : Promise { - return call(function() use($parserResult) { - yield $this->emitter->emit( - new ProcessingStartedEvent($parserResult->getAggregateSummary()) - ); - - $testSuiteModels = $this->randomizer->randomize($parserResult->getTestSuiteModels()); - - $aggregateSummaryBuilder = new ProcessedSummaryBuilder(); - $aggregateSummaryBuilder->startProcessing(); - - foreach ($testSuiteModels as $testSuiteModel) { - $testSuiteClass = $testSuiteModel->getClass(); - /** @var TestSuite $testSuite */ - $testSuite = (new ReflectionClass($testSuiteClass))->newInstanceWithoutConstructor(); - $testSuiteSummary = $parserResult->getTestSuiteSummary($testSuite::class); - yield $this->emitter->emit(new TestSuiteStartedEvent($testSuiteSummary)); - - $aggregateSummaryBuilder->startTestSuite($testSuiteModel); - if (!$testSuiteModel->isDisabled()) { - yield $this->invokeHooks($testSuite, $testSuiteModel, HookType::BeforeAll(), TestSuiteSetUpException::class); - } - - /** @var TestCaseModel[] $testCaseModels */ - $testCaseModels = $this->randomizer->randomize($testSuiteModel->getTestCaseModels()); - foreach ($testCaseModels as $testCaseModel) { - $testCaseSummary = $parserResult->getTestCaseSummary($testCaseModel->getClass()); - yield $this->emitter->emit(new TestCaseStartedEvent($testCaseSummary)); - - $aggregateSummaryBuilder->startTestCase($testCaseModel); - if (!$testSuiteModel->isDisabled()) { - yield $this->invokeHooks($testSuite, $testSuiteModel, HookType::BeforeEach(), TestSuiteSetUpException::class); - } - if (!$testCaseModel->isDisabled()) { - yield $this->invokeHooks($testCaseModel->getClass(), $testCaseModel, HookType::BeforeAll(), TestCaseSetUpException::class, [$testSuite]); - } - - $testMethodModels = $this->randomizer->randomize($testCaseModel->getTestModels()); - foreach ($testMethodModels as $testMethodModel) { - /** @var AssertionContext $assertionContext */ - /** @var AsyncAssertionContext $asyncAssertionContext */ - [ - $testCase, - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $mockBridge - ] = $this->invokeTestCaseConstructor($testCaseModel->getClass(), $testSuite, $testMethodModel); - if ($testMethodModel->getDataProvider() !== null) { - $dataProvider = $testMethodModel->getDataProvider(); - $dataSets = $testCase->$dataProvider(); - foreach ($dataSets as $label => $args) { - yield $this->invokeTest( - $aggregateSummaryBuilder, - $testCase, - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $mockBridge, - $testSuiteModel, - $testCaseModel, - $testMethodModel, - $args, - (string) $label // make sure 0-index array keys are treated as strings - ); - [ - $testCase, - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $mockBridge - ] = $this->invokeTestCaseConstructor($testCaseModel->getClass(), $testSuite, $testMethodModel); - } - } else { - yield $this->invokeTest( - $aggregateSummaryBuilder, - $testCase, - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $mockBridge, - $testSuiteModel, - $testCaseModel, - $testMethodModel - ); - } - } - - if (!$testCaseModel->isDisabled()) { - yield $this->invokeHooks($testCaseModel->getClass(), $testCaseModel, HookType::AfterAll(), TestCaseTearDownException::class, [$testSuite]); - } - if (!$testSuiteModel->isDisabled()) { - yield $this->invokeHooks($testSuite, $testSuiteModel, HookType::AfterEach(), TestSuiteTearDownException::class); - } - yield $this->emitter->emit(new TestCaseFinishedEvent($aggregateSummaryBuilder->finishTestCase($testCaseModel))); - ; - } - - if (!$testSuiteModel->isDisabled()) { - yield $this->invokeHooks($testSuite, $testSuiteModel, HookType::AfterAll(), TestSuiteTearDownException::class); - } - yield $this->emitter->emit(new TestSuiteFinishedEvent($aggregateSummaryBuilder->finishTestSuite($testSuiteModel))); - } - - - yield $this->emitter->emit( - new ProcessingFinishedEvent($aggregateSummaryBuilder->finishProcessing()) - ); - }); - } - - private function invokeHooks( - TestSuite|TestCase|string $hookTarget, - TestSuiteModel|TestCaseModel $model, - HookType $hookType, - string $exceptionType, - array $args = [] - ) : Promise { - return call(function() use($hookTarget, $model, $hookType, $exceptionType, $args) { - $hooks = $model->getHooks($hookType); - usort($hooks, fn(HookModel $one, HookModel $two) => $one->getPriority() <=> $two->getPriority()); - foreach ($hooks as $hookMethodModel) { - try { - yield call([$hookTarget, $hookMethodModel->getMethod()], ...$args); - } catch (Throwable $throwable) { - $hookTypeInflected = str_starts_with($hookType->toString(), 'Before') ? 'setting up' : 'tearing down'; - $msg = sprintf( - 'Failed %s "%s::%s" #[%s] hook with exception of type "%s" with code %d and message "%s".', - $hookTypeInflected, - is_string($hookTarget) ? $hookTarget : $hookTarget::class, - $hookMethodModel->getMethod(), - $hookType->toString(), - $throwable::class, - $throwable->getCode(), - $throwable->getMessage() - ); - throw new $exceptionType($msg, previous: $throwable); - } - } - }); - } - - private function invokeTest( - ProcessedSummaryBuilder $aggregateSummaryBuilder, - TestCase $testCase, - AssertionContext $assertionContext, - AsyncAssertionContext $asyncAssertionContext, - ExpectationContext $expectationContext, - ?MockBridge $mockBridge, - TestSuiteModel $testSuiteModel, - TestCaseModel $testCaseModel, - TestModel $testModel, - array $args = [], - ?string $dataSetLabel = null - ) : Promise { - return call(function() use( - $aggregateSummaryBuilder, - $testCase, - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $mockBridge, - $testSuiteModel, - $testCaseModel, - $testModel, - $args, - $dataSetLabel - ) { - if ($testModel->isDisabled()) { - $msg = $testModel->getDisabledReason() ?? - $testCaseModel->getDisabledReason() ?? - $testSuiteModel->getDisabledReason() ?? - sprintf('%s::%s has been marked disabled via annotation', $testCaseModel->getClass(), $testModel->getMethod()); - $exception = new TestDisabledException($msg); - $testResult = $this->getDisabledTestResult($testCase, $testModel->getMethod(), $exception); - yield $this->emitter->emit(new TestProcessedEvent($testResult)); - yield $this->emitter->emit(new TestDisabledEvent($testResult)); - $aggregateSummaryBuilder->processedTest($testResult); - return; - } - - if (isset($mockBridge)) { - $mockBridge->initialize(); - } - - yield $this->invokeHooks($testCase->testSuite(), $testSuiteModel, HookType::BeforeEachTest(), TestSetupException::class); - yield $this->invokeHooks($testCase, $testCaseModel, HookType::BeforeEach(), TestSetupException::class); - - $testCaseMethod = $testModel->getMethod(); - $failureException = null; - $timer = new Timer(); - $timer->start(); - $timeoutWatcherId = null; - if (!is_null($testModel->getTimeout())) { - $timeoutWatcherId = Loop::delay($testModel->getTimeout(), function() use(&$timeoutWatcherId, $testModel) { - Loop::cancel($timeoutWatcherId); - $msg = sprintf( - 'Expected %s::%s to complete within %sms', - $testModel->getClass(), - $testModel->getMethod(), - $testModel->getTimeout() - ); - throw new TestFailedException($msg); - }); - } - Loop::setErrorHandler(function(Throwable $error) use(&$failureException, $expectationContext) { - if ($error instanceof TestFailedException) { - $failureException = $error; - } else { - $expectationContext->setThrownException($error); - } - }); - try { - ob_start(); - yield call(fn() => $testCase->$testCaseMethod(...$args)); - } catch (TestFailedException $exception) { - $failureException = $exception; - } catch (Throwable $throwable) { - $expectationContext->setThrownException($throwable); - } finally { - Loop::setErrorHandler(); - if (isset($timeoutWatcherId)) { - Loop::cancel($timeoutWatcherId); - } - $expectationContext->setActualOutput(ob_get_clean()); - if (isset($mockBridge)) { - $assertionContext->addToAssertionCount($mockBridge->getAssertionCount()); - } - // If something else failed we don't need to make validations about expectations - if (is_null($failureException)) { - $failureException = yield $expectationContext->validateExpectations(); - } - if (is_null($failureException)) { - $state = TestState::Passed(); - } else if ($failureException instanceof TestFailedException) { - $state = TestState::Failed(); - } else { - $state = TestState::Errored(); - } - $testResult = $this->getTestResult($testCase, $testCaseMethod, $state, $timer->stop(), $failureException, $dataSetLabel); - } - - yield $this->invokeHooks($testCase, $testCaseModel, HookType::AfterEach(), TestTearDownException::class); - yield $this->invokeHooks($testCase->testSuite(), $testSuiteModel, HookType::AfterEachTest(), TestTearDownException::class); - - yield $this->emitter->emit(new TestProcessedEvent($testResult)); - - if (TestState::Passed()->equals($testResult->getState())) { - yield $this->emitter->emit(new TestPassedEvent($testResult)); - } else if (TestState::Errored()->equals($testResult->getState())) { - yield $this->emitter->emit(new TestErroredEvent($testResult)); - } else { - yield $this->emitter->emit(new TestFailedEvent($testResult)); - } - - $aggregateSummaryBuilder->processedTest($testResult); - - unset($testCase); - unset($failureException); - unset($testResult); - }); - } - - private function getReflectionClass(string $class) : ReflectionClass { - if (!isset($this->reflectionCache[$class])) { - $this->reflectionCache[$class] = new ReflectionClass($class); - } - - return $this->reflectionCache[$class]; - } - - private function getDisabledTestResult(TestCase $testCase, string $testMethod, TestDisabledException $exception) : TestResult { - return new class($testCase, $testMethod, $exception) implements TestResult { - - public function __construct( - private TestCase $testCase, - private string $testMethod, - private TestDisabledException $exception - ) {} - - public function getTestCase() : TestCase { - return $this->testCase; - } - - public function getTestMethod() : string { - return $this->testMethod; - } - - public function getDataSetLabel() : ?string { - return null; - } - - public function getState() : TestState { - return TestState::Disabled(); - } - - public function getDuration() : Duration { - return Duration::fromNanoseconds(0); - } - - public function getException() : TestFailedException|AssertionFailedException|TestDisabledException|null { - return $this->exception; - } - }; - } - - private function getTestResult( - TestCase $testCase, - string $method, - TestState $state, - Duration $duration, - TestFailedException|TestErrorException|null $testFailedException, - ?string $dataSetLabel - ) : TestResult { - return new class($testCase, $method, $state, $duration, $testFailedException, $dataSetLabel) implements TestResult { - - public function __construct( - private TestCase $testCase, - private string $method, - private TestState $state, - private Duration $duration, - private TestFailedException|TestErrorException|null $testFailedException, - private ?string $dataSetLabel - ) {} - - public function getTestCase() : TestCase { - return $this->testCase; - } - - public function getTestMethod() : string { - return $this->method; - } - - public function getDataSetLabel() : ?string { - return $this->dataSetLabel; - } - - public function getState() : TestState { - return $this->state; - } - - public function getDuration() : Duration { - return $this->duration; - } - - public function getException() : TestFailedException|AssertionFailedException|TestDisabledException|TestErrorException|null { - return $this->testFailedException; - } - }; - } - - private function invokeTestCaseConstructor(string $testCaseClass, TestSuite $testSuite, TestModel $testModel) : array { - /** @var TestCase $testCaseObject */ - $reflectionClass = $this->getReflectionClass($testCaseClass); - $testCaseObject = $reflectionClass->newInstanceWithoutConstructor(); - $reflectedAssertionContext = $this->getReflectionClass(AssertionContext::class); - $reflectedAsyncAssertionContext = $this->getReflectionClass(AsyncAssertionContext::class); - $reflectedExpectationContext = $this->getReflectionClass(ExpectationContext::class); - $testCaseConstructor = $reflectionClass->getConstructor(); - $testCaseConstructor->setAccessible(true); - - $assertionContext = $reflectedAssertionContext->newInstanceWithoutConstructor(); - $assertionContextConstructor = $reflectedAssertionContext->getConstructor(); - $assertionContextConstructor->setAccessible(true); - $assertionContextConstructor->invoke($assertionContext, $this->customAssertionContext); - - $asyncAssertionContext = $reflectedAsyncAssertionContext->newInstanceWithoutConstructor(); - $asyncAssertionContextConstructor = $reflectedAsyncAssertionContext->getConstructor(); - $asyncAssertionContextConstructor->setAccessible(true); - $asyncAssertionContextConstructor->invoke($asyncAssertionContext, $this->customAssertionContext); - - $testMocker = null; - if (isset($this->mockBridgeClass)) { - $testMocker = $this->mockBridgeFactory->make($this->mockBridgeClass); - } - - $expectationContext = $reflectedExpectationContext->newInstanceWithoutConstructor(); - $expectationContextConstructor = $reflectedExpectationContext->getConstructor(); - $expectationContextConstructor->setAccessible(true); - $expectationContextConstructor->invoke($expectationContext, $testModel, $assertionContext, $asyncAssertionContext, $testMocker); - - $testCaseConstructor->invoke( - $testCaseObject, - $testSuite, - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $testMocker - ); - return [$testCaseObject, $assertionContext, $asyncAssertionContext, $expectationContext, $testMocker]; - } - -} \ No newline at end of file diff --git a/framework_test/Assertion/AbstractAsyncAssertionTestCase.php b/framework_test/Assertion/AbstractAsyncAssertionTestCase.php deleted file mode 100644 index 4fbf325..0000000 --- a/framework_test/Assertion/AbstractAsyncAssertionTestCase.php +++ /dev/null @@ -1,55 +0,0 @@ -getAssertion($this->getExpected(), new Success($actual)); - $results = yield $subject->assert(); - - $this->assertTrue($results->isSuccessful()); - $this->assertInstanceOf($this->getSummaryAssertionMessageClass(), $results->getSummary()); - $this->assertInstanceOf($this->getDetailsAssertionMessageClass(), $results->getDetails()); - }); - } - - /** - * @dataProvider getBadActual - */ - public function testAssertGoodValueDoesNotEqualBadValueInformation(mixed $actual) { - Loop::run(function() use($actual) { - $subject = $this->getAssertion($this->getExpected(), new Success($actual)); - $results = yield $subject->assert(); - - $this->assertFalse($results->isSuccessful()); - $this->assertInstanceOf($this->getSummaryAssertionMessageClass(), $results->getSummary()); - $this->assertInstanceOf($this->getDetailsAssertionMessageClass(), $results->getDetails()); - }); - } - -} \ No newline at end of file diff --git a/framework_test/Assertion/AsyncAssertArrayEqualsTest.php b/framework_test/Assertion/AsyncAssertArrayEqualsTest.php deleted file mode 100644 index 2deff15..0000000 --- a/framework_test/Assertion/AsyncAssertArrayEqualsTest.php +++ /dev/null @@ -1,47 +0,0 @@ -expectException(InvalidArgumentException::class); - $this->expectExceptionMessage(sprintf( - 'The expected value must be a valid class but %s was given', var_export('not a class', true) - )); - new AsyncAssertInstanceOf('not a class', new Success(new \stdClass())); - } - - public function testInstanceOfInterfaceIsValid() { - Loop::run(function() { - $subject = new AsyncAssertInstanceOf(AssertionMessage::class, new Success(new TrueUnaryOperandSummary('something'))); - $results = yield $subject->assert(); - - $this->assertTrue($results->isSuccessful()); - $this->assertInstanceOf(InstanceOfMessage::class, $results->getSummary()); - $this->assertInstanceOf(InstanceOfMessage::class, $results->getDetails()); - }); - } - - public function testInstanceOfTypeIsNotInstance() { - Loop::run(function() { - $subject = new AsyncAssertInstanceOf(TestCase::class, new Success(new TrueUnaryOperandSummary('foo'))); - $results = yield $subject->assert(); - - $this->assertFalse($results->isSuccessful()); - $this->assertInstanceOf(InstanceOfMessage::class, $results->getSummary()); - $this->assertInstanceOf(InstanceOfMessage::class, $results->getDetails()); - }); - } - - public function testPassingObjectAsExpected() { - Loop::run(function() { - $subject = new AsyncAssertInstanceOf(new InvalidStateException(), new Success(new InvalidArgumentException())); - $results = yield $subject->assert(); - - $this->assertFalse($results->isSuccessful()); - $this->assertInstanceOf(InstanceOfMessage::class, $results->getSummary()); - $this->assertInstanceOf(InstanceOfMessage::class, $results->getDetails()); - }); - } - -} \ No newline at end of file diff --git a/framework_test/Assertion/AsyncAssertIntEqualsTest.php b/framework_test/Assertion/AsyncAssertIntEqualsTest.php deleted file mode 100644 index be22c65..0000000 --- a/framework_test/Assertion/AsyncAssertIntEqualsTest.php +++ /dev/null @@ -1,46 +0,0 @@ -createMock(ConfigurationFactory::class); - $configurationFactory->expects($this->once()) - ->method('make') - ->with($configPath) - ->willReturn(new Success($configuration)); - - $this->mockBridgeStub = new MockBridgeStub(); - $this->mockBridgeFactory = $this->createMock(MockBridgeFactory::class); - - $objectGraph = (new AsyncUnitApplicationObjectGraph( - $environment, - $logger, - $configurationFactory, - new OutputBuffer(), - $configPath, - $this->mockBridgeFactory, - ))->wireObjectGraph(); - $objectGraph->alias(Randomizer::class, NullRandomizer::class); - - $emitter = $objectGraph->make(EventEmitter::class); - $this->injector = $objectGraph; - - $state = new stdClass(); - $state->data = []; - $state->passed = new stdClass(); - $state->passed->events = []; - $state->failed = new stdClass(); - $state->failed->events = []; - $state->disabled = new stdClass(); - $state->disabled->events = []; - $emitter->on(Events::TEST_PASSED, function($event) use($state) { - $state->passed->events[] = $event; - }); - $emitter->on(Events::TEST_FAILED, function($event) use($state) { - $state->failed->events[] = $event; - }); - $emitter->on(Events::TEST_DISABLED, function($event) use($state) { - $state->disabled->events[] = $event; - }); - - return [$state, $this->injector->make(Engine::class)]; - } - - public function testSimpleTestCaseImplicitDefaultTestSuiteSingleTest() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('SingleTest')]); - [$state, $engine] = $this->getStateAndApplication('singleTest', $configuration); - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(1, $state->passed->events); - $this->assertCount(0, $state->failed->events); - /** @var TestPassedEvent $event */ - $event = $state->passed->events[0]; - $this->assertInstanceOf(TestPassedEvent::class, $event); - - $testResult = $event->getTarget(); - - $this->assertInstanceOf(ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, $testResult->getTestCase()); - $this->assertSame('ensureSomethingHappens', $testResult->getTestMethod()); - $this->assertSame(TestState::Passed(), $testResult->getState()); - } - - public function testSimpleTestCaseImplicitDefaultTestSuiteSingleTestAsyncAssertion() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('SingleTestAsyncAssertion')]); - [$state, $engine] = $this->getStateAndApplication('singleTestAsync', $configuration); - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(1, $state->passed->events); - $this->assertCount(0, $state->failed->events); - /** @var TestPassedEvent $event */ - $event = $state->passed->events[0]; - $this->assertInstanceOf(TestPassedEvent::class, $event); - - $testResult = $event->getTarget(); - - $this->assertInstanceOf(ImplicitDefaultTestSuite\SingleTestAsyncAssertion\MyTestCase::class, $testResult->getTestCase()); - $this->assertSame('ensureAsyncAssert', $testResult->getTestMethod()); - $this->assertSame(TestState::Passed(), $testResult->getState()); - } - - public function testSimpleTestCaseImplicitDefaultTestSuiteNoAssertions() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('NoAssertions')]); - [$state, $engine] = $this->getStateAndApplication('noAssertions', $configuration); - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(0, $state->passed->events); - $this->assertCount(1, $state->failed->events); - /** @var TestFailedEvent $event */ - $event = $state->failed->events[0]; - $this->assertInstanceOf(TestFailedEvent::class, $event); - - $testResult = $event->getTarget(); - - $this->assertInstanceOf(ImplicitDefaultTestSuite\NoAssertions\MyTestCase::class, $testResult->getTestCase()); - $this->assertSame('noAssertions', $testResult->getTestMethod()); - $this->assertSame(TestState::Failed(), $testResult->getState()); - $msg = sprintf( - 'Expected "%s::%s" #[Test] to make at least 1 Assertion but none were made.', - ImplicitDefaultTestSuite\NoAssertions\MyTestCase::class, - 'noAssertions' - ); - $this->assertSame($msg, $testResult->getException()->getMessage()); - } - - public function testSimpleTestCaseImplicitDefaultTestSuiteFailedAssertion() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('FailedAssertion')]); - [$state, $engine] = $this->getStateAndApplication('failedAssertion', $configuration); - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(0, $state->passed->events); - $this->assertCount(1, $state->failed->events); - /** @var TestFailedEvent $event */ - $event = $state->failed->events[0]; - $this->assertInstanceOf(TestFailedEvent::class, $event); - - $testResult = $event->getTarget(); - $this->assertSame(TestState::Failed(), $testResult->getState()); - } - - public function testLoadingCustomAssertionPlugins() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('SingleTest')]); - [,$engine] = $this->getStateAndApplication('singleTest', $configuration); - - $this->injector->share(FooAssertionPlugin::class); - $this->injector->share(BarAssertionPlugin::class); - - $application = $this->injector->make(Application::class); - - $application->registerPlugin(FooAssertionPlugin::class); - $application->registerPlugin(BarAssertionPlugin::class); - - $engine->run($application); - - $actual = $this->injector->make(CustomAssertionContext::class); - - $fooPlugin = $this->injector->make(FooAssertionPlugin::class); - $barPlugin = $this->injector->make(BarAssertionPlugin::class); - - $this->assertSame($fooPlugin->getCustomAssertionContext(), $actual); - $this->assertSame($barPlugin->getCustomAssertionContext(), $actual); - } - - public function testExplicitTestSuiteTestSuiteStateShared() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->explicitTestSuitePath('TestSuiteStateBeforeAll')]); - [$state, $engine] = $this->getStateAndApplication('testSuiteBeforeAll', $configuration); - - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(1, $state->passed->events); - $this->assertCount(0, $state->failed->events); - } - - public function testExplicitTestSuiteTestCaseBeforeAllHasTestSuiteState() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->explicitTestSuitePath('TestCaseBeforeAllHasTestSuiteState')]); - [$state, $engine] = $this->getStateAndApplication('testCaseBeforeAllHasTestSuiteState', $configuration); - - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(1, $state->passed->events); - $this->assertCount(0, $state->failed->events); - } - - public function testExplicitTestSuiteTestCaseAfterAllHasTestSuiteState() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([$this->explicitTestSuitePath('TestCaseAfterAllHasTestSuiteState')]); - [$state, $engine] = $this->getStateAndApplication('testCaseAfterAllHasTestSuiteState', $configuration); - - $engine->run($this->injector->make(Application::class)); - - $this->assertCount(1, $state->passed->events); - $this->assertCount(0, $state->failed->events); - - $this->assertSame('AsyncUnit', $state->passed->events[0]->getTarget()->getTestCase()->getState()); - } - - public function testConfigurationInvalidThrowsException() { - $configuration = new TestConfiguration(); - $configuration->setTestDirectories([]); - $configuration->setResultPrinterClass('Not a class'); - [, $engine] = $this->getStateAndApplication('invalidConfig', $configuration); - - $this->expectException(InvalidConfigurationException::class); - $expectedMessage = <<<'msg' -The configuration at path "invalidConfig" has the following errors: - -- Must provide at least one directory to scan but none were provided. -- The result printer "Not a class" is not a class that can be found. Please ensure this class is configured to be autoloaded through Composer. - -Please fix the errors listed above and try running your tests again. -msg; - $this->expectExceptionMessage($expectedMessage); - - $engine->run($this->injector->make(Application::class)); - } - -} \ No newline at end of file diff --git a/framework_test/AsyncUnitConfigurationValidatorTest.php b/framework_test/AsyncUnitConfigurationValidatorTest.php deleted file mode 100644 index 13364dc..0000000 --- a/framework_test/AsyncUnitConfigurationValidatorTest.php +++ /dev/null @@ -1,96 +0,0 @@ -subject = new AsyncUnitConfigurationValidator(); - $this->testConfiguration = new TestConfiguration(); - } - - public function testEmptyTestDirectoriesIsInvalid() { - Loop::run(function() { - $this->testConfiguration->setTestDirectories([]); - /** @var ConfigurationValidationResults $results */ - $results = yield $this->subject->validate($this->testConfiguration); - - $this->assertInstanceOf(ConfigurationValidationResults::class, $results); - $this->assertFalse($results->isValid()); - $this->assertArrayHasKey('testDirectories', $results->getValidationErrors()); - $this->assertSame( - ['Must provide at least one directory to scan but none were provided.'], - $results->getValidationErrors()['testDirectories'] - ); - }); - } - - public function testNonDirectoriesIsInvalid() { - Loop::run(function() { - $this->testConfiguration->setTestDirectories([ - __DIR__, - 'not a dir', - dirname(__DIR__), - 'definitely not a dir' - ]); - /** @var ConfigurationValidationResults $results */ - $results = yield $this->subject->validate($this->testConfiguration); - - $this->assertInstanceOf(ConfigurationValidationResults::class, $results); - $this->assertFalse($results->isValid()); - $this->assertArrayHasKey('testDirectories', $results->getValidationErrors()); - $this->assertSame( - [ - 'A configured directory to scan, "not a dir", is not a directory.', - 'A configured directory to scan, "definitely not a dir", is not a directory.' - ], - $results->getValidationErrors()['testDirectories'] - ); - }); - } - - public function testResultPrinterClassIsNotClass() { - Loop::run(function() { - $this->testConfiguration->setResultPrinterClass('Not a class'); - - /** @var ConfigurationValidationResults $results */ - $results = yield $this->subject->validate($this->testConfiguration); - - $this->assertInstanceOf(ConfigurationValidationResults::class, $results); - $this->assertFalse($results->isValid()); - $this->assertArrayHasKey('resultPrinter', $results->getValidationErrors()); - $this->assertSame( - ['The result printer "Not a class" is not a class that can be found. Please ensure this class is configured to be autoloaded through Composer.'], - $results->getValidationErrors()['resultPrinter'] - ); - }); - } - - public function testResultPrinterClassIsNotResultPrinterPlugin() { - Loop::run(function() { - $this->testConfiguration->setResultPrinterClass(Generator::class); - - /** @var ConfigurationValidationResults $results */ - $results = yield $this->subject->validate($this->testConfiguration); - - $this->assertInstanceOf(ConfigurationValidationResults::class, $results); - $this->assertFalse($results->isValid()); - $this->assertArrayHasKey('resultPrinter', $results->getValidationErrors()); - $this->assertSame( - ['The result printer "Generator" is not a ' . ResultPrinterPlugin::class . '. Please ensure your result printer implements this interface.'], - $results->getValidationErrors()['resultPrinter'] - ); - }); - } - -} \ No newline at end of file diff --git a/framework_test/Context/CustomAssertionContextTest.php b/framework_test/Context/CustomAssertionContextTest.php deleted file mode 100644 index 447bca5..0000000 --- a/framework_test/Context/CustomAssertionContextTest.php +++ /dev/null @@ -1,135 +0,0 @@ -subject = $reflectedClass->newInstanceWithoutConstructor(); - } - - public function testHasAssertionContextFalseIfEmpty() { - $this->assertFalse($this->subject->hasRegisteredAssertion('someMethodName')); - } - - public function testHasAsyncAssertionContextFalseIfEmpty() { - $this->assertFalse($this->subject->hasRegisteredAsyncAssertion('someMethodName')); - } - - public function testRegisterAssertionWithInvalidName() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('A registered custom assertion must have a valid method name but "bad value with spaces" was provided'); - - $this->subject->registerAssertion('bad value with spaces', function() {}); - } - - public function testRegisterAsyncAssertionWithInvalidName() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('A registered custom async assertion must have a valid method name but "bad value with spaces" was provided'); - - $this->subject->registerAsyncAssertion('bad value with spaces', function() {}); - } - - public function testRegisterAssertionHasAssertionReturnsTrue() { - $this->subject->registerAssertion('ensureCustomThing', function() {}); - - $this->assertTrue($this->subject->hasRegisteredAssertion('ensureCustomThing')); - } - - public function testRegisterAsyncAssertionHasAssertionReturnsTrue() { - $this->subject->registerAsyncAssertion('ensureSomeThing', function() {}); - - $this->assertTrue($this->subject->hasRegisteredAsyncAssertion('ensureSomeThing')); - } - - public function testCreateAssertionDoesNotExistThrowsException() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('There is no custom assertion registered for "customAssertionName".'); - - $this->subject->createAssertion('customAssertionName'); - } - - public function testCreateAsyncAssertionDoesNotExistThrowsException() { - Loop::run(function() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('There is no custom async assertion registered for "customAssertionName".'); - - yield $this->subject->createAsyncAssertion('customAssertionName'); - }); - } - - public function testCreateRegisteredFactoryDoesNotReturnAssertionThrowsException() { - $this->subject->registerAssertion('ensureSomething', fn() => 'not an assertion'); - - $this->expectException(InvalidStateException::class); - $this->expectExceptionMessage('The factory for custom assertion "ensureSomething" must return an instance of ' . Assertion::class); - - $this->subject->createAssertion('ensureSomething'); - } - - public function testCreateRegisteredFactoryDoesNotReturnAsyncAssertionThrowsException() { - $this->subject->registerAsyncAssertion('ensureSomething', fn() => 'not an assertion'); - - $this->expectException(InvalidStateException::class); - $this->expectExceptionMessage('The factory for custom async assertion "ensureSomething" must return an instance of ' . AsyncAssertion::class); - - $this->subject->createAsyncAssertion('ensureSomething'); - } - - public function testCreateRegisteredFactoryIsAssertionReturnsObject() { - $assertion = $this->getMockBuilder(Assertion::class)->getMock(); - $this->subject->registerAssertion('ensureSomething', fn() => $assertion); - - $actual = $this->subject->createAssertion('ensureSomething'); - - $this->assertSame($assertion, $actual); - } - - public function testCreateRegisteredFactoryIsAsyncAssertionReturnsObject() { - $assertion = $this->getMockBuilder(AsyncAssertion::class)->getMock(); - $this->subject->registerAsyncAssertion('ensureSomething', fn() => $assertion); - - $actual = $this->subject->createAsyncAssertion('ensureSomething'); - - $this->assertSame($assertion, $actual); - } - - public function testRegisteredAssertionFactoryReceivesArgs() { - $assertion = $this->getMockBuilder(Assertion::class)->getMock(); - $state = new \stdClass(); - $state->args = null; - $this->subject->registerAssertion('ensureSomething', function(...$args) use($state, $assertion) { - $state->args = $args; - return $assertion; - }); - - $this->subject->createAssertion('ensureSomething', 1, 'a', 'b', ['1', '2', 3]); - $this->assertNotNull($state->args); - $this->assertSame([1, 'a', 'b', ['1', '2', 3]], $state->args); - } - - public function testRegisteredAsyncAssertionFactoryReceivesArgs() { - $assertion = $this->getMockBuilder(AsyncAssertion::class)->getMock(); - $state = new \stdClass(); - $state->args = null; - $this->subject->registerAsyncAssertion('ensureSomething', function(...$args) use($state, $assertion) { - $state->args = $args; - return $assertion; - }); - - $this->subject->createAsyncAssertion('ensureSomething', 1, 'a', 'b', ['1', '2', 3]); - $this->assertNotNull($state->args); - $this->assertSame([1, 'a', 'b', ['1', '2', 3]], $state->args); - } -} \ No newline at end of file diff --git a/framework_test/JsonConfigurationFactoryTest.php b/framework_test/JsonConfigurationFactoryTest.php deleted file mode 100644 index 5fc23d7..0000000 --- a/framework_test/JsonConfigurationFactoryTest.php +++ /dev/null @@ -1,81 +0,0 @@ -subject = new JsonConfigurationFactory(); - } - - public function badSchemaProvider() : array { - return [ - 'empty_object' => [__DIR__ . '/Resources/dummy_configs/empty_object.json'], - 'bad_keys' => [__DIR__ . '/Resources/dummy_configs/bad_keys.json'], - 'good_keys_bad_types' => [__DIR__ . '/Resources/dummy_configs/good_keys_bad_types.json'], - 'test_dirs_empty' => [__DIR__ . '/Resources/dummy_configs/test_dirs_empty.json'], - 'test_dirs_non_string' => [__DIR__ . '/Resources/dummy_configs/test_dirs_non_string.json'], - 'test_dirs_empty_string' => [__DIR__ . '/Resources/dummy_configs/test_dirs_empty_string.json'], - 'good_keys_but_extra' => [__DIR__ . '/Resources/dummy_configs/good_keys_but_extra.json'], - 'plugins_empty' => [__DIR__ . '/Resources/dummy_configs/plugins_empty.json'], - 'plugins_empty_string' => [__DIR__ . '/Resources/dummy_configs/plugins_empty_string.json'], - 'plugins_non_string' => [__DIR__ . '/Resources/dummy_configs/plugins_non_string.json'], - 'result_printer_null' => [__DIR__ . '/Resources/dummy_configs/result_printer_null.json'], - 'result_printer_empty' => [__DIR__ . '/Resources/dummy_configs/result_printer_empty.json'], - 'mock_bridge_empty_string' => [__DIR__ . '/Resources/dummy_configs/mock_bridge_empty_string.json'] - ]; - } - - /** - * @dataProvider badSchemaProvider - */ - public function testBadSchemaThrowsException(string $file) { - Loop::run(function() use($file) { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionMessage(sprintf( - 'The JSON file at "%s" does not adhere to the JSON Schema https://labrador-kennel.io/dev/async-unit/schema/cli-config.json', - $file - )); - - yield $this->subject->make($file); - }); - } - - public function testMinimallyValidReturnsCorrectInformation() { - Loop::run(function() { - /** @var Configuration $configuration */ - $configuration = yield $this->subject->make(__DIR__ . '/Resources/dummy_configs/minimally_valid.json'); - - $this->assertSame([getcwd()], $configuration->getTestDirectories()); - $this->assertSame(TerminalResultPrinter::class, $configuration->getResultPrinter()); - $this->assertEmpty($configuration->getPlugins()); - }); - } - - public function testHasPluginsReturnsCorrectInformation() { - Loop::run(function() { - $configuration = yield $this->subject->make(__DIR__ . '/Resources/dummy_configs/has_plugins.json'); - - $this->assertSame([getcwd()], $configuration->getTestDirectories()); - $this->assertSame(['FooBar'], $configuration->getPlugins()); - }); - } - - public function testHasMockBridgeReturnsCorrectInformation() { - Loop::run(function() { - $configuration = yield $this->subject->make(__DIR__ . '/Resources/dummy_configs/has_mock_bridge.json'); - - $this->assertSame([getcwd()], $configuration->getTestDirectories()); - $this->assertSame(MockeryMockBridge::class, $configuration->getMockBridge()); - }); - } - -} \ No newline at end of file diff --git a/framework_test/MockBridge/MockeryMockBridgeTest.php b/framework_test/MockBridge/MockeryMockBridgeTest.php deleted file mode 100644 index a49001c..0000000 --- a/framework_test/MockBridge/MockeryMockBridgeTest.php +++ /dev/null @@ -1,40 +0,0 @@ -initialize(); - $mock = $subject->createMock(Application::class); - - $mock->expects()->start()->andReturn(new Success()); - - $this->expectException(MockFailureException::class); - - $subject->finalize(); - } - - public function testMockWithGoodPredictions() : void { - $this->expectNotToPerformAssertions(); - $subject = new MockeryMockBridge(); - - $subject->initialize(); - $mock = $subject->createMock(Application::class); - $mock->expects()->start()->andReturn(new Success()); - - $mock->start(); - - $subject->finalize(); - } - -} \ No newline at end of file diff --git a/framework_test/MockBridge/ProphecyMockBridgeTest.php b/framework_test/MockBridge/ProphecyMockBridgeTest.php deleted file mode 100644 index fdf0b2d..0000000 --- a/framework_test/MockBridge/ProphecyMockBridgeTest.php +++ /dev/null @@ -1,53 +0,0 @@ -initialize(); - $mock = $subject->createMock(Application::class); - - $mock->start()->shouldBeCalled()->willReturn(new Success()); - - $this->expectException(MockFailureException::class); - - $subject->finalize(); - } - - public function testMockWithGoodPredictions() { - $this->expectNotToPerformAssertions(); - $subject = new ProphecyMockBridge(); - - $subject->initialize(); - $mock = $subject->createMock(Application::class); - - $mock->start()->shouldBeCalled()->willReturn(new Success()); - - $mock->reveal()->start(); - - $subject->finalize(); - } - - public function testMockAssertionCount() { - $subject = new ProphecyMockBridge(); - - $subject->initialize(); - $mock = $subject->createMock(Application::class); - - $mock->start()->shouldBeCalled()->willReturn(new Success()); - - $secondMock = $subject->createMock(Application::class); - $secondMock->start()->shouldBeCalled()->willReturn(new Success()); - - $this->assertSame(2, $subject->getAssertionCount()); - } - -} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/has_mock_bridge.json b/framework_test/Resources/dummy_configs/has_mock_bridge.json deleted file mode 100644 index 66a9700..0000000 --- a/framework_test/Resources/dummy_configs/has_mock_bridge.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "testDirs": ["."], - "resultPrinter": "Cspray\\Labrador\\AsyncUnitCli\\DefaultResultPrinter", - "mockBridge": "Cspray\\Labrador\\AsyncUnit\\MockBridge\\MockeryMockBridge" -} diff --git a/framework_test/Resources/dummy_configs/has_plugins.json b/framework_test/Resources/dummy_configs/has_plugins.json deleted file mode 100644 index 7b7b1ad..0000000 --- a/framework_test/Resources/dummy_configs/has_plugins.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "testDirs": ["."], - "resultPrinter": "Cspray\\Labrador\\AsyncUnitCli\\DefaultResultPrinter", - "plugins": ["FooBar"] -} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/minimally_valid.json b/framework_test/Resources/dummy_configs/minimally_valid.json deleted file mode 100644 index 8b0eaa5..0000000 --- a/framework_test/Resources/dummy_configs/minimally_valid.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "testDirs": ["."], - "resultPrinter": "Cspray\\Labrador\\AsyncUnitCli\\TerminalResultPrinter", - "mockBridge": "Cspray\\Labrador\\AsyncUnit\\Stub\\MockBridgeStub" -} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/plugins_empty.json b/framework_test/Resources/dummy_configs/plugins_empty.json deleted file mode 100644 index 0cf3b63..0000000 --- a/framework_test/Resources/dummy_configs/plugins_empty.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "testDirs": ["foo"], - "plugins": [] -} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/plugins_empty_string.json b/framework_test/Resources/dummy_configs/plugins_empty_string.json deleted file mode 100644 index 390e671..0000000 --- a/framework_test/Resources/dummy_configs/plugins_empty_string.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "testDirs": ["foo"], - "plugins": ["FooBar", ""] -} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/plugins_non_string.json b/framework_test/Resources/dummy_configs/plugins_non_string.json deleted file mode 100644 index 0bd2b9a..0000000 --- a/framework_test/Resources/dummy_configs/plugins_non_string.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "testDirs": ["foo"], - "plugins": [1, 3.4, []] -} \ No newline at end of file diff --git a/framework_test/StaticAnalysisParserTest.php b/framework_test/StaticAnalysisParserTest.php deleted file mode 100644 index c229a44..0000000 --- a/framework_test/StaticAnalysisParserTest.php +++ /dev/null @@ -1,719 +0,0 @@ -acmeSrcDir = dirname(__DIR__) . '/acme_src'; - $this->subject = new StaticAnalysisParser(); - } - - public function testErrorConditionsNoTestsTestCase() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\NoTestsTestCase\\BadTestCase". There were no #[Test] found.'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/NoTestsTestCase'); - }); - } - - public function testErrorConditionsBeforeAllNonStaticMethod() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\BeforeAllNonStaticMethod\\BadTestCase". The non-static method "badBeforeAllMustBeStatic" cannot be used as a #[BeforeAll] hook.'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/BeforeAllNonStaticMethod'); - }); - } - - public function testErrorConditionsAfterAllNonStaticMethod() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\AfterAllNonStaticMethod\\BadTestCase". The non-static method "badAfterAllMustBeStatic" cannot be used as a #[AfterAll] hook.'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/AfterAllNonStaticMethod'); - }); - } - - public function testErrorConditionsTestAttributeOnNotTestCase() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\TestAttributeOnNotTestCase\\BadTestCase". The method "ensureSomething" is annotated with #[Test] but this class does not extend "' . TestCase::class . '".'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/TestAttributeOnNotTestCase'); - }); - } - - public function testErrorConditionsBeforeAllAttributeOnNotTestCaseOrTestSuite() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\BeforeAllAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[BeforeAll] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/BeforeAllAttributeOnNotTestCaseOrTestSuite'); - }); - } - - public function testErrorConditionsAfterAllAttributeOnNotTestCaseOrTestSuite() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\AfterAllAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[AfterAll] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/AfterAllAttributeOnNotTestCaseOrTestSuite'); - }); - } - - public function testErrorConditionsAfterEachAttributeOnNotTestCaseOrTestSuite() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\AfterEachAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[AfterEach] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/AfterEachAttributeOnNotTestCaseOrTestSuite'); - }); - } - - public function testErrorConditionsBeforeEachAttributeOnNotTestCaseOrTestSuite() { - Loop::run(function() { - $this->expectException(TestCompilationException::class); - $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\BeforeEachAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[BeforeEach] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/BeforeEachAttributeOnNotTestCaseOrTestSuite'); - }); - } - - public function badNamespaceDataProvider() : array { - return [ - ['BadNamespaceTest', 'MyTestCase'], - ['BadNamespaceTestCaseAfterAll', 'MyTestCase'], - ['BadNamespaceTestCaseAfterEach', 'MyTestCase'], - ['BadNamespaceTestCaseBeforeAll', 'MyTestCase'], - ['BadNamespaceTestCaseBeforeEach', 'MyTestCase'], - ['BadNamespaceTestSuiteAfterAll', 'MyTestSuite'], - ['BadNamespaceTestSuiteAfterEach', 'MyTestSuite'], - ['BadNamespaceTestSuiteAfterEachTest', 'MyTestSuite'], - ['BadNamespaceTestSuiteBeforeAll', 'MyTestSuite'], - ['BadNamespaceTestSuiteBeforeEach', 'MyTestSuite'], - ['BadNamespaceTestSuiteBeforeEachTest', 'MyTestSuite'] - ]; - } - - /** - * @dataProvider badNamespaceDataProvider - */ - public function testErrorConditionsBadNamespace(string $errorConditionNamespace, string $simpleClass) { - Loop::run(function() use($errorConditionNamespace, $simpleClass) { - $this->expectException(TestCompilationException::class); - $expected = sprintf( - 'Failure compiling Acme\\DemoSuites\\ErrorConditions\\%s\\IntentionallyBad\\%s. The class cannot be autoloaded. Please ensure your Composer autoloader settings have been configured correctly', - $errorConditionNamespace, - $simpleClass - - ); - $this->expectExceptionMessage($expected); - - yield $this->subject->parse($this->acmeSrcDir . '/ErrorConditions/' . $errorConditionNamespace . '/'); - }); - } - - public function testDefaultTestSuiteName() : void { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('SingleTest')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - - $this->assertSame(ImplicitTestSuite::class, $testSuite->getClass()); - }); - } - - public function testTestCaseModelAlwaysHasTestSuite() : void { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('SingleTest')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - - $testCases = $testSuites[0]->getTestCaseModels(); - - $this->assertCount(1, $testCases); - - $this->assertSame(ImplicitTestSuite::class, $testCases[0]->getTestSuiteClass()); - }); - } - - public function testParsingSimpleTestCaseImplicitDefaultTestSuiteSingleTest() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('SingleTest')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - - $expectedTestCase = ImplicitDefaultTestSuite\SingleTest\MyTestCase::class; - $this->assertCount(1, $testSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite($expectedTestCase, $testSuite); - - $testCaseModel = $this->fetchTestCaseModel($testSuite, $expectedTestCase); - - $this->assertCount(1, $testCaseModel->getTestModels()); - $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappens', $testCaseModel); - }); - } - - public function testParsingSimpleTestCaseImplicitDefaultTestSuiteMultipleTest() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('MultipleTest')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - $expectedTestCase = ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class; - $this->assertCount(1, $testSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite( - $expectedTestCase, - $testSuite - ); - - $testCase = $this->fetchTestCaseModel($testSuite, $expectedTestCase); - - $this->assertCount(3, $testCase->getTestModels()); - $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappens', $testCase); - $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappensTwice', $testCase); - $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappensThreeTimes', $testCase); - }); - } - - public function testParsingSimpleTestCaseImplicitDefaultTestSuiteHasNotTestCaseObject() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('HasNotTestCaseObject')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - - $expectedTestCase = ImplicitDefaultTestSuite\HasNotTestCaseObject\MyTestCase::class; - $this->assertCount(1, $testSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite( - $expectedTestCase, - $testSuite - ); - - $testCase = $this->fetchTestCaseModel($testSuite, $expectedTestCase); - - $this->assertCount(1, $testCase->getTestModels()); - $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappens', $testCase); - }); - } - - public function testParsingSimpleTestCaseImplicitDefaultTestSuiteMultipleTestCase() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('MultipleTestCase')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - - $barTestCaseClass = ImplicitDefaultTestSuite\MultipleTestCase\BarTestCase::class; - $bazTestCaseClass = ImplicitDefaultTestSuite\MultipleTestCase\BazTestCase::class; - $fooTestCaseClass = ImplicitDefaultTestSuite\MultipleTestCase\FooTestCase::class; - - $this->assertCount(3, $testSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite($barTestCaseClass, $testSuite); - $this->assertTestCaseClassBelongsToTestSuite($bazTestCaseClass, $testSuite); - $this->assertTestCaseClassBelongsToTestSuite($fooTestCaseClass, $testSuite); - - $barTestCase = $this->fetchTestCaseModel($testSuite, $barTestCaseClass); - $bazTestCase = $this->fetchTestCaseModel($testSuite, $bazTestCaseClass); - $fooTestCase = $this->fetchTestCaseModel($testSuite, $fooTestCaseClass); - - $this->assertCount(1, $barTestCase->getTestModels()); - $this->assertCount(1, $bazTestCase->getTestModels()); - $this->assertCount(2, $fooTestCase->getTestModels()); - }); - } - - public function testParsingImplicitDefaultTestSuiteExtendedTestCases() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('ExtendedTestCases')); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - - $firstTestCaseClass = ImplicitDefaultTestSuite\ExtendedTestCases\FirstTestCase::class; - $thirdTestCaseClass = ImplicitDefaultTestSuite\ExtendedTestCases\ThirdTestCase::class; - $fifthTestCaseClass = ImplicitDefaultTestSuite\ExtendedTestCases\FifthTestCase::class; - - $this->assertCount(3, $testSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite($firstTestCaseClass, $testSuite); - $this->assertTestCaseClassBelongsToTestSuite($thirdTestCaseClass, $testSuite); - $this->assertTestCaseClassBelongsToTestSuite($fifthTestCaseClass, $testSuite); - - $firstTestCase = $this->fetchTestCaseModel($testSuite, $firstTestCaseClass); - $this->assertCount(1, $firstTestCase->getTestModels()); - $this->assertTestMethodBelongsToTestCase($firstTestCaseClass . '::firstEnsureSomething', $firstTestCase); - - $thirdTestCase = $this->fetchTestCaseModel($testSuite, $thirdTestCaseClass); - $this->assertCount(3, $thirdTestCase->getTestModels()); - $this->assertTestMethodBelongsToTestCase($thirdTestCaseClass . '::firstEnsureSomething', $thirdTestCase); - $this->assertTestMethodBelongsToTestCase($thirdTestCaseClass . '::secondEnsureSomething', $thirdTestCase); - $this->assertTestMethodBelongsToTestCase($thirdTestCaseClass . '::thirdEnsureSomething', $thirdTestCase); - - $fifthTestCase = $this->fetchTestCaseModel($testSuite, $fifthTestCaseClass); - $this->assertCount(5, $fifthTestCase->getTestModels()); - $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::firstEnsureSomething', $fifthTestCase); - $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::secondEnsureSomething', $fifthTestCase); - $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::thirdEnsureSomething', $fifthTestCase); - $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::fourthEnsureSomething', $fifthTestCase); - $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::fifthEnsureSomething', $fifthTestCase); - }); - } - - public function hooksProvider() : array { - return [ - [HookType::BeforeAll(), 'HasSingleBeforeAllHook', 'beforeAll'], - [HookType::BeforeEach(), 'HasSingleBeforeEachHook', 'beforeEach'], - [HookType::AfterAll(), 'HasSingleAfterAllHook', 'afterAll'], - [HookType::AfterEach(), 'HasSingleAfterEachHook', 'afterEach'] - ]; - } - - /** - * @dataProvider hooksProvider - */ - public function testParsingSimpleTestCaseHasHooks(HookType $hookType, string $subNamespace, string $methodName) { - Loop::run(function() use($hookType, $subNamespace, $methodName) { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath($subNamespace)); - $testSuites = $results->getTestSuiteModels(); - - $this->assertCount(1, $testSuites); - $testSuite = $testSuites[0]; - - $this->assertCount(1, $testSuite->getTestCaseModels()); - $myTestCase = $testSuite->getTestCaseModels()[0]; - - $this->assertCount(1, $myTestCase->getHooks($hookType)); - $this->assertSame('Acme\\DemoSuites\\ImplicitDefaultTestSuite\\' . $subNamespace . '\\MyTestCase', $myTestCase->getHooks($hookType)[0]->getClass()); - $this->assertSame($methodName, $myTestCase->getHooks($hookType)[0]->getMethod()); - }); - } - - public function testParsingCustomAssertionPlugins() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('HasAssertionPlugin')); - - $this->assertCount(2, $results->getPluginModels()); - - $pluginNames = array_map(fn(PluginModel $pluginModel) => $pluginModel->getPluginClass(), $results->getPluginModels()); - $expected = [ImplicitDefaultTestSuite\HasAssertionPlugin\MyCustomAssertionPlugin::class, ImplicitDefaultTestSuite\HasAssertionPlugin\MyOtherCustomAssertionPlugin::class]; - - $this->assertEqualsCanonicalizing($expected, $pluginNames); - }); - } - - public function testParsingDataProvider() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('HasDataProvider')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $results->getTestSuiteModels()[0]; - - $this->assertCount(1, $testSuite->getTestCaseModels()); - $testCaseModel = $testSuite->getTestCaseModels()[0]; - - $this->assertSame(ImplicitDefaultTestSuite\HasDataProvider\MyTestCase::class, $testCaseModel->getClass()); - $this->assertCount(1, $testCaseModel->getTestModels()); - $testMethodModel = $testCaseModel->getTestModels()[0]; - - $this->assertSame('ensureStringsEqual', $testMethodModel->getMethod()); - $this->assertSame('myDataProvider', $testMethodModel->getDataProvider()); - }); - } - - public function testExplicitTestSuiteAnnotatedDefaultTestSuite() { - Loop::run(function() { - $results = yield $this->subject->parse($this->explicitTestSuitePath('AnnotatedDefaultTestSuite')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $results->getTestSuiteModels()[0]; - - $this->assertSame(ExplicitTestSuite\AnnotatedDefaultTestSuite\MyTestSuite::class, $testSuite->getClass()); - $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\AnnotatedDefaultTestSuite\MyTestCase::class, $testSuite); - }); - } - - public function testExplicitTestSuiteTestCaseDefinesTestSuite() { - Loop::run(function() { - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestCaseDefinesTestSuite')); - - $this->assertCount(2, $results->getTestSuiteModels()); - - $firstTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class); - $this->assertCount(1, $firstTestSuite->getTestCaseModels()); - - $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinesTestSuite\FirstTestCase::class, $firstTestSuite); - - $secondTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class); - $this->assertCount(2, $secondTestSuite->getTestCaseModels()); - - $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinesTestSuite\SecondTestCase::class, $secondTestSuite); - $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinesTestSuite\ThirdTestCase::class, $secondTestSuite); - }); - } - - public function testExplicitTestSuiteTestCaseDefinesAndTestCaseDefaultTestSuite() { - Loop::run(function() { - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestCaseDefinedAndImplicitDefaultTestSuite')); - - $this->assertCount(2, $results->getTestSuiteModels()); - - $defaultTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); - $this->assertCount(1, $defaultTestSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite\FirstTestCase::class, $defaultTestSuite); - - $myTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite\MyTestSuite::class); - $this->assertCount(1, $myTestSuite->getTestCaseModels()); - $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite\SecondTestCase::class, $myTestSuite); - }); - } - - public function testImplicitDefaultTestSuitePathHasResultPrinterPlugin() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('HasResultPrinterPlugin')); - - $this->assertCount(1, $results->getPluginModels()); - $pluginModel = $results->getPluginModels()[0]; - $this->assertSame(ImplicitDefaultTestSuite\HasResultPrinterPlugin\MyResultPrinterPlugin::class, $pluginModel->getPluginClass()); - }); - } - - public function testImplicitDefaultTestSuitePathTestDisabled() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestDisabled')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); - $testCase = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class); - - $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class . '::checkSomething', $testCase); - $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class . '::skippedTest', $testCase); - - $checkSomething = $this->fetchTestModel($testCase, 'checkSomething'); - $skippedTest = $this->fetchTestModel($testCase, 'skippedTest'); - - $this->assertFalse($checkSomething->isDisabled()); - $this->assertTrue($skippedTest->isDisabled()); - $this->assertNull($skippedTest->getDisabledReason()); - }); - } - - public function testImplicitDefaultTestSuitePathTestCaseDisabled() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseDisabled')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); - $testCase = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class); - - $this->assertTrue($testCase->isDisabled()); - - $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class . '::skippedOne', $testCase); - $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class . '::skippedTwo', $testCase); - $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class . '::skippedThree', $testCase); - - $one = $this->fetchTestModel($testCase, 'skippedOne'); - $two = $this->fetchTestModel($testCase, 'skippedTwo'); - $three = $this->fetchTestModel($testCase, 'skippedThree'); - - $this->assertTrue($one->isDisabled()); - $this->assertNull($one->getDisabledReason()); - $this->assertTrue($two->isDisabled()); - $this->assertNull($two->getDisabledReason()); - $this->assertTrue($three->isDisabled()); - $this->assertNull($three->getDisabledReason()); - }); - } - - public function testExplicitTestSuiteTestSuiteDisabled() { - Loop::run(function() { - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestSuiteDisabled')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class); - $this->assertTrue($testSuite->isDisabled()); - - $this->assertCount(2, $testSuite->getTestCaseModels()); - $firstTestCase = $this->fetchTestCaseModel($testSuite, ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class); - $secondTestCase = $this->fetchTestCaseModel($testSuite, ExplicitTestSuite\TestSuiteDisabled\SecondTestCase::class); - - $this->assertTrue($firstTestCase->isDisabled()); - $this->assertTrue($secondTestCase->isDisabled()); - - $this->assertTestMethodBelongsToTestCase(ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class . '::testOne', $firstTestCase); - $this->assertTestMethodBelongsToTestCase(ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class . '::testTwo', $firstTestCase); - $this->assertTestMethodBelongsToTestCase(ExplicitTestSuite\TestSuiteDisabled\SecondTestCase::class . '::testOne', $secondTestCase); - - $one = $this->fetchTestModel($firstTestCase, 'testOne'); - $two = $this->fetchTestModel($firstTestCase, 'testTwo'); - $three = $this->fetchTestModel($firstTestCase, 'testOne'); - - $this->assertTrue($one->isDisabled()); - $this->assertNull($one->getDisabledReason()); - $this->assertTrue($two->isDisabled()); - $this->assertNull($two->getDisabledReason()); - $this->assertTrue($three->isDisabled()); - $this->assertNull($three->getDisabledReason()); - }); - } - - public function testImplicitDefaultTestSuiteTestDisabledCustomMessage() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestDisabledCustomMessage')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); - $this->assertFalse($testSuite->isDisabled()); - - $this->assertCount(1, $testSuite->getTestCaseModels()); - $testCaseModel = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestDisabledCustomMessage\MyTestCase::class); - - $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestDisabledCustomMessage\MyTestCase::class . '::testOne', $testCaseModel); - - $testModel = $this->fetchTestModel($testCaseModel, 'testOne'); - - $this->assertTrue($testModel->isDisabled()); - $this->assertSame('Not sure what we should do here yet', $testModel->getDisabledReason()); - }); - } - - public function testImplicitDefaultTestSuiteTestCaseDisabledCustomMessage() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseDisabledCustomMessage')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); - $this->assertFalse($testSuite->isDisabled()); - - $this->assertCount(1, $testSuite->getTestCaseModels()); - $testCaseModel = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestCaseDisabledCustomMessage\MyTestCase::class); - - $this->assertTrue($testCaseModel->isDisabled()); - $this->assertSame('The TestCase is disabled', $testCaseModel->getDisabledReason()); - }); - } - - public function testExplicitTestSuiteTestSuiteDisabledCustomMessage() { - Loop::run(function() { - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestSuiteDisabledCustomMessage')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestSuiteDisabledCustomMessage\MyTestSuite::class); - $this->assertTrue($testSuite->isDisabled()); - $this->assertSame('The AttachToTestSuite is disabled', $testSuite->getDisabledReason()); - }); - } - - public function testImplicitDefaultTestSuiteRecursiveTestLayout() { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('RecursiveTestLayout')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $this->assertCount(5, $results->getTestSuiteModels()[0]->getTestCaseModels()); - }); - } - - public function testImplicitDefaultTestSuiteTestHasTimeoutTestModelHasCorrectValue() : void { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestHasTimeout')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $results->getTestSuiteModels()[0]; - $this->assertCount(1, $testSuite->getTestCaseModels()); - - $test = $this->fetchTestModel($testSuite->getTestCaseModels()[0], 'timeOutTest'); - - $this->assertSame(100, $test->getTimeout()); - }); - } - - public function testImplicitDefaultTestSuiteTestCaseHasTimeoutIsSetOnTestModel() : void { - Loop::run(function() { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseHasTimeout')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $results->getTestSuiteModels()[0]; - $this->assertCount(1, $testSuite->getTestCaseModels()); - $testCase = $testSuite->getTestCaseModels()[0]; - $this->assertCount(2, $testCase->getTestModels()); - - $actual = [ - $testCase->getTestModels()[0]->getTimeout(), - $testCase->getTestModels()[1]->getTimeout(), - ]; - - $this->assertSame([150, 150], $actual); - }); - } - - public function testExplicitTestSuiteTestSuiteHasTimeoutIsSetOnAllTestModels() : void { - Loop::run(function() { - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestSuiteHasTimeout')); - - $this->assertCount(1, $results->getTestSuiteModels()); - $testSuite = $results->getTestSuiteModels()[0]; - $this->assertCount(2, $testSuite->getTestCaseModels()); - $this->assertCount(1, $testSuite->getTestCaseModels()[0]->getTestModels()); - $this->assertCount(1, $testSuite->getTestCaseModels()[1]->getTestModels()); - - $this->assertSame(125, $testSuite->getTestCaseModels()[0]->getTestModels()[0]->getTimeout()); - $this->assertSame(125, $testSuite->getTestCaseModels()[1]->getTestModels()[0]->getTimeout()); - }); - } - - public function hookPriorityProvider() : array { - return [ - [HookType::BeforeAll(), 'beforeAll'], - [HookType::AfterAll(), 'afterAll'], - [HookType::BeforeEach(), 'beforeEach'], - [HookType::AfterEach(), 'afterEach'] - ]; - } - - /** - * @dataProvider hookPriorityProvider - */ - public function testImplicitDefaultTestSuiteTestCaseHooksPriorityBeforeAll(HookType $hookType, string $typePrefix) : void { - Loop::run(function() use($hookType, $typePrefix) { - $results = yield $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseHooksPriority')); - - $testCase = $this->fetchTestCaseModel( - $results->getTestSuiteModels()[0], - ImplicitDefaultTestSuite\TestCaseHooksPriority\MyTestCase::class - ); - - $expected = [ - $typePrefix . 'One' => 1, - $typePrefix . 'Two' => 2, - $typePrefix . 'Three' => 3 - ]; - $hooks = $testCase->getHooks($hookType); - - $actual = []; - foreach ($hooks as $hook) { - $actual[$hook->getMethod()] = $hook->getPriority(); - } - - $this->assertEquals($expected, $actual); - }); - } - - public function suiteHookPriorityProvider() : array { - return array_merge( - $this->hookPriorityProvider(), - [ - [HookType::BeforeEachTest(), 'beforeEachTest'], - [HookType::AfterEachTest(), 'afterEachTest'] - ] - ); - - } - - /** - * @dataProvider suiteHookPriorityProvider - */ - public function testExplicitTestSuiteTestSuiteHookPriority(HookType $hookType, string $typePrefix) { - Loop::run(function() use($hookType, $typePrefix) { - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestSuiteHookPriority')); - - $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestSuiteHookPriority\MyTestSuite::class); - - $expected = [ - $typePrefix . 'One' => 1, - $typePrefix . 'Two' => 2, - $typePrefix . 'Three' => 3 - ]; - $hooks = $testSuite->getHooks($hookType); - $actual = []; - foreach ($hooks as $hook) { - $actual[$hook->getMethod()] = $hook->getPriority(); - } - - $this->assertEquals($expected, $actual); - }); - } - - public function testExplicitTestSuiteTestSuiteDefinesNamespaceToAttach() : void { - Loop::run(function() { - /** @var ParserResult $results */ - $results = yield $this->subject->parse($this->explicitTestSuitePath('TestSuiteDefinesNamespaceToAttach')); - - $this->assertCount(2, $results->getTestSuiteModels()); - - $implicitSuite = $this->fetchTestSuiteModel( - $results->getTestSuiteModels(), - ImplicitTestSuite::class - ); - $explicitSuite = $this->fetchTestSuiteModel( - $results->getTestSuiteModels(), - ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\MyTestSuite::class - ); - - $this->fetchTestCaseModel($implicitSuite, ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\MyTestCase::class); - $this->fetchTestCaseModel($implicitSuite, ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\HasImplicitTestSuite\MyTestCase::class); - $this->fetchTestCaseModel($explicitSuite, ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\HasExplicitTestSuite\MyTestCase::class); - }); - } - - /** - * @param TestSuiteModel[] $testSuites - * @param string $testSuiteClassName - * @return TestSuiteModel - */ - private function fetchTestSuiteModel(array $testSuites, string $testSuiteClassName) : TestSuiteModel { - foreach ($testSuites as $testSuite) { - if ($testSuite->getClass() === $testSuiteClassName) { - return $testSuite; - } - } - $this->fail('Expected the set of TestSuites to have a class matching . ' . $testSuiteClassName); - } - - private function fetchTestCaseModel(TestSuiteModel $testSuite, string $className) : TestCaseModel { - foreach ($testSuite->getTestCaseModels() as $testCaseModel) { - if ($testCaseModel->getClass() === $className) { - return $testCaseModel; - } - } - $this->fail('Expected ' . $testSuite->getClass() . ' to have TestCase ' . $className); - } - - private function fetchTestModel(TestCaseModel $model, string $methodName) : TestModel { - foreach ($model->getTestModels() as $testMethodModel) { - if ($testMethodModel->getMethod() === $methodName) { - return $testMethodModel; - } - } - $this->fail('Expected TestCase to have test ' . $methodName); - } - -} diff --git a/framework_test/Statistics/SummaryCalculatorTest.php b/framework_test/Statistics/SummaryCalculatorTest.php deleted file mode 100644 index d187c02..0000000 --- a/framework_test/Statistics/SummaryCalculatorTest.php +++ /dev/null @@ -1,406 +0,0 @@ -implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class - ]] - ]; - } - - /** - * @dataProvider aggregateSummaryTestSuiteNamesProvider - */ - public function testGetAggregateSummaryGetTestSuiteNames(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertEqualsCanonicalizing($expected, $calculator->getAggregateSummary()->getTestSuiteNames()); - }); - } - - public function aggregateSummaryTotalTestSuiteCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 3] - ]; - } - - /** - * @dataProvider aggregateSummaryTotalTestSuiteCountProvider - */ - public function testGetAggregateSummaryGetTotalTestSuiteCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertSame($expected, $calculator->getAggregateSummary()->getTotalTestSuiteCount()); - }); - } - - public function aggregateSummaryDisabledTestSuiteCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 0], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 1] - ]; - } - - /** - * @dataProvider aggregateSummaryDisabledTestSuiteCountProvider - */ - public function testGetAggregateSummaryGetDisabledTestSuiteCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertSame($expected, $calculator->getAggregateSummary()->getDisabledTestSuiteCount()); - }); - } - - public function aggregateSummaryTotalTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), 3], - [$this->implicitDefaultTestSuitePath('MultipleTestCase'), 3] - ]; - } - - /** - * @dataProvider aggregateSummaryTotalTestCaseCountProvider - */ - public function testGetAggregateSummaryGetTestCaseCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertSame($expected, $calculator->getAggregateSummary()->getTotalTestCaseCount()); - }); - } - - public function aggregateSummaryDisabledTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 1], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 2] - ]; - } - - /** - * @dataProvider aggregateSummaryDisabledTestCaseCountProvider - */ - public function testGetAggregateSummaryGetDisabledTestCaseCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertSame($expected, $calculator->getAggregateSummary()->getDisabledTestCaseCount()); - }); - } - - public function aggregateSummaryTotalTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('MultipleTest'), 3], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), 9] - ]; - } - - /** - * @dataProvider aggregateSummaryTotalTestCountProvider - */ - public function testGetAggregateSummaryGetTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertSame($expected, $calculator->getAggregateSummary()->getTotalTestCount()); - }); - } - - public function aggregateSummaryDisabledTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('TestDisabled'), 1], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 3] - ]; - } - - /** - * @dataProvider aggregateSummaryDisabledTestCountProvider - */ - public function testGetAggregateSummaryGetDisabledTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $this->assertSame($expected, $calculator->getAggregateSummary()->getDisabledTestCount()); - }); - } - - public function testGetAggregateSummarySameObject() : void { - Loop::run(function() { - $results = yield (new StaticAnalysisParser())->parse($this->implicitDefaultTestSuitePath('SingleTest')); - $calculator = new SummaryCalculator($results); - - $this->assertSame($calculator->getAggregateSummary(), $calculator->getAggregateSummary()); - }); - } - - public function testGetTestSuiteSummaryGetTestSuiteName() { - Loop::run(function() { - $results = yield (new StaticAnalysisParser())->parse($this->implicitDefaultTestSuitePath('SingleTest')); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestSuiteSummary(ImplicitTestSuite::class); - $this->assertSame(ImplicitTestSuite::class, $testSuiteSummary->getTestSuiteName()); - }); - } - - public function suiteSummaryTestCaseNamesProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, [ImplicitDefaultTestSuite\SingleTest\MyTestCase::class]], - [$this->implicitDefaultTestSuitePath('MultipleTest'), ImplicitTestSuite::class, [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, [ - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, [ - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class - ]] - ]; - } - - /** - * @dataProvider suiteSummaryTestCaseNamesProvider - */ - public function testGetTestSuiteSummaryGetTestCaseNames(string $path, string $testSuite, array $expected) : void { - Loop::run(function() use($path, $testSuite, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); - $this->assertEqualsCanonicalizing($expected, $testSuiteSummary->getTestCaseNames()); - }); - } - - public function suiteSummaryTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 1], - [$this->implicitDefaultTestSuitePath('MultipleTest'), ImplicitTestSuite::class, 1], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 2], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 3], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 2] - ]; - } - - /** - * @dataProvider suiteSummaryTestCaseCountProvider - */ - public function testGetTestSuiteSummaryGetTestCaseCount(string $path, string $testSuite, int $expected) { - Loop::run(function() use($path, $testSuite, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); - $this->assertSame($expected, $testSuiteSummary->getTestCaseCount()); - }); - } - - public function suiteSummaryDisabledTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 0], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), ImplicitTestSuite::class, 1], - [$this->explicitTestSuitePath('TestSuiteDisabled'), ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class, 2], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 0] - ]; - } - - /** - * @dataProvider suiteSummaryDisabledTestCaseCountProvider - */ - public function testGetTestSuiteSummaryGetDisabledTestCaseCount(string $path, string $testSuite, int $expected) { - Loop::run(function() use($path, $testSuite, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); - $this->assertSame($expected, $testSuiteSummary->getDisabledTestCaseCount()); - }); - } - - public function suiteSummaryTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 1], - [$this->implicitDefaultTestSuitePath('MultipleTestCase'), ImplicitTestSuite::class, 4], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), ImplicitTestSuite::class, 9], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 5], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 3], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 2] - ]; - } - - /** - * @dataProvider suiteSummaryTestCountProvider - */ - public function testGetTestSuiteSummaryGetTestCount(string $path, string $testSuite, int $expected) : void { - Loop::run(function() use($path, $testSuite, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); - $this->assertSame($expected, $testSuiteSummary->getTestCount()); - }); - } - - public function suiteSummaryDisabledTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 0], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), ImplicitTestSuite::class, 3], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 2], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 1] - ]; - } - - /** - * @dataProvider suiteSummaryDisabledTestCountProvider - */ - public function testGetTestSuiteSummaryGetDisabledTestCount(string $path, string $testSuite, int $expected) : void { - Loop::run(function() use($path, $testSuite, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); - $this->assertSame($expected, $testSuiteSummary->getDisabledTestCount()); - }); - } - - public function caseSummaryTestSuiteNameProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, ImplicitTestSuite::class], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class, ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class] - ]; - } - - /** - * @dataProvider caseSummaryTestSuiteNameProvider - */ - public function testGetTestCaseSummaryGetTestSuiteName(string $path, string $testCase, string $expected) : void { - Loop::run(function() use($path, $testCase, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testSuiteSummary = $calculator->getTestCaseSummary($testCase); - $this->assertSame($expected, $testSuiteSummary->getTestSuiteName()); - }); - } - - /** - * @dataProvider caseSummaryTestSuiteNameProvider - */ - public function testGetTestCaseSummaryGetTestCaseName(string $path, string $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testCaseSummary = $calculator->getTestCaseSummary($expected); - $this->assertSame($expected, $testCaseSummary->getTestCaseName()); - }); - } - - public function caseSummaryTestNamesProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class . '::ensureSomethingHappens' - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class, [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testOne', - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testTwo', - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::disabledTest', - ]] - ]; - } - - /** - * @dataProvider caseSummaryTestNamesProvider - */ - public function testGetTestCaseSummaryGetTestNames(string $path, string $testCase, array $expected) : void { - Loop::run(function() use($path, $testCase, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testCaseSummary = $calculator->getTestCaseSummary($testCase); - $this->assertEqualsCanonicalizing($expected, $testCaseSummary->getTestNames()); - }); - } - - public function caseSummaryTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, 1], - [$this->implicitDefaultTestSuitePath('MultipleTestCase'), ImplicitDefaultTestSuite\MultipleTestCase\FooTestCase::class, 2], - [$this->implicitDefaultTestSuitePath('MultipleTest'), ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class, 3], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, 1] - ]; - } - - /** - * @dataProvider caseSummaryTestCountProvider - */ - public function testGetTestCaseSummaryGetTestCount(string $path, string $testCase, int $expected) : void { - Loop::run(function() use($path, $testCase, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testCaseSummary = $calculator->getTestCaseSummary($testCase); - $this->assertSame($expected, $testCaseSummary->getTestCount()); - }); - } - - public function caseSummaryDisabledTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, 1], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class, 3] - ]; - } - - /** - * @dataProvider caseSummaryDisabledTestCountProvider - */ - public function testGetTestCaseSummaryGetDisabledTestCount(string $path, string $testCase, int $expected) : void { - Loop::run(function() use($path, $testCase, $expected) { - $results = yield (new StaticAnalysisParser())->parse($path); - $calculator = new SummaryCalculator($results); - - $testCaseSummary = $calculator->getTestCaseSummary($testCase); - $this->assertSame($expected, $testCaseSummary->getDisabledTestCount()); - }); - } -} \ No newline at end of file diff --git a/framework_test/Stub/AssertNotTestCase.php b/framework_test/Stub/AssertNotTestCase.php deleted file mode 100644 index 3025a65..0000000 --- a/framework_test/Stub/AssertNotTestCase.php +++ /dev/null @@ -1,28 +0,0 @@ -assert()->not()->stringEquals('foo', 'bar'); - } - - public function doFailingNotAssertions() { - $this->assert()->not()->stringEquals('foo', 'foo'); - } - - public function doBothAssertions() { - $this->assert()->stringEquals('bar', 'bar'); - $this->assert()->not()->stringEquals('foo', 'bar'); - $this->assert()->stringEquals('foo', 'foo'); - } - - public function doAsyncNotAssertion() { - yield $this->asyncAssert()->not()->intEquals(1, new Success(2)); - } - -} \ No newline at end of file diff --git a/framework_test/Stub/CustomAssertionTestCase.php b/framework_test/Stub/CustomAssertionTestCase.php deleted file mode 100644 index 0a6763a..0000000 --- a/framework_test/Stub/CustomAssertionTestCase.php +++ /dev/null @@ -1,17 +0,0 @@ -assert()->myCustomAssertion(1, 2, 3); - } - - public function doCustomAsyncAssertion() { - yield $this->asyncAssert()->myCustomAssertion(1, 2, 3); - } - -} \ No newline at end of file diff --git a/framework_test/Stub/FailingTestCase.php b/framework_test/Stub/FailingTestCase.php deleted file mode 100644 index 06c80d8..0000000 --- a/framework_test/Stub/FailingTestCase.php +++ /dev/null @@ -1,22 +0,0 @@ -assert()->stringEquals('foo', 'bar'); - } - - public function doAsyncFailure() { - yield $this->asyncAssert()->stringEquals('foo', new Success('bar')); - } - - public function doFailureWithCustomMessage() { - $this->assert()->stringEquals('foo', 'bar', 'my custom message'); - } - -} \ No newline at end of file diff --git a/framework_test/TestCaseTest.php b/framework_test/TestCaseTest.php deleted file mode 100644 index 216bc27..0000000 --- a/framework_test/TestCaseTest.php +++ /dev/null @@ -1,235 +0,0 @@ -getSubjectAndContexts(FailingTestCase::class); - $assertionException = null; - try { - $subject->doFailure(); - } catch (AssertionFailedException $exception) { - $assertionException = $exception; - } finally { - $this->assertNotNull($assertionException); - $this->assertSame('Failed asserting type "string" equals type "string"', $assertionException->getMessage()); - $this->assertSame(__DIR__ . '/Stub/FailingTestCase.php', $assertionException->getAssertionFailureFile()); - $this->assertSame(11, $assertionException->getAssertionFailureLine()); - } - } - - public function testFailingAssertionHasCustomMessage() { - [$subject] = $this->getSubjectAndContexts(FailingTestCase::class); - $assertionException = null; - try { - $subject->doFailureWithCustomMessage(); - } catch (AssertionFailedException $exception) { - $assertionException = $exception; - } finally { - $this->assertNotNull($assertionException); - $this->assertSame('my custom message', $assertionException->getMessage()); - $this->assertSame(__DIR__ . '/Stub/FailingTestCase.php', $assertionException->getAssertionFailureFile()); - $this->assertSame(19, $assertionException->getAssertionFailureLine()); - } - } - - public function testFailingAsyncAssertionHasFileAndLine() { - Loop::run(function() { - [$subject] = $this->getSubjectAndContexts(FailingTestCase::class); - - $assertionException = null; - try { - yield call([$subject, 'doAsyncFailure']); - } catch (AssertionFailedException $exception) { - $assertionException = $exception; - } finally { - $this->assertNotNull($assertionException); - $this->assertSame('Failed asserting type "string" equals type "string"', $assertionException->getMessage()); - $this->assertSame(__DIR__ . '/Stub/FailingTestCase.php', $assertionException->getAssertionFailureFile()); - $this->assertSame(15, $assertionException->getAssertionFailureLine()); - } - }); - } - - public function testRunningOnlyNotAssertionPassing() { - Loop::run(function() { - /** @var AssertNotTestCase $subject */ - /** @var AssertionContext $assertionContext */ - /** @var AsyncAssertionContext $asyncAssertionContext */ - [$subject, $assertionContext, $asyncAssertionContext] = $this->getSubjectAndContexts(AssertNotTestCase::class); - - $subject->doNotAssertion(); - $this->assertEquals(1, $assertionContext->getAssertionCount()); - - yield call(fn() => $subject->doAsyncNotAssertion()); - $this->assertEquals(1, $asyncAssertionContext->getAssertionCount()); - }); - } - - public function testRunningOnlyNotAssertionFailing() { - Loop::run(function() { - /** @var AssertNotTestCase $subject */ - [$subject] = $this->getSubjectAndContexts(AssertNotTestCase::class); - - $assertionException = null; - try{ - $subject->doFailingNotAssertions(); - } catch (AssertionFailedException $exception) { - $assertionException = $exception; - } finally { - $this->assertNotNull($assertionException); - $this->assertSame('Failed asserting type "string" does not equal type "string"', $assertionException->getMessage()); - $this->assertSame(__DIR__ . '/Stub/AssertNotTestCase.php', $assertionException->getAssertionFailureFile()); - $this->assertSame(15, $assertionException->getAssertionFailureLine()); - } - }); - } - - public function testRunningBothNotAndRegularAssertionPassing() { - Loop::run(function() { - /** @var AssertNotTestCase $subject */ - /** @var AssertionContext $assertionContext */ - [$subject, $assertionContext] = $this->getSubjectAndContexts(AssertNotTestCase::class); - - $subject->doBothAssertions(); - - $this->assertSame(3, $assertionContext->getAssertionCount()); - }); - } - - public function testRunningCustomAssertions() { - Loop::run(function() { - /** @var CustomAssertionTestCase $subject */ - /** @var AssertionContext $assertionContext */ - /** @var CustomAssertionContext $customAssertionContext */ - [$subject, $assertionContext, $_, $customAssertionContext] = $this->getSubjectAndContexts(CustomAssertionTestCase::class); - - $assertion = $this->getMockBuilder(Assertion::class)->getMock(); - $assertResult = $this->getMockBuilder(AssertionResult::class)->getMock(); - $assertResult->expects($this->once())->method('isSuccessful')->willReturn(true); - $assertion->expects($this->once())->method('assert')->willReturn($assertResult); - $state = new \stdClass(); - $state->args = null; - $customAssertionContext->registerAssertion('myCustomAssertion', function(...$args) use($assertion, $state) { - $state->args = $args; - return $assertion; - }); - - $subject->doCustomAssertion(); - - $this->assertSame(1, $assertionContext->getAssertionCount()); - $this->assertSame([1,2,3], $state->args); - }); - } - - public function testRunningCustomAsyncAssertions() { - Loop::run(function() { - /** @var CustomAssertionTestCase $subject */ - /** @var AsyncAssertionContext $asyncAssertionContext */ - /** @var CustomAssertionContext $customAssertionContext */ - [$subject, $_, $asyncAssertionContext, $customAssertionContext] = $this->getSubjectAndContexts(CustomAssertionTestCase::class); - - $assertion = $this->getMockBuilder(AsyncAssertion::class)->getMock(); - $assertResult = $this->getMockBuilder(AssertionResult::class)->getMock(); - $assertResult->expects($this->once())->method('isSuccessful')->willReturn(true); - $assertion->expects($this->once())->method('assert')->willReturn(new Success($assertResult)); - $state = new \stdClass(); - $state->args = null; - $customAssertionContext->registerAsyncAssertion('myCustomAssertion', function(...$args) use($assertion, $state) { - $state->args = $args; - return $assertion; - }); - - yield call(fn() => $subject->doCustomAsyncAssertion()); - - $this->assertSame(1, $asyncAssertionContext->getAssertionCount()); - $this->assertSame([1,2,3], $state->args); - }); - } - - public function testCreatingMockWithNoBridge() { - Loop::run(function() { - /** @var MockAwareTestCase $subject */ - [$subject] = $this->getSubjectAndContexts(MockAwareTestCase::class); - - $this->expectException(InvalidStateException::class); - $this->expectExceptionMessage('Attempted to create a mock but no MockBridge was defined. Please ensure you\'ve configured a mockBridge in your configuration.'); - - $subject->checkCreatingMock(); - }); - } - - public function testCreatingMockWithBridge() { - Loop::run(function() { - $mockBridge = new MockBridgeStub(); - /** @var MockAwareTestCase $subject */ - [$subject] = $this->getSubjectAndContexts(MockAwareTestCase::class, $mockBridge); - - $subject->checkCreatingMock(); - - $this->assertNotNull($subject->getCreatedMock()); - $this->assertSame(LoggerInterface::class, $subject->getCreatedMock()->class); - - // We do not expect initialize or finalize to be called here because that's controlled by the TestSuiteRunner - $this->assertSame([ - 'createMock ' . LoggerInterface::class, - ], $mockBridge->getCalls()); - }); - } - - public function getSubjectAndContexts(string $testCase, MockBridge $mockBridge = null) { - $customAssertionContext = (new \ReflectionClass(CustomAssertionContext::class))->newInstanceWithoutConstructor(); - $reflectedAssertionContext = new \ReflectionClass(AssertionContext::class); - $assertionContext = $reflectedAssertionContext->newInstanceWithoutConstructor(); - $assertionContextConstructor = $reflectedAssertionContext->getConstructor(); - $assertionContextConstructor->setAccessible(true); - $assertionContextConstructor->invoke($assertionContext, $customAssertionContext); - - $reflectedAsyncAssertionContext = new \ReflectionClass(AsyncAssertionContext::class); - $asyncAssertionContext = $reflectedAsyncAssertionContext->newInstanceWithoutConstructor(); - $asyncAssertionContextConstructor = $reflectedAsyncAssertionContext->getConstructor(); - $asyncAssertionContextConstructor->setAccessible(true); - $asyncAssertionContextConstructor->invoke($asyncAssertionContext, $customAssertionContext); - - $reflectedExpectationContext = new \ReflectionClass(ExpectationContext::class); - $fakeTestModel = new TestModel('SomeClass', 'someMethod'); - $expectationContext = $reflectedExpectationContext->newInstanceWithoutConstructor(); - $expectationContextConstructor = $reflectedExpectationContext->getConstructor(); - $expectationContextConstructor->setAccessible(true); - $expectationContextConstructor->invoke($expectationContext, $fakeTestModel, $assertionContext, $asyncAssertionContext, $mockBridge); - - $reflectedSubject = new \ReflectionClass($testCase); - $constructor = $reflectedSubject->getConstructor(); - $constructor->setAccessible(true); - $subject = $reflectedSubject->newInstanceWithoutConstructor(); - $constructor->invoke( - $subject, - (new \ReflectionClass(ImplicitTestSuite::class))->newInstanceWithoutConstructor(), - $assertionContext, - $asyncAssertionContext, - $expectationContext, - $mockBridge - ); - - return [$subject, $assertionContext, $asyncAssertionContext, $customAssertionContext, $expectationContext]; - } -} \ No newline at end of file diff --git a/framework_test/TestSuiteErrorsTest.php b/framework_test/TestSuiteErrorsTest.php deleted file mode 100644 index e2e7427..0000000 --- a/framework_test/TestSuiteErrorsTest.php +++ /dev/null @@ -1,156 +0,0 @@ -buildTestSuiteRunner(); - } - - public function testImplicitDefaultTestSuiteExceptionThrowingBeforeAllHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingBeforeAll'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestCaseSetUpException::class); - $class = ImplicitDefaultTestSuite\ExceptionThrowingBeforeAll\MyTestCase::class; - $this->expectExceptionMessage('Failed setting up "' . $class . '::beforeAll" #[BeforeAll] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the class beforeAll".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testImplicitDefaultTestSuiteExceptionThrowingAfterAllHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingAfterAll'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestCaseTearDownException::class); - $class = ImplicitDefaultTestSuite\ExceptionThrowingAfterAll\MyTestCase::class; - $this->expectExceptionMessage('Failed tearing down "' . $class . '::afterAll" #[AfterAll] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the class afterAll".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testImplicitDefaultTestSuiteExceptionThrowingBeforeEachHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingBeforeEach'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestSetUpException::class); - $class = ImplicitDefaultTestSuite\ExceptionThrowingBeforeEach\MyTestCase::class; - $this->expectExceptionMessage('Failed setting up "' . $class . '::beforeEach" #[BeforeEach] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the object beforeEach".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testImplicitDefaultTestSuiteExceptionThrowingAfterEachHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingAfterEach'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestTearDownException::class); - $class = ImplicitDefaultTestSuite\ExceptionThrowingAfterEach\MyTestCase::class; - $this->expectExceptionMessage('Failed tearing down "' . $class . '::afterEach" #[AfterEach] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the object afterEach".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testExplicitTestSuiteExceptionThrowingTestSuiteBeforeAllHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteBeforeAll'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestSuiteSetUpException::class); - $class = ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeAll\MyTestSuite::class; - $this->expectExceptionMessage('Failed setting up "' . $class . '::throwException" #[BeforeAll] hook with exception of type "RuntimeException" with code 0 and message "Thrown in AttachToTestSuite".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testExplicitTestSuiteExceptionThrowingTestSuiteBeforeEachHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteBeforeEach'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestSuiteSetUpException::class); - $class = ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEach\MyTestSuite::class; - $this->expectExceptionMessage('Failed setting up "' . $class . '::throwEachException" #[BeforeEach] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite BeforeEach".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testExplicitTestSuiteExceptionThrowingTestSuiteAfterEachHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteAfterEach'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestSuiteTearDownException::class); - $class = ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEach\MyTestSuite::class; - $this->expectExceptionMessage('Failed tearing down "' . $class . '::throwEachException" #[AfterEach] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite AfterEach".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testExplicitTestSuiteExceptionThrowingTestSuiteAfterEachTestHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteAfterEachTest'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestTearDownException::class); - $class = ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEachTest\MyTestSuite::class; - $this->expectExceptionMessage('Failed tearing down "' . $class . '::throwEachTestException" #[AfterEachTest] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite AfterEachTest".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testExplicitTestSuiteExceptionThrowingTestSuiteBeforeEachTestHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteBeforeEachTest'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestSetUpException::class); - $class = ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEachTest\MyTestSuite::class; - $this->expectExceptionMessage('Failed setting up "' . $class . '::throwEachTestException" #[BeforeEachTest] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite BeforeEachTest".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testExplicitTestSuiteExceptionThrowingTestSuiteAfterAllHaltsTestProcessing() { - Loop::run(function() { - $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteAfterAll'); - $results = yield $this->parser->parse($dir); - - $this->expectException(TestSuiteTearDownException::class); - $class = ExplicitTestSuite\ExceptionThrowingTestSuiteAfterAll\MyTestSuite::class; - $this->expectExceptionMessage('Failed tearing down "' . $class . '::throwException" #[AfterAll] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite AfterAll".'); - - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - -} \ No newline at end of file diff --git a/framework_test/TestSuiteRunnerScaffolding.php b/framework_test/TestSuiteRunnerScaffolding.php deleted file mode 100644 index 9449a27..0000000 --- a/framework_test/TestSuiteRunnerScaffolding.php +++ /dev/null @@ -1,34 +0,0 @@ -parser = new StaticAnalysisParser(); - $this->emitter = new AmpEventEmitter(); - /** @noinspection PhpFieldAssignmentTypeMismatchInspection */ - $this->customAssertionContext = (new ReflectionClass(CustomAssertionContext::class))->newInstanceWithoutConstructor(); - $this->mockBridgeFactory = new SupportedMockBridgeFactory(new Injector()); - $this->testSuiteRunner = new TestSuiteRunner( - $this->emitter, - $this->customAssertionContext, - new NullRandomizer(), - $this->mockBridgeFactory - ); - } - -} \ No newline at end of file diff --git a/framework_test/TestSuiteRunnerStatisticsTest.php b/framework_test/TestSuiteRunnerStatisticsTest.php deleted file mode 100644 index 7d99a57..0000000 --- a/framework_test/TestSuiteRunnerStatisticsTest.php +++ /dev/null @@ -1,1374 +0,0 @@ -buildTestSuiteRunner(); - } - - public function testTestProcessingStartedHasAggregateSummary() { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('TestCaseDisabled')); - $state = new stdClass(); - $state->data = []; - $this->emitter->on(Events::PROCESSING_STARTED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingStartedEvent $testStartedEvent */ - $testStartedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingStartedEvent::class, $testStartedEvent); - $this->assertInstanceOf(AggregateSummary::class, $testStartedEvent->getTarget()); - }); - } - - public function processedAggregateSummaryTestSuiteInfoProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitTestSuite::class, ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class - ]] - ]; - } - - /** - * @dataProvider processedAggregateSummaryTestSuiteInfoProvider - */ - public function testTestProcessingFinishedHasProcessedAggregateSummaryWithCorrectTestSuiteNames(string $path, array $expected) { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - - $summary = $testFinishedEvent->getTarget(); - - $this->assertEqualsCanonicalizing( - $expected, - $summary->getTestSuiteNames() - ); - }); - } - - public function processedAggregateSummaryWithCorrectTotalTestSuiteCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 3] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectTotalTestSuiteCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectTotalTestSuiteCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getTotalTestSuiteCount()); - }); - } - - - public function processedAggregateSummaryWithCorrectDisabledTestSuiteCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 0], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 1] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectDisabledTestSuiteCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectDisabledTestSuiteCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getDisabledTestSuiteCount()); - }); - } - - public function processedAggregateSummaryWithCorrectTotalTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 7], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 2] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectTotalTestCaseCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectTotalTestCaseCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getTotalTestCaseCount()); - }); - } - - public function processedAggregateSummaryWithCorrectDisabledTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 0], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 2], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 1] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectDisabledTestCaseCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectDisabledTestCaseCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getDisabledTestCaseCount()); - }); - } - - public function processedAggregateSummaryWithCorrectTotalTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 13], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 3], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 3], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), 1] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectTotalTestCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectTotalTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getTotalTestCount()); - }); - } - - public function processedAggregateSummaryWithCorrectDisabledTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 3], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 3], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 3], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), 0] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectDisabledTestCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectDisabledTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getDisabledTestCount()); - }); - } - - public function processedAggregateSummaryWithCorrectPassedTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 8], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 0], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 0], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), 0] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectPassedTestCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectPassedTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getPassedTestCount()); - }); - } - - public function processedAggregateSummaryWithCorrectFailedTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 1], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 0], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 0], - [$this->implicitDefaultTestSuitePath('FailedAssertion'), 1], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), 0] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectFailedTestCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectFailedTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getFailedTestCount()); - }); - } - - public function processedAggregateSummaryWithCorrectErroredTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 1], - [$this->explicitTestSuitePath('TestSuiteDisabled'), 0], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), 0], - [$this->implicitDefaultTestSuitePath('FailedAssertion'), 0], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), 1] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectErroredTestCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectErroredTestCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getErroredTestCount()); - }); - } - - public function processedAggregateSummaryWithCorrectAssertionCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 1], - [$this->implicitDefaultTestSuitePath('MultipleTest'), 3], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 4], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), 18] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectAssertionCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectAssertionCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getAssertionCount()); - }); - } - - public function processedAggregateSummaryWithCorrectAsyncAssertionCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), 0], - [$this->implicitDefaultTestSuitePath('MultipleTest'), 0], - [$this->implicitDefaultTestSuitePath('KitchenSink'), 6], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), 4] - ]; - } - - /** - * @dataProvider processedAggregateSummaryWithCorrectAsyncAssertionCountProvider - */ - public function testProcessedAggregateSummaryWithCorrectAsyncAssertionCount(string $path, int $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->data[] = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $state->data); - /** @var ProcessingFinishedEvent $testFinishedEvent */ - $testFinishedEvent = $state->data[0]; - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); - $this->assertSame($expected, $testFinishedEvent->getTarget()->getAsyncAssertionCount()); - }); - } - - public function processedTestSuiteSummaryTestSuiteNameProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryTestSuiteNameProvider - */ - public function testProcessedTestSuiteSummaryHasCorrectTestSuiteName(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $state = new stdClass(); - $state->data = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use($state) { - $state->data[] = $event->getTarget()->getTestSuiteName(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEqualsCanonicalizing($expected, $state->data); - }); - } - - public function processedTestSuiteSummaryTestCaseNamesProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitTestSuite::class => [ImplicitDefaultTestSuite\SingleTest\MyTestCase::class] - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class => [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class, - ], - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class => [ - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class, - ], - ImplicitTestSuite::class => [ - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class - ] - ]], - [$this->explicitTestSuitePath('TestSuiteDisabled'), [ - ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => [ - ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class, - ExplicitTestSuite\TestSuiteDisabled\SecondTestCase::class - ] - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryTestCaseNamesProvider - */ - public function testProcessedTestSuiteSummaryHasTestCaseNames(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getTestCaseNames(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $testSuites = array_keys($actual); - - $this->assertNotEmpty($testSuites); - - foreach ($testSuites as $testSuite) { - $this->assertArrayHasKey($testSuite, $expected); - - $this->assertEqualsCanonicalizing($expected[$testSuite], $actual[$testSuite]); - } - - }); - } - - public function processedTestSuiteSummaryTotalTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitTestSuite::class => 1, - ]], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), [ - ImplicitTestSuite::class => 3 - ]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 - ]], - [$this->explicitTestSuitePath('TestSuiteDisabled'), [ - ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 2 - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryTotalTestCaseCountProvider - */ - public function testProcessedTestSuiteSummaryHasTotalTestCaseCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getTestCaseCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryDisabledTestCaseCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitTestSuite::class => 0, - ]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ - ImplicitTestSuite::class => 1 - ]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 - ]], - [$this->explicitTestSuitePath('TestSuiteDisabled'), [ - ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 2 - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryDisabledTestCaseCountProvider - */ - public function testProcessedTestSuiteSummaryHasDisabledTestCaseCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getDisabledTestCaseCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryTotalTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitTestSuite::class => 1, - ]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ - ImplicitTestSuite::class => 3 - ]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 - ]], - [$this->explicitTestSuitePath('TestSuiteDisabled'), [ - ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 3 - ]], - [$this->implicitDefaultTestSuitePath('TestDisabled'), [ - ImplicitTestSuite::class => 2 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitTestSuite::class => 1 - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryTotalTestCountProvider - */ - public function testProcessedTestSuiteSummaryHasTotalTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryDisabledTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitTestSuite::class => 0, - ]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ - ImplicitTestSuite::class => 3 - ]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 - ]], - [$this->explicitTestSuitePath('TestSuiteDisabled'), [ - ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 3 - ]], - [$this->implicitDefaultTestSuitePath('TestDisabled'), [ - ImplicitTestSuite::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitTestSuite::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryDisabledTestCountProvider - */ - public function testProcessedTestSuiteSummaryHasDisabledTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getDisabledTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryPassedTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class => 1,]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 - ]], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 8]], - [$this->implicitDefaultTestSuitePath('TestDisabled'), [ - ImplicitTestSuite::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitTestSuite::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryPassedTestCountProvider - */ - public function testProcessedTestSuiteSummaryHasPassedTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getPassedTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryFailedTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 1,]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 1]], - [$this->implicitDefaultTestSuitePath('FailedNotAssertion'), [ImplicitTestSuite::class => 1]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ImplicitTestSuite::class => 0]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryFailedTestCountProvider - */ - public function testProcessedTestSuiteSummaryHasFailedTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getFailedTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryErroredTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 0]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 0]], - [$this->implicitDefaultTestSuitePath('FailedNotAssertion'), [ImplicitTestSuite::class => 0]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ImplicitTestSuite::class => 1]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryErroredTestCountProvider - */ - public function testProcessedTestSuiteSummaryHasErroredTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getErroredTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryAssertionCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 1,]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 18]], - [$this->implicitDefaultTestSuitePath('FailedNotAssertion'), [ImplicitTestSuite::class => 1]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryAssertionCountProvider - */ - public function testProcessedTestSuiteSummaryHasAssertionCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getAssertionCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestSuiteSummaryAsyncAssertionCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 0,]], - [$this->implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], - [$this->explicitTestSuitePath('TestCaseDefinesTestSuite'), [ - ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, - ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 4]], - [$this->implicitDefaultTestSuitePath('SingleTestAsyncAssertion'), [ImplicitTestSuite::class => 1]] - ]; - } - - /** - * @dataProvider processedTestSuiteSummaryAsyncAssertionCountProvider - */ - public function testProcessedTestSuiteSummaryHasAsyncAssertionCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function(TestSuiteFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestSuiteName()] = $event->getTarget()->getAsyncAssertionCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryTestSuiteNameProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => ImplicitTestSuite::class - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => ImplicitTestSuite::class, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => ImplicitTestSuite::class - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryTestSuiteNameProvider - */ - public function testProcessedTestCaseSummaryHasCorrectTestSuiteName(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getTestSuiteName(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryTestNamesProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class . '::ensureSomethingHappens' - ] - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testOne', - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testTwo', - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::disabledTest' - ], - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class . '::checkTwo', - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class . '::checkTwoDisabled' - ], - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class . '::isBestHobbit', - ], - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class . '::isBestHobbit' - ], - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class . '::isBestHobbit' - ], - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#0', - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#1', - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#2', - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#3' - ], - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => [ - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class . '::throwException' - ] - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryTestNamesProvider - */ - public function testProcessedTestCaseSummaryHasCorrectTestNames(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getTestNames(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 3, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 2, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 4, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 1 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryTestCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryDisabledTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryDisabledTestCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectDisabledTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getDisabledTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryPassedTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 2, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 4, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryPassedTestCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectPassedTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getPassedTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryFailedTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ - ImplicitDefaultTestSuite\FailedAssertion\MyTestCase::class => 1, - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryFailedTestCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectFailedTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getFailedTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryErroredTestCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ - ImplicitDefaultTestSuite\FailedAssertion\MyTestCase::class => 0, - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ - ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 1 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryErroredTestCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectErroredTestCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getErroredTestCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryAssertionCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 1 - ]], - [$this->implicitDefaultTestSuitePath('FailedAssertion'), [ - ImplicitDefaultTestSuite\FailedAssertion\MyTestCase::class => 1, - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class =>1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryAssertionCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectAssertionCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getAssertionCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function processedTestCaseSummaryAsyncAssertionCountProvider() : array { - return [ - [$this->implicitDefaultTestSuitePath('SingleTest'), [ - ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 - ]], - [$this->implicitDefaultTestSuitePath('SingleTestAsyncAssertion'), [ - ImplicitDefaultTestSuite\SingleTestAsyncAssertion\MyTestCase::class => 1, - ]], - [$this->implicitDefaultTestSuitePath('KitchenSink'), [ - ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 1, - ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class =>1, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 4, - ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 - ]] - ]; - } - - /** - * @dataProvider processedTestCaseSummaryAsyncAssertionCountProvider - */ - public function testProcessedTestCaseSummaryHasCorrectAsyncAssertionCount(string $path, array $expected) : void { - Loop::run(function() use($path, $expected) { - $results = yield $this->parser->parse($path); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getAsyncAssertionCount(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - ksort($expected); - ksort($actual); - $this->assertEquals($expected, $actual); - }); - } - - public function testProcessedAggregateSummaryHasDuration() { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); - $state = new stdClass(); - $state->event = null; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->event = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $state->event); - $this->assertGreaterThan(600, $state->event->getTarget()->getDuration()->asMilliseconds()); - }); - } - - public function testTestSuiteSummaryHasDuration() : void { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); - $state = new stdClass(); - $state->event = null; - - $this->emitter->on(Events::TEST_SUITE_FINISHED, function($event) use($state) { - $state->event = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertInstanceOf(TestSuiteFinishedEvent::class, $state->event); - $this->assertGreaterThan(600, $state->event->getTarget()->getDuration()->asMilliseconds()); - }); - } - - public function testTestCaseSummaryHasDuration() : void { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); - $actual = []; - - $this->emitter->on(Events::TEST_CASE_FINISHED, function(TestCaseFinishedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCaseName()] = $event->getTarget()->getDuration()->asMilliseconds(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $expected = [ - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\FirstTestCase::class => 99, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\SecondTestCase::class => 199, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class => 299 - ]; - - foreach ($expected as $testCase => $duration) { - $this->assertGreaterThanOrEqual($duration, $actual[$testCase]); - } - }); - } - - public function testTestResultHasDuration() : void { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); - $actual = []; - - $this->emitter->on(Events::TEST_PROCESSED, function(TestProcessedEvent $event) use(&$actual) { - $actual[$event->getTarget()->getTestCase()::class . '::' . $event->getTarget()->getTestMethod()] = $event->getTarget()->getDuration()->asMilliseconds(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $expected = [ - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\FirstTestCase::class . '::checkOne' => 99, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\SecondTestCase::class . '::checkOne' => 99, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\SecondTestCase::class . '::checkTwo' => 99, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class . '::checkOne' => 99, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class . '::checkTwo' => 99, - ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class . '::checkThree' => 99 - ]; - - foreach ($expected as $testCase => $duration) { - $this->assertGreaterThanOrEqual($duration, $actual[$testCase], $testCase . ' did not execute long enough'); - } - }); - } - - public function testDisabledTestHasZeroDuration() : void { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('TestDisabled')); - $actual = []; - - $this->emitter->on(Events::TEST_DISABLED, function(TestDisabledEvent $event) use(&$actual) { - $actual[] = $event->getTarget()->getDuration()->asMilliseconds(); - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertCount(1, $actual); - $this->assertSame(0.0, $actual[0]); - }); - } - - public function testProcessedAggregateSummaryHasMemoryUsageInBytes() { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('SingleTest')); - $state = new stdClass(); - $state->event = null; - - $this->emitter->on(Events::PROCESSING_FINISHED, function($event) use($state) { - $state->event = $event; - }); - - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertInstanceOf(ProcessingFinishedEvent::class, $state->event); - $this->assertGreaterThan(1000, $state->event->getTarget()->getMemoryUsageInBytes()); - }); - } - - public function testTestCaseSummaryMockBridgeAssertionCount() { - Loop::run(function() { - $results = yield $this->parser->parse($this->implicitDefaultTestSuitePath('MockeryTestNoAssertion')); - $state = new stdClass(); - $state->event = null; - $this->emitter->on(Events::TEST_PROCESSED, function($event) use($state) { - $state->event = $event; - }); - - $this->testSuiteRunner->setMockBridgeClass(MockeryMockBridge::class); - yield $this->testSuiteRunner->runTestSuites($results); - - $this->assertInstanceOf(TestProcessedEvent::class, $state->event); - $this->assertEquals(1, $state->event->getTarget()->getTestCase()->getAssertionCount()); - }); - } -} \ No newline at end of file diff --git a/framework_test/TestSuiteRunnerTest.php b/framework_test/TestSuiteRunnerTest.php deleted file mode 100644 index 3d9476d..0000000 --- a/framework_test/TestSuiteRunnerTest.php +++ /dev/null @@ -1,845 +0,0 @@ -buildTestSuiteRunner(); - $this->emitter->on(Events::TEST_PROCESSED, function(TestProcessedEvent $event) { - $this->actual[] = $event->getTarget(); - }); - } - - public function tearDown(): void { - ImplicitDefaultTestSuite\TestCaseHooksPriority\MyTestCase::clearInvokedAll(); - } - - private function parseAndRun(string $path) : Promise { - return call(function() use($path) { - $results = yield $this->parser->parse($path); - yield $this->testSuiteRunner->runTestSuites($results); - }); - } - - public function testImplicitDefaultTestSuiteSingleTestEmitsTestProcessedEventWithProperTestCaseInstance() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertCount(1, $this->actual); - $this->assertInstanceOf(ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, $this->actual[0]->getTestCase()); - }); - } - - public function testImplicitDefaultTestSuiteSingleTestEmitsTestProcessedEventWithProperTestMethodName() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertCount(1, $this->actual); - $this->assertSame('ensureSomethingHappens', $this->actual[0]->getTestMethod()); - }); - } - - public function testImplicitDefaultTestSuiteSingleTestEmitsTestProcessedEventWithInvokedTestCase() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertCount(1, $this->actual); - $this->assertTrue($this->actual[0]->getTestCase()->getTestInvoked()); - }); - } - - public function testImplicitDefaultTestSuiteMultipleTestEmitsTestProcessedEventsEachTestUniqueTestCase() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('MultipleTest')); - $this->assertCount(3, $this->actual); - - $actual = [ - $this->actual[0]->getTestCase()->getInvokedMethods(), - $this->actual[1]->getTestCase()->getInvokedMethods(), - $this->actual[2]->getTestCase()->getInvokedMethods() - ]; - $expected = [ - [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class . '::ensureSomethingHappens'], - [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class . '::ensureSomethingHappensTwice'], - [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class . '::ensureSomethingHappensThreeTimes'] - ]; - - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testImplicitDefaultTestSuiteHasSingleBeforeAllHookInvokedBeforeTest() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleBeforeAllHook')); - - $this->assertCount(2, $this->actual); - - $actual = [ - $this->actual[0]->getTestCase()->getCombinedData(), - $this->actual[1]->getTestCase()->getCombinedData() - ]; - $expected = [ - ['beforeAll', 'ensureSomething'], - ['beforeAll', 'ensureSomethingTwice'] - ]; - - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testImplicitDefaultTestSuiteHasSingleBeforeEachHookInvokedBeforeTest() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleBeforeEachHook')); - - $this->assertCount(2, $this->actual); - $actual = [ - $this->actual[0]->getTestCase()->getData(), - $this->actual[1]->getTestCase()->getData() - ]; - $expected = [ - ['beforeEach', 'ensureSomething'], - ['beforeEach', 'ensureSomethingTwice'] - ]; - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testImplicitDefaultTestSuiteHasSingleAfterAllHookInvokedAfterTest() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleAfterAllHook')); - - $this->assertCount(2, $this->actual); - $actual = [ - $this->actual[0]->getTestCase()->getCombinedData(), - $this->actual[1]->getTestCase()->getCombinedData(), - ]; - // We expect the afterAll _first_ here because our test case combines the class data from AfterAll and the object - // data from the TestCase with class data first. - $expected = [ - ['afterAll', 'ensureSomething'], - ['afterAll', 'ensureSomethingTwice'] - ]; - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testImplicitDefaultTestSuiteHasSingleAfterEachHookInvokedAfterTest() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleAfterEachHook')); - - $this->assertCount(2, $this->actual); - $actual = [ - $this->actual[0]->getTestCase()->getData(), - $this->actual[1]->getTestCase()->getData() - ]; - $expected = [ - ['ensureSomething', 'afterEach'], - ['ensureSomethingTwice', 'afterEach'] - ]; - - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testImplicitDefaultTestSuiteExceptionThrowingTestEmitsTestProcessedEventWithErrorStateAndCorrectException() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('ExceptionThrowingTest')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Errored(), $this->actual[0]->getState()); - - $this->assertNotNull($this->actual[0]->getException()); - $expectedMsg = 'An unexpected exception of type "Exception" with code 0 and message "Test failure" was thrown from #[Test] ' . ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class . '::throwsException'; - $this->assertSame($expectedMsg, $this->actual[0]->getException()->getMessage()); - $this->assertInstanceOf(Exception::class, $this->actual[0]->getException()->getPrevious()); - }); - } - - public function testImplicitDefaultTestSuiteExceptionThrowingTestWithAfterEachHookInvokedAfterTest() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('ExceptionThrowingTestWithAfterEachHook')); - - $this->assertCount(1, $this->actual); - $this->assertTrue($this->actual[0]->getTestCase()->getAfterHookCalled()); - }); - } - - public function testImplicitDefaultTestSuiteTestFailedExceptionThrowingTestEmitsTestProcessedEventDoesNotMarkExceptionAsUnexpected() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestFailedExceptionThrowingTest')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Failed(), $this->actual[0]->getState()); - - $this->assertNotNull($this->actual[0]->getException()); - $this->assertSame('Something barfed', $this->actual[0]->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteCustomAssertionsEmitsTestProcessedEventWithCorrectData() { - Loop::run(function() { - // Mock setup to make sure our custom assertion is being called properly - $assertion = $this->getMockBuilder(Assertion::class)->getMock(); - $assertionResult = $this->getMockBuilder(AssertionResult::class)->getMock(); - $assertionResult->expects($this->once())->method('isSuccessful')->willReturn(true); - $assertion->expects($this->once())->method('assert')->willReturn($assertionResult); - - $asyncAssertion = $this->getMockBuilder(AsyncAssertion::class)->getMock(); - $asyncAssertionResult = $this->getMockBuilder(AssertionResult::class)->getMock(); - $asyncAssertionResult->expects($this->once())->method('isSuccessful')->willReturn(true); - $asyncAssertion->expects($this->once())->method('assert')->willReturn(new Success($asyncAssertionResult)); - - $this->customAssertionContext->registerAssertion('theCustomAssertion', fn() => $assertion); - $this->customAssertionContext->registerAsyncAssertion('theCustomAssertion', fn() => $asyncAssertion); - - // Normal TestSuiteRunner testing - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('CustomAssertions')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Passed(), $this->actual[0]->getState()); - - }); - } - - public function testImplicitDefaultTestSuiteHasDataProviderEmitsTestProcessedEventsForEachDataSetOnUniqueTestCase() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('HasDataProvider')); - $this->assertCount(3, $this->actual); - - $actual = [ - $this->actual[0]->getTestCase()->getCounter(), - $this->actual[1]->getTestCase()->getCounter(), - $this->actual[2]->getTestCase()->getCounter(), - ]; - $expected = [1, 1, 1]; - - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testExplicitTestSuiteDefaultExplicitTestSuite() { - Loop::run(function() { - yield $this->parseAndRun($this->explicitTestSuitePath('AnnotatedDefaultTestSuite')); - - $this->assertCount(1, $this->actual); - $this->assertSame(ExplicitTestSuite\AnnotatedDefaultTestSuite\MyTestSuite::class, $this->actual[0]->getTestCase()->testSuite()::class); - }); - } - - public function testImplicitDefaultTestSuiteMultipleBeforeAllHooksAllInvokedBeforeTest() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('MultipleBeforeAllHooks')); - $this->assertCount(2, $this->actual); - $actual = [ - $this->actual[0]->getTestCase()->getState(), - $this->actual[1]->getTestCase()->getState(), - ]; - $expected = [ - ImplicitDefaultTestSuite\MultipleBeforeAllHooks\FirstTestCase::class, - ImplicitDefaultTestSuite\MultipleBeforeAllHooks\SecondTestCase::class - ]; - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testExplicitTestSuiteBeforeAllTestSuiteHookTestCaseHasAccessToSameTestSuite() : void { - Loop::run(function() { - yield $this->parseAndRun($this->explicitTestSuitePath('BeforeAllTestSuiteHook')); - $this->assertCount(3, $this->actual); - $actual = [ - $this->actual[0]->getTestCase()->testSuite(), - $this->actual[1]->getTestCase()->testSuite(), - $this->actual[2]->getTestCase()->testSuite(), - ]; - $this->assertSame($actual[0], $actual[1]); - $this->assertSame($actual[1], $actual[2]); - }); - } - - public function testTestPassedEventsEmittedAfterTestProcessedEvent() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test invoked'; - }); - $this->emitter->on(Events::TEST_PASSED, function() use(&$actual) { - $actual[] = 'test passed'; - }); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertSame(['test invoked', 'test passed'], $actual); - }); - } - - public function testTestFailedEventsEmittedAfterTestProcessedEvent() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test invoked'; - }); - $this->emitter->on(Events::TEST_FAILED, function() use(&$actual) { - $actual[] = 'test failed'; - }); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('FailedAssertion')); - - $this->assertSame(['test invoked', 'test failed'], $actual); - }); - } - - public function testTestErrorEventEmittedAfterTestProcessedEvent() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test invoked'; - }); - $this->emitter->on(Events::TEST_ERRORED, function() use(&$actual) { - $actual[] = 'test error'; - }); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('ExceptionThrowingTest')); - - $this->assertSame(['test invoked', 'test error'], $actual); - }); - } - - public function testTestDisabledEventsEmittedAfterTestProcessedEvent() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test invoked'; - }); - $this->emitter->on(Events::TEST_DISABLED, function() use(&$actual) { - $actual[] = 'test disabled'; - }); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTestDisabled')); - - $this->assertSame(['test invoked', 'test disabled'], $actual); - }); - } - - public function testTestSuiteStartedAndFinishedEventsEmittedInOrder() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_SUITE_STARTED, function() use(&$actual) { - $actual[] = 'test suite start'; - }); - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test processed'; - }); - $this->emitter->on(Events::TEST_SUITE_FINISHED, function() use(&$actual) { - $actual[] = 'test finished'; - }); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertSame(['test suite start', 'test processed', 'test finished'], $actual); - }); - } - - public function testTestCaseProcessingEventEmitted() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_CASE_STARTED, function() use(&$actual) { - $actual[] = 'test case started'; - }); - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test processed'; - }); - $this->emitter->on(Events::TEST_CASE_FINISHED, function() use(&$actual) { - $actual[] = 'test case finished'; - }); - - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertSame(['test case started', 'test processed', 'test case finished'], $actual); - }); - } - - public function testTestMethodIsNotInvokedWhenDisabled() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabled')); - - $this->assertCount(2, $this->actual); - $actual = [ - $this->actual[0]->getState(), - $this->actual[1]->getState() - ]; - $expected = [TestState::Passed(), TestState::Disabled()]; - $this->assertEqualsCanonicalizing($expected, $actual); - }); - } - - public function testTestMethodIsNotInvokedWhenTestCaseDisabled() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseDisabled')); - - $this->assertCount(3, $this->actual); - $actualState = [ - $this->actual[0]->getState(), - $this->actual[1]->getState(), - $this->actual[2]->getState(), - ]; - $expectedState = [TestState::Disabled(), TestState::Disabled(), TestState::Disabled()]; - $this->assertEqualsCanonicalizing($expectedState, $actualState); - - $actualData = [ - $this->actual[0]->getTestCase()->getData(), - $this->actual[1]->getTestCase()->getData(), - $this->actual[2]->getTestCase()->getData(), - ]; - $expectedData = [[], [], []]; - $this->assertEqualsCanonicalizing($expectedData, $actualData); - }); - } - - public function testTestResultWhenTestDisabled() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabled')); - $disabledTestResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class, 'skippedTest'); - - $this->assertSame(TestState::Disabled(), $disabledTestResult->getState()); - $this->assertInstanceOf(TestDisabledException::class, $disabledTestResult->getException()); - $expected = sprintf( - '%s::%s has been marked disabled via annotation', - ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class, - 'skippedTest' - ); - $this->assertSame($expected, $disabledTestResult->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteHandleNonPhpFiles() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('HandleNonPhpFiles')); - - $this->assertCount(1, $this->actual); - }); - } - - public function testImplicitDefaultTestSuiteTestDisabledHookNotInvoked() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabledHookNotInvoked')); - - $disabledTestResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledHookNotInvoked\MyTestCase::class, 'disabledTest'); - - $this->assertSame(TestState::Disabled(), $disabledTestResult->getState()); - $this->assertSame([], $disabledTestResult->getTestCase()->getState()); - - $enabledTestResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledHookNotInvoked\MyTestCase::class, 'enabledTest'); - - $this->assertSame(TestState::Passed(), $enabledTestResult->getState()); - $this->assertSame(['before', 'enabled', 'after'], $enabledTestResult->getTestCase()->getState()); - }); - } - - public function testImplicitDefaultTestSuiteTestCaseDisabledHookNotInvoked() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseDisabledHookNotInvoked')); - - $testOneResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestCaseDisabledHookNotInvoked\MyTestCase::class, 'testOne'); - - $this->assertSame(TestState::Disabled(), $testOneResult->getState()); - $this->assertSame([], $testOneResult->getTestCase()->getState()); - - $testTwoResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestCaseDisabledHookNotInvoked\MyTestCase::class, 'testTwo'); - - $this->assertSame(TestState::Disabled(), $testTwoResult->getState()); - $this->assertSame([], $testTwoResult->getTestCase()->getState()); - }); - } - - public function testExplicitTestSuiteTestSuiteDisabledHookNotInvoked() { - Loop::run(function() { - yield $this->parseAndRun($this->explicitTestSuitePath('TestSuiteDisabledHookNotInvoked')); - - $testSomethingResult = $this->fetchTestResultForTest(ExplicitTestSuite\TestSuiteDisabledHookNotInvoked\MyTestCase::class, 'testSomething'); - - $this->assertSame(TestState::Disabled(), $testSomethingResult->getState()); - $this->assertSame([], $testSomethingResult->getTestCase()->testSuite()->getState()); - }); - } - - public function testImplicitDefaultTestSuiteTestDisabledCustomMessage() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabledCustomMessage')); - - $testOneResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledCustomMessage\MyTestCase::class, 'testOne'); - - $this->assertSame(TestState::Disabled(), $testOneResult->getState()); - $this->assertInstanceOf(TestDisabledException::class, $testOneResult->getException()); - $this->assertSame('Not sure what we should do here yet', $testOneResult->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteTestCaseDisabledCustomMessage() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseDisabledCustomMessage')); - - $testOneResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestCaseDisabledCustomMessage\MyTestCase::class, 'testOne'); - - $this->assertSame(TestState::Disabled(), $testOneResult->getState()); - $this->assertInstanceOf(TestDisabledException::class, $testOneResult->getException()); - $this->assertSame('The TestCase is disabled', $testOneResult->getException()->getMessage()); - }); - } - - public function testExplicitTestSuiteTestSuiteDisabledCustomMessage() { - Loop::run(function() { - yield $this->parseAndRun($this->explicitTestSuitePath('TestSuiteDisabledCustomMessage')); - - $testOneResult = $this->fetchTestResultForTest(ExplicitTestSuite\TestSuiteDisabledCustomMessage\MyTestCase::class, 'testOne'); - - $this->assertSame(TestState::Disabled(), $testOneResult->getState()); - $this->assertInstanceOf(TestDisabledException::class, $testOneResult->getException()); - $this->assertSame('The AttachToTestSuite is disabled', $testOneResult->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteTestEventsHaveCorrectState() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabledEvents')); - - $failingResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledEvents\MyTestCase::class, 'testFailingFloatEquals'); - - $this->assertSame(TestState::Failed(), $failingResult->getState()); - - $passingResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledEvents\MyTestCase::class, 'testIsTrue'); - - $this->assertSame(TestState::Passed(), $passingResult->getState()); - - $disabledResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledEvents\MyTestCase::class, 'testIsDisabled'); - - $this->assertSame(TestState::Disabled(), $disabledResult->getState()); - }); - } - - public function testImplicitDefaultTestSuiteTestHasOutput() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestHasOutput')); - - $failingResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestHasOutput\MyTestCase::class, 'testProducesOutput'); - - $this->assertInstanceOf(TestOutputException::class, $failingResult->getException()); - $this->assertSame("Test had unexpected output:\n\n\"testProducesOutput\"", $failingResult->getException()->getMessage()); - }); - } - - public function testRandomizerIsUtilized() { - Loop::run(function() { - $dir = $this->implicitDefaultTestSuitePath('MultipleTest'); - $results = yield $this->parser->parse($dir); - $testSuites = $results->getTestSuiteModels(); - $randomizer = $this->getMockBuilder(Randomizer::class)->getMock(); - $mockBridgeFactory = $this->createMock(MockBridgeFactory::class); - - $testSuiteRunner = new TestSuiteRunner( - $this->emitter, - $this->customAssertionContext, - $randomizer, - $mockBridgeFactory - ); - - $this->assertCount(1, $testSuites); - $this->assertNotEmpty($testSuites[0]->getTestCaseModels()); - $randomizer->expects($this->exactly(3)) - ->method('randomize') - ->withConsecutive( - [$testSuites], - [$testSuites[0]->getTestCaseModels()], - [$testSuites[0]->getTestCaseModels()[0]->getTestModels()] - ) - ->willReturnOnConsecutiveCalls( - $testSuites, - $testSuites[0]->getTestCaseModels(), - $testSuites[0]->getTestCaseModels()[0]->getTestModels() - ); - - yield $testSuiteRunner->runTestSuites($results); - }); - } - - public function testImplicitDefaultTestSuiteTestExpectsExceptionOnly() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionOnly')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Passed(), $this->actual[0]->getState()); - }); - } - - public function testImplicitDefaultTestSuiteTestExpectsExceptionWrongType() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionWrongType')); - - $this->assertCount(1, $this->actual); - $this->assertInstanceOf(TestFailedException::class, $this->actual[0]->getException()); - $expected = sprintf( - 'Failed asserting that thrown exception %s extends expected %s', - InvalidStateException::class, - InvalidArgumentException::class - ); - $this->assertSame($expected, $this->actual[0]->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteTestExpectsExceptionMessage() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionMessage')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Passed(), $this->actual[0]->getState()); - }); - } - - public function testImplicitDefaultTestSuiteTestExpectsExceptionWrongMessage() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionWrongMessage')); - - $this->assertCount(1, $this->actual); - $this->assertInstanceOf(TestFailedException::class, $this->actual[0]->getException()); - $expected = sprintf( - 'Failed asserting that thrown exception message "%s" equals expected "%s"', - 'This is NOT the message that I expect', - 'This is the message that I expect' - ); - $this->assertSame($expected, $this->actual[0]->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteTestExpectsExceptionDoesNotThrow() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionDoesNotThrow')); - - $this->assertCount(1, $this->actual); - $this->assertInstanceOf(TestFailedException::class, $this->actual[0]->getException()); - $expected = sprintf( - 'Failed asserting that an exception of type %s is thrown', - InvalidArgumentException::class - ); - $this->assertSame($expected, $this->actual[0]->getException()->getMessage()); - }); - } - - public function testTestProcessingEventsEmittedInOrder() { - Loop::run(function() { - $actual = []; - $this->emitter->on(Events::TEST_PROCESSED, function() use(&$actual) { - $actual[] = 'test invoked'; - }); - $this->emitter->on(Events::PROCESSING_FINISHED, function() use(&$actual) { - $actual[] = 'test processing finished'; - }); - $this->emitter->on(Events::PROCESSING_STARTED, function() use(&$actual) { - $actual[] = 'test processing started'; - }); - - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); - - $this->assertSame(['test processing started', 'test invoked', 'test processing finished'], $actual); - }); - } - - public function testImplicitDefaultTestSuiteTestExpectsNoAssertionsHasPassedState() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsNoAssertions')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Passed()->toString(), $this->actual[0]->getState()->toString()); - }); - } - - public function testImplicitDefaultTestSuiteExpectsNoAssertionsAssertMade() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsNoAssertionsAssertMade')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Failed()->toString(), $this->actual[0]->getState()->toString()); - $this->assertSame('Expected ' . ImplicitDefaultTestSuite\TestExpectsNoAssertionsAssertMade\MyTestCase::class . '::testNoAssertionAssertionMade to make 0 assertions but made 2', $this->actual[0]->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteExpectsNoAssertionsAsyncAssertMade() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsNoAsyncAssertionsAssertMade')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Failed()->toString(), $this->actual[0]->getState()->toString()); - $this->assertSame('Expected ' . ImplicitDefaultTestSuite\TestExpectsNoAsyncAssertionsAssertMade\MyTestCase::class . '::noAssertionButAsyncAssertionMade to make 0 assertions but made 2', $this->actual[0]->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteTestHasTimeoutExceedsValueIsFailedTest() : void { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestHasTimeout')); - - $this->assertCount(1, $this->actual); - $this->assertSame(TestState::Failed()->toString(), $this->actual[0]->getState()->toString()); - $msg = sprintf( - 'Expected %s::timeOutTest to complete within 100ms', - ImplicitDefaultTestSuite\TestHasTimeout\MyTestCase::class - ); - $this->assertSame($msg, $this->actual[0]->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteSingleMockTestWithBridgeSet() : void { - Loop::run(function() { - $this->testSuiteRunner->setMockBridgeClass(MockBridgeStub::class); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleMockTest')); - - $this->assertCount(1, $this->actual); - $testResult = $this->actual[0]; - /** @var ImplicitDefaultTestSuite\SingleMockTest\MyTestCase $testCase */ - $testCase = $testResult->getTestCase(); - - $this->assertEquals(TestState::Passed(), $testResult->getState()); - $this->assertNotNull($testCase->getCreatedMock()); - $createdMock = $testCase->getCreatedMock()->class; - - $this->assertSame(Application::class, $createdMock); - }); - } - - public function testImplicitDefaultTestSuiteSingleMockTestWithBridgeSetInitializeAndFinalizeCalled() : void { - Loop::run(function() { - $this->testSuiteRunner->setMockBridgeClass(MockBridgeStub::class); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleMockTest')); - - $this->assertCount(1, $this->actual); - - $mockBridge = $this->actual[0]->getTestCase()->mocks(); - $expected = ['initialize', 'createMock ' . Application::class, 'finalize']; - $actual = $mockBridge->getCalls(); - - $this->assertSame($expected, $actual); - }); - } - - public function testImplicitDefaultTestSuiteSingleMockTestWithFailingBridgeHasFailedTest() : void { - Loop::run(function() { - $this->buildTestSuiteRunner(); - $this->emitter->on(Events::TEST_PROCESSED, function(TestProcessedEvent $event) { - $this->actual[] = $event->getTarget(); - }); - $this->testSuiteRunner->setMockBridgeClass(FailingMockBridgeStub::class); - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleMockTest')); - - $this->assertCount(1, $this->actual); - $testResult = $this->actual[0]; - - $this->assertEquals(TestState::Failed(), $testResult->getState()); - $this->assertInstanceOf(MockFailureException::class, $testResult->getException()); - $this->assertSame('Thrown from the FailingMockBridgeStub', $testResult->getException()->getMessage()); - }); - } - - public function testImplicitDefaultTestSuiteTestCasePriorityEachHooks() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseHooksPriority')); - - $this->assertCount(1, $this->actual); - $testResult = $this->actual[0]; - - $this->assertEquals(TestState::Passed(), $testResult->getState()); - - $expected = [ - 'beforeEachOne', - 'beforeEachTwo', - 'beforeEachThree', - 'afterEachOne', - 'afterEachTwo', - 'afterEachThree', - ]; - $this->assertEquals($expected, $testResult->getTestCase()->getInvokedEach()); - }); - } - - public function testImplicitDefaultTestSuiteTestCasePriorityAllHooks() { - Loop::run(function() { - yield $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseHooksPriority')); - - $this->assertCount(1, $this->actual); - $testResult = $this->actual[0]; - - $this->assertEquals(TestState::Passed(), $testResult->getState()); - - $expected = [ - 'beforeAllOne', - 'beforeAllTwo', - 'beforeAllThree', - 'afterAllOne', - 'afterAllTwo', - 'afterAllThree', - ]; - $this->assertEquals($expected, $testResult->getTestCase()->getInvokedAll()); - }); - } - - public function testExplicitTestSuiteTestSuiteHookPriority() { - Loop::run(function() { - yield $this->parseAndRun($this->explicitTestSuitePath('TestSuiteHookPriority')); - - $this->assertCount(1, $this->actual); - $testResult = $this->actual[0]; - - $this->assertEquals(TestState::Passed(), $testResult->getState()); - - $expected = [ - 'beforeAllOne', - 'beforeAllTwo', - 'beforeAllThree', - 'beforeEachOne', - 'beforeEachTwo', - 'beforeEachThree', - 'beforeEachTestOne', - 'beforeEachTestTwo', - 'beforeEachTestThree', - 'afterEachTestOne', - 'afterEachTestTwo', - 'afterEachTestThree', - 'afterEachOne', - 'afterEachTwo', - 'afterEachThree', - 'afterAllOne', - 'afterAllTwo', - 'afterAllThree', - ]; - $this->assertEquals($expected, $testResult->getTestCase()->testSuite()->getInvokedHooks()); - }); - } - - private function fetchTestResultForTest(string $testClass, string $method) : TestResult { - foreach ($this->actual as $testResult) { - if ($testResult->getTestCase()::class === $testClass && $testResult->getTestMethod() === $method) { - return $testResult; - } - } - $this->fail('Expected $this->actual to have a TestCase and method matching ' . $testClass . '::' . $method); - } -} \ No newline at end of file diff --git a/framework_test/UsesAcmeSrc.php b/framework_test/UsesAcmeSrc.php deleted file mode 100644 index b95b43f..0000000 --- a/framework_test/UsesAcmeSrc.php +++ /dev/null @@ -1,19 +0,0 @@ -path('ImplicitDefaultTestSuite/' . $path); - } - - private function explicitTestSuitePath(string $path) : string { - return $this->path('ExplicitTestSuite/' . $path); - } - -} \ No newline at end of file diff --git a/known-issues.xml b/known-issues.xml new file mode 100644 index 0000000..6815e4a --- /dev/null +++ b/known-issues.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/phpunit.xml b/phpunit.xml index aaaec1c..d737f18 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,44 +1,22 @@ - - - - framework_test - cli_test - cli_test/Integration - - - framework_test - - - cli_test - cli_test/Integration - - - - - - framework_src - cli_src - - - - - - + + + + + src + + diff --git a/phpunit.xml.bak b/phpunit.xml.bak new file mode 100644 index 0000000..9983269 --- /dev/null +++ b/phpunit.xml.bak @@ -0,0 +1,38 @@ + + + + + tests/Unit + + + tests/Unit/Framework + + + + + + framework_src + cli_src + + + + + + + diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..466b68d --- /dev/null +++ b/psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/resources/schema/cli-config.json b/resources/schema/cli-config.json index eee9b23..1e8cb62 100644 --- a/resources/schema/cli-config.json +++ b/resources/schema/cli-config.json @@ -5,7 +5,7 @@ "description": "Declares the format of a valid asyncunit.json file to run AsyncUnit tests.", "type": "object", "properties": { - "testDirs": { + "testDirectories": { "type": "array", "minItems": 1, "items": { @@ -20,16 +20,8 @@ "mockBridge": { "type": "string", "minLength": 1 - }, - "plugins": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "minLength": 1 - } } }, - "required": ["testDirs", "resultPrinter"], + "required": ["testDirectories", "resultPrinter"], "additionalProperties": false } \ No newline at end of file diff --git a/src/Cli/TerminalResultPrinter.php b/src/Cli/TerminalResultPrinter.php new file mode 100644 index 0000000..f478352 --- /dev/null +++ b/src/Cli/TerminalResultPrinter.php @@ -0,0 +1,231 @@ + + */ + private array $failedTests = []; + + /** + * @var list + */ + private array $disabledTests = []; + + /** + * @var list + */ + private array $erroredTests = []; + + /** + * @template Payload of object + * @param WritableStream $output + * @param Closure(Event):void $closure + * @return Listener> + */ + private function createClosureInvokingListener(WritableStream $output, Closure $closure) : Listener { + /** @implements Listener> */ + return new class($output, $closure) implements Listener { + public function __construct( + private readonly WritableStream $output, + private readonly Closure $closure + ) {} + + public function handle(Event $event) : Future|CompositeFuture|null { + ($this->closure)($event, $this->output); + return null; + } + }; + } + + public function registerEvents(Emitter $emitter, WritableStream $writableStream) : void { + $writableStream = new TerminalOutputStream($writableStream); + $emitter->register( + Events::PROCESSING_STARTED, + $this->createClosureInvokingListener($writableStream, $this->testProcessingStarted(...)) + ); + $emitter->register( + Events::TEST_PASSED, + $this->createClosureInvokingListener($writableStream, $this->testPassed(...)) + ); + $emitter->register( + Events::TEST_FAILED, + $this->createClosureInvokingListener($writableStream, $this->testFailed(...)) + ); + $emitter->register( + Events::TEST_DISABLED, + $this->createClosureInvokingListener($writableStream, $this->testDisabled(...)) + ); + $emitter->register( + Events::TEST_ERRORED, + $this->createClosureInvokingListener($writableStream, $this->testErrored(...)) + ); + $emitter->register( + Events::PROCESSING_FINISHED, + $this->createClosureInvokingListener($writableStream, $this->testProcessingFinished(...)) + ); + } + + private function testProcessingStarted(ProcessingStartedEvent $_, WritableStream $output) : void { + $inspirationalMessages = [ + 'Let\'s run some asynchronous tests!', + 'Zoom, zoom... here we go!', + 'One Loop to rule them all.', + 'Alright, waking the hamsters up!', + ]; + $inspirationalMessage = $inspirationalMessages[array_rand($inspirationalMessages)]; + $output->write(sprintf("AsyncUnit v%s - %s\n", AsyncUnitApplication::VERSION, $inspirationalMessage)); + $output->write(sprintf("Runtime: PHP %s\n", phpversion())); + } + + private function testPassed(TestPassedEvent $_, WritableStream $output) : void { + $output->write('.'); + } + + private function testDisabled(TestDisabledEvent $disabledEvent, WritableStream $output) : void { + $this->disabledTests[] = $disabledEvent; + $output->write('D'); + } + + private function testFailed(TestFailedEvent $failedEvent, WritableStream $output) : void { + $this->failedTests[] = $failedEvent; + $output->write('X'); + } + + private function testErrored(TestErroredEvent $erroredEvent, WritableStream $output) : void { + $this->erroredTests[] = $erroredEvent; + $output->write('E'); + } + + private function testProcessingFinished(ProcessingFinishedEvent $event, TerminalOutputStream $output) : void { + $output->br(2); + $output->writeln((new ResourceUsageFormatter())->resourceUsage($event->payload()->getDuration())); + $output->br(); + if ($event->payload()->getErroredTestCount() > 0) { + $output->writeln(sprintf('There was %d error:', $event->payload()->getErroredTestCount())); + $output->br(); + foreach ($this->erroredTests as $index => $erroredTestEvent) { + $output->writeln(sprintf( + '%d) %s::%s', + $index + 1, + $erroredTestEvent->payload()->getTestCase()::class, + $erroredTestEvent->payload()->getTestMethod() + )); + $output->writeln($erroredTestEvent->payload()->getException()->getMessage()); + $output->br(); + $output->writeln($erroredTestEvent->payload()->getException()->getTraceAsString()); + } + $output->br(); + $output->writeln('ERRORS'); + $output->writeln(sprintf( + 'Tests: %d, Errors: %d, Assertions: %d', + $event->payload()->getTotalTestCount(), + $event->payload()->getErroredTestCount(), + $event->payload()->getAssertionCount(), + )); + } + + if ($event->payload()->getFailedTestCount() > 0) { + $output->writeln(sprintf("There was %d failure:\n", $event->payload()->getFailedTestCount())); + foreach ($this->failedTests as $index => $failedTestEvent) { + $output->writeln(sprintf( + "%d) %s::%s", + $index + 1, + $failedTestEvent->payload()->getTestCase()::class, + $failedTestEvent->payload()->getTestMethod() + )); + $exception = $failedTestEvent->payload()->getException(); + if ($exception instanceof AssertionFailedException) { + $output->writeln($exception->getDetailedMessage()); + $output->br(); + $output->writeln(sprintf( + "%s:%d", + $exception->getFile(), + $exception->getLine() + )); + $output->br(); + } else if ($exception instanceof TestFailedException) { + $output->br(); + $output->writeln("Test failure message:"); + $output->br(); + $output->writeln($exception->getMessage()); + $output->br(); + $output->writeln($exception->getTraceAsString()); + $output->br(); + } else { + $output->writeln(sprintf( + "An unexpected %s was thrown in %s on line %d.", + $exception::class, + $exception->getFile(), + $exception->getLine() + )); + $output->br(); + $output->writeln(sprintf("\"%s\"", $exception->getMessage())); + $output->br(); + $output->writeln($exception->getTraceAsString()); + $output->br(); + } + } + + $output->write("FAILURES\n"); + $output->write(sprintf( + "Tests: %d, Failures: %d, Assertions: %d\n", + $event->payload()->getTotalTestCount(), + $event->payload()->getFailedTestCount(), + $event->payload()->getAssertionCount(), + )); + } + + if ($event->payload()->getDisabledTestCount() > 0) { + $output->write(sprintf("There was %d disabled test:\n", $event->payload()->getDisabledTestCount())); + $output->write("\n"); + foreach ($this->disabledTests as $index => $disabledEvent) { + $output->write(sprintf( + "%d) %s::%s\n", + $index + 1, + $disabledEvent->payload()->getTestCase()::class, + $disabledEvent->payload()->getTestMethod() + )); + } + $output->write("\n"); + $output->write(sprintf( + "Tests: %d, Disabled Tests: %d, Assertions: %d\n", + $event->payload()->getTotalTestCount(), + $event->payload()->getDisabledTestCount(), + $event->payload()->getAssertionCount(), + )); + } + + if ($event->payload()->getTotalTestCount() === $event->payload()->getPassedTestCount()) { + $output->write("OK!\n"); + $output->write(sprintf( + "Tests: %d, Assertions: %d\n", + $event->payload()->getTotalTestCount(), + $event->payload()->getAssertionCount(), + )); + } + } +} \ No newline at end of file diff --git a/framework_src/Assertion/AbstractAssertion.php b/src/Framework/Assertion/AbstractAssertion.php similarity index 79% rename from framework_src/Assertion/AbstractAssertion.php rename to src/Framework/Assertion/AbstractAssertion.php index 936083d..87f0e02 100644 --- a/framework_src/Assertion/AbstractAssertion.php +++ b/src/Framework/Assertion/AbstractAssertion.php @@ -1,10 +1,6 @@ expected, $this->actual); + return new CountEqualsMessage($this->expected, $this->actual); } private function getDetails() : AssertionMessage { - return new Assertion\AssertionMessage\CountEqualsMessage($this->expected, $this->actual); + return new CountEqualsMessage($this->expected, $this->actual); } } \ No newline at end of file diff --git a/framework_src/Assertion/AssertFloatEquals.php b/src/Framework/Assertion/AssertFloatEquals.php similarity index 55% rename from framework_src/Assertion/AssertFloatEquals.php rename to src/Framework/Assertion/AssertFloatEquals.php index 0be681f..424e679 100644 --- a/framework_src/Assertion/AssertFloatEquals.php +++ b/src/Framework/Assertion/AssertFloatEquals.php @@ -1,10 +1,9 @@ getExpected(), $this->getActual()); + return new BinaryOperandDetails($this->getExpected(), $this->getActual()); } } \ No newline at end of file diff --git a/framework_src/Assertion/AssertInstanceOf.php b/src/Framework/Assertion/AssertInstanceOf.php similarity index 75% rename from framework_src/Assertion/AssertInstanceOf.php rename to src/Framework/Assertion/AssertInstanceOf.php index 2efb574..de5fa58 100644 --- a/framework_src/Assertion/AssertInstanceOf.php +++ b/src/Framework/Assertion/AssertInstanceOf.php @@ -1,10 +1,9 @@ expected, $this->actual); + $message = new InstanceOfMessage($this->expected, $this->actual); if ($this->actual instanceof $this->expected) { return AssertionResultFactory::validAssertion($message, $message); } diff --git a/framework_src/Assertion/AssertIntEquals.php b/src/Framework/Assertion/AssertIntEquals.php similarity index 55% rename from framework_src/Assertion/AssertIntEquals.php rename to src/Framework/Assertion/AssertIntEquals.php index c7f4faa..5429b15 100644 --- a/framework_src/Assertion/AssertIntEquals.php +++ b/src/Framework/Assertion/AssertIntEquals.php @@ -1,10 +1,9 @@ getExpected(), $this->getActual()); + return new BinaryOperandDetails($this->getExpected(), $this->getActual()); } } \ No newline at end of file diff --git a/framework_src/Assertion/AssertIsEmpty.php b/src/Framework/Assertion/AssertIsEmpty.php similarity index 51% rename from framework_src/Assertion/AssertIsEmpty.php rename to src/Framework/Assertion/AssertIsEmpty.php index 0706eb4..5a9549e 100644 --- a/framework_src/Assertion/AssertIsEmpty.php +++ b/src/Framework/Assertion/AssertIsEmpty.php @@ -1,9 +1,9 @@ actual) ? 'validAssertion' : 'invalidAssertion'; return AssertionResultFactory::$factoryMethod( - new Assertion\AssertionMessage\EmptyUnaryOperandSummary($this->actual), - new Assertion\AssertionMessage\EmptyUnaryOperandDetails($this->actual) + new EmptyUnaryOperandSummary($this->actual), + new EmptyUnaryOperandDetails($this->actual) ); } } \ No newline at end of file diff --git a/framework_src/Assertion/AssertIsFalse.php b/src/Framework/Assertion/AssertIsFalse.php similarity index 60% rename from framework_src/Assertion/AssertIsFalse.php rename to src/Framework/Assertion/AssertIsFalse.php index 0c38887..21b9ca7 100644 --- a/framework_src/Assertion/AssertIsFalse.php +++ b/src/Framework/Assertion/AssertIsFalse.php @@ -1,11 +1,9 @@ count += $assertionCount; + } + + public function arrayEquals(array $expected, array $actual, string $message = null) : void { + $this->doAssertion(new AssertArrayEquals($expected, $actual), $message); + } + + public function floatEquals(float $expected, float $actual, string $message = null) : void { + $this->doAssertion(new AssertFloatEquals($expected, $actual), $message); + } + + public function intEquals(int $expected, int $actual, string $message = null) : void { + $this->doAssertion(new AssertIntEquals($expected, $actual), $message); + } + + public function stringEquals(string $expected, string $actual, string $message = null) : void { + $this->doAssertion(new AssertStringEquals($expected, $actual), $message); + } + + public function countEquals(int $expected, array|Countable $actual, string $message = null) : void { + $this->doAssertion(new AssertCountEquals($expected, $actual), $message); + } + + public function instanceOf(string|object $expected, object $actual, string $message = null) : void { + $this->doAssertion(new AssertInstanceOf($expected, $actual), $message); + } + + public function isEmpty(mixed $actual, string $message = null) : void { + $this->doAssertion(new AssertIsEmpty($actual), $message); + } + + public function isTrue(bool $actual, string $message = null) : void { + $this->doAssertion(new AssertIsTrue($actual), $message); + } + + public function isFalse(bool $actual, string $message = null) : void { + $this->doAssertion(new AssertIsFalse($actual), $message); + } + + public function isNull(mixed $actual, string $message = null) : void { + $this->doAssertion(new AssertIsNull($actual), $message); + } + + public function assertion(Assertion $assertion, string $message = null) : void { + $this->doAssertion($assertion, $message); + } + + private function doAssertion(Assertion $assertion, ?string $message) : void { + $isNot = $this->isNot; + $this->invokedAssertionContext(); + + $results = $assertion->assert(); + + $this->handleAssertionResults($results, $isNot, $message); + } + + private int $count = 0; + + private bool $isNot = false; + + public function getAssertionCount() : int { + return $this->count; + } + + public function not() : self { + $this->isNot = true; + return $this; + } + + private function getDefaultFailureMessage(string $assertionString) : string { + return sprintf("Failed %s", $assertionString); + } + + private function invokedAssertionContext() : void { + $this->count++; + $this->isNot = false; + } + + /** + * @throws AssertionFailedException + */ + private function handleAssertionResults(AssertionResult $result, bool $isNot, ?string $customMessage) : void { + if (($isNot && $result->isSuccessful()) || (!$isNot && !$result->isSuccessful())) { + throw new AssertionFailedException( + $customMessage ?? $this->getDefaultFailureMessage($isNot ? $result->getSummary()->toNotString() : $result->getSummary()->toString()), + $this->getDefaultFailureMessage($isNot ? $result->getDetails()->toNotString() : $result->getDetails()->toString()), + ); + } + } + +} \ No newline at end of file diff --git a/framework_src/AssertionMessage.php b/src/Framework/Assertion/AssertionMessage.php similarity index 86% rename from framework_src/AssertionMessage.php rename to src/Framework/Assertion/AssertionMessage.php index 08c121b..b5c3501 100644 --- a/framework_src/AssertionMessage.php +++ b/src/Framework/Assertion/AssertionMessage.php @@ -1,11 +1,11 @@ configurationFactory = $configurationFactory; + $this->configurationValidator = $configurationValidator; + $this->parser = $parser; + $this->testSuiteRunner = $testSuiteRunner; + $this->configFilePath = $configFilePath; + } + + public function run() : void { + $configuration = $this->configurationFactory->make($this->configFilePath); + $this->validateConfiguration($configuration); + $parserResults = $this->parser->parse($configuration->getTestDirectories()); + + gc_collect_cycles(); + + $this->testSuiteRunner->setMockBridgeClass($configuration->getMockBridge()); + $this->testSuiteRunner->runTestSuites($parserResults)->await(); + } + + private function validateConfiguration(Configuration $configuration) : void { + $validationResults = $this->configurationValidator->validate($configuration); + if (!$validationResults->isValid()) { + $firstLine = sprintf( + "The configuration at path \"%s\" has the following errors:\n\n", + $this->configFilePath + ); + $errorMessages = []; + foreach ($validationResults->getValidationErrors() as $messages) { + $errorMessages = [ + ...$errorMessages, + ...array_map(static fn(string $msg) => "- $msg", $messages) + ]; + } + $errorList = implode( + PHP_EOL, + $errorMessages + ); + $lastLine = "\n\nPlease fix the errors listed above and try running your tests again."; + + throw new InvalidConfigurationException(sprintf('%s%s%s', $firstLine, $errorList, $lastLine)); + } + } + +} diff --git a/src/Framework/AsyncUnitFrameworkRunner.php b/src/Framework/AsyncUnitFrameworkRunner.php new file mode 100644 index 0000000..25eff55 --- /dev/null +++ b/src/Framework/AsyncUnitFrameworkRunner.php @@ -0,0 +1,46 @@ +configurationFactory, + new StaticAnalysisParser(), + new TestSuiteRunner( + $this->emitter, + new ShuffleRandomizer(), + $this->mockBridgeFactory + ), + $configFile + ); + + $application->run(); + } + +} \ No newline at end of file diff --git a/src/Framework/Attribute/AfterAll.php b/src/Framework/Attribute/AfterAll.php new file mode 100644 index 0000000..8995660 --- /dev/null +++ b/src/Framework/Attribute/AfterAll.php @@ -0,0 +1,13 @@ + $validTypes + */ + public function __construct(public readonly array $validTypes) {} + +} diff --git a/framework_src/Attribute/PrototypeRequiresAttribute.php b/src/Framework/Attribute/PrototypeRequiresAttribute.php similarity index 75% rename from framework_src/Attribute/PrototypeRequiresAttribute.php rename to src/Framework/Attribute/PrototypeRequiresAttribute.php index 6ebffe7..ab82fb2 100644 --- a/framework_src/Attribute/PrototypeRequiresAttribute.php +++ b/src/Framework/Attribute/PrototypeRequiresAttribute.php @@ -1,13 +1,13 @@ filesystem = filesystem(); + } + + public function validate(Configuration $configuration): ConfigurationValidationResults { + $errors = [ + ...$this->validateTestDirectories($configuration), + ...$this->validateResultPrinterClass($configuration) + ]; + return new ConfigurationValidationResults($errors); + } + + private function validateTestDirectories(Configuration $configuration) : array { + $errors = []; + $testDirs = $configuration->getTestDirectories(); + foreach ($testDirs as $testDir) { + if (!$this->filesystem->isDirectory($testDir)) { + if (!isset($errors['testDirectories'])) { + $errors['testDirectories'] = []; + } + $errors['testDirectories'][] = sprintf( + 'A configured directory to scan, "%s", is not a directory.', + $testDir + ); + } + } + + return $errors; + } + + private function validateResultPrinterClass(Configuration $configuration) : array { + $errors = []; + $resultPrinterClass = $configuration->getResultPrinter(); + if (!class_exists($resultPrinterClass)) { + $errors['resultPrinter'] = [sprintf( + 'The result printer "%s" is not a class that can be found. Please ensure this class is configured to be autoloaded through Composer.', + $resultPrinterClass + )]; + } else if (!in_array(ResultPrinter::class, class_implements($resultPrinterClass), true)) { + $errors['resultPrinter'] = [sprintf( + 'The result printer "%s" is not a %s. Please ensure your result printer implements this interface.', + $resultPrinterClass, + ResultPrinter::class + )]; + } + return $errors; + } +} \ No newline at end of file diff --git a/src/Framework/Configuration/Configuration.php b/src/Framework/Configuration/Configuration.php new file mode 100644 index 0000000..f67346f --- /dev/null +++ b/src/Framework/Configuration/Configuration.php @@ -0,0 +1,25 @@ + + */ + public function getTestDirectories() : array; + + /** + * @return class-string + */ + public function getResultPrinter() : string; + + /** + * @return class-string|null + */ + public function getMockBridge() : ?string; + +} \ No newline at end of file diff --git a/src/Framework/Configuration/ConfigurationFactory.php b/src/Framework/Configuration/ConfigurationFactory.php new file mode 100644 index 0000000..aa1e080 --- /dev/null +++ b/src/Framework/Configuration/ConfigurationFactory.php @@ -0,0 +1,9 @@ +validator = new Validator(); + $resolver = $this->validator->resolver(); + assert($resolver !== null); + $resolver->registerFile( + 'https://labrador-kennel.io/dev/async-unit/schema/cli-config.json', + dirname(__DIR__, 3) . '/resources/schema/cli-config.json' + ); + $schema = $this->validator->loader()->loadSchemaById( + Uri::parse('https://labrador-kennel.io/dev/async-unit/schema/cli-config.json') + ); + if (is_null($schema)) { + throw new InvalidConfigurationException('Could not locate the schema for validating CLI configurations'); + } + $this->schema = $schema; + $this->filesystem = filesystem(); + } + + public function make(string $path) : Configuration { + $contents = $this->filesystem->read($path); + $configJson = json_decode($contents, flags: JSON_THROW_ON_ERROR); + $results = $this->validator->validate($configJson, $this->schema); + if ($results->hasError()) { + $msg = sprintf( + 'The JSON file at "%s" does not adhere to the JSON Schema https://labrador-kennel.io/dev/async-unit/schema/cli-config.json', + $path + ); + throw new InvalidConfigurationException($msg); + } + + $absoluteTestDirs = []; + foreach ($configJson->testDirectories as $testDir) { + $absoluteTestDirs[] = realpath($testDir); + } + $configJson->testDirectories = $absoluteTestDirs; + + return new class($configJson) implements Configuration { + + public function __construct(private readonly stdClass $config) {} + + public function getTestDirectories() : array { + return $this->config->testDirectories; + } + + public function getResultPrinter(): string { + return $this->config->resultPrinter; + } + + public function getMockBridge(): ?string { + return $this->config->mockBridge ?? null; + } + }; + } + +} \ No newline at end of file diff --git a/framework_src/Context/ExpectationContext.php b/src/Framework/Context/ExpectationContext.php similarity index 76% rename from framework_src/Context/ExpectationContext.php rename to src/Framework/Context/ExpectationContext.php index 4a23213..0d34d78 100644 --- a/framework_src/Context/ExpectationContext.php +++ b/src/Framework/Context/ExpectationContext.php @@ -1,16 +1,15 @@ thrownException = $throwable; } - public function exception(string $exceptionClass) : void { - $this->expectedExceptionClass = $exceptionClass; + /** + * @param class-string $type + * @return void + */ + public function exception(string $type) : void { + $this->expectedExceptionClass = $type; } - public function exceptionMessage(string $exceptionMessage) : void { - $this->expectedExceptionMessage = $exceptionMessage; + public function exceptionMessage(string $message) : void { + $this->expectedExceptionMessage = $message; } public function noAssertions() : void { $this->expectedAssertionCount = 0; } - public function validateExpectations() : Promise { - return call(function() { - return $this->validateThrownException() ?? - $this->validateAssertionCount() ?? - $this->validateOutput() ?? - $this->validateMocks() ?? - null; - }); + public function validateExpectations() : TestFailedException|TestErrorException|TestOutputException|MockFailureException|null { + return $this->validateThrownException() ?? + $this->validateAssertionCount() ?? + $this->validateOutput() ?? + $this->validateMocks() ?? + null; } private function validateAssertionCount() : ?TestFailedException { @@ -68,7 +68,7 @@ private function validateAssertionCount() : ?TestFailedException { } if (!is_null($this->expectedAssertionCount)) { - $totalAssertionCount = $this->assertionContext->getAssertionCount() + $this->asyncAssertionContext->getAssertionCount(); + $totalAssertionCount = $this->assertionContext->getAssertionCount(); if ($totalAssertionCount !== $this->expectedAssertionCount) { $msg = sprintf( 'Expected %s::%s to make 0 assertions but made %s', @@ -82,7 +82,7 @@ private function validateAssertionCount() : ?TestFailedException { return null; } - if ($this->assertionContext->getAssertionCount() === 0 && $this->asyncAssertionContext->getAssertionCount() === 0) { + if ($this->assertionContext->getAssertionCount() === 0) { $msg = sprintf( 'Expected "%s::%s" #[Test] to make at least 1 Assertion but none were made.', $this->testModel->getClass(), diff --git a/framework_src/Context/TestExpector.php b/src/Framework/Context/TestExpector.php similarity index 63% rename from framework_src/Context/TestExpector.php rename to src/Framework/Context/TestExpector.php index 37f60a3..720b0e6 100644 --- a/framework_src/Context/TestExpector.php +++ b/src/Framework/Context/TestExpector.php @@ -1,9 +1,14 @@ $type + */ public function exception(string $type) : void; public function exceptionMessage(string $message) : void; diff --git a/framework_src/Events.php b/src/Framework/Event/Events.php similarity index 94% rename from framework_src/Events.php rename to src/Framework/Event/Events.php index fbf67f2..3ff57e6 100644 --- a/framework_src/Events.php +++ b/src/Framework/Event/Events.php @@ -1,6 +1,6 @@ + */ +final class ProcessingFinishedEvent extends AbstractEvent { + + public function __construct(ProcessedAggregateSummary $summary) { + parent::__construct(Events::PROCESSING_FINISHED, $summary); + } + +} diff --git a/src/Framework/Event/ProcessingStartedEvent.php b/src/Framework/Event/ProcessingStartedEvent.php new file mode 100644 index 0000000..9b2f8b9 --- /dev/null +++ b/src/Framework/Event/ProcessingStartedEvent.php @@ -0,0 +1,17 @@ + + */ +final class ProcessingStartedEvent extends AbstractEvent { + + public function __construct(AggregateSummary $aggregateSummary) { + parent::__construct(Events::PROCESSING_STARTED, $aggregateSummary); + } + +} \ No newline at end of file diff --git a/src/Framework/Event/TestCaseFinishedEvent.php b/src/Framework/Event/TestCaseFinishedEvent.php new file mode 100644 index 0000000..6b90008 --- /dev/null +++ b/src/Framework/Event/TestCaseFinishedEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestCaseFinishedEvent extends AbstractEvent { + + public function __construct(ProcessedTestCaseSummary $testCaseSummary) { + parent::__construct(Events::TEST_CASE_FINISHED, $testCaseSummary); + } + +} \ No newline at end of file diff --git a/src/Framework/Event/TestCaseStartedEvent.php b/src/Framework/Event/TestCaseStartedEvent.php new file mode 100644 index 0000000..37e089a --- /dev/null +++ b/src/Framework/Event/TestCaseStartedEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestCaseStartedEvent extends AbstractEvent { + + public function __construct(TestCaseSummary $target) { + parent::__construct(Events::TEST_CASE_STARTED, $target); + } + +} diff --git a/src/Framework/Event/TestDisabledEvent.php b/src/Framework/Event/TestDisabledEvent.php new file mode 100644 index 0000000..48d88e0 --- /dev/null +++ b/src/Framework/Event/TestDisabledEvent.php @@ -0,0 +1,16 @@ + + */ +final class TestDisabledEvent extends AbstractEvent { + + public function __construct(TestResult $testResult) { + parent::__construct(Events::TEST_DISABLED, $testResult); + } +} diff --git a/src/Framework/Event/TestErroredEvent.php b/src/Framework/Event/TestErroredEvent.php new file mode 100644 index 0000000..6abfe96 --- /dev/null +++ b/src/Framework/Event/TestErroredEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestErroredEvent extends AbstractEvent { + + public function __construct(TestResult $target) { + parent::__construct(Events::TEST_ERRORED, $target); + } + +} \ No newline at end of file diff --git a/src/Framework/Event/TestFailedEvent.php b/src/Framework/Event/TestFailedEvent.php new file mode 100644 index 0000000..d41ab7b --- /dev/null +++ b/src/Framework/Event/TestFailedEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestFailedEvent extends AbstractEvent { + + public function __construct(TestResult $target) { + parent::__construct(Events::TEST_FAILED, $target); + } + +} \ No newline at end of file diff --git a/src/Framework/Event/TestPassedEvent.php b/src/Framework/Event/TestPassedEvent.php new file mode 100644 index 0000000..eb54664 --- /dev/null +++ b/src/Framework/Event/TestPassedEvent.php @@ -0,0 +1,16 @@ + + */ +final class TestPassedEvent extends AbstractEvent { + + public function __construct(TestResult $target) { + parent::__construct(Events::TEST_PASSED, $target); + } +} \ No newline at end of file diff --git a/src/Framework/Event/TestProcessedEvent.php b/src/Framework/Event/TestProcessedEvent.php new file mode 100644 index 0000000..806b33a --- /dev/null +++ b/src/Framework/Event/TestProcessedEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestProcessedEvent extends AbstractEvent { + + public function __construct(TestResult $target) { + parent::__construct(Events::TEST_PROCESSED, $target); + } + +} \ No newline at end of file diff --git a/src/Framework/Event/TestSuiteFinishedEvent.php b/src/Framework/Event/TestSuiteFinishedEvent.php new file mode 100644 index 0000000..3a63b5a --- /dev/null +++ b/src/Framework/Event/TestSuiteFinishedEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestSuiteFinishedEvent extends AbstractEvent { + + public function __construct(ProcessedTestSuiteSummary $target) { + parent::__construct(Events::TEST_SUITE_FINISHED, $target); + } + +} \ No newline at end of file diff --git a/src/Framework/Event/TestSuiteStartedEvent.php b/src/Framework/Event/TestSuiteStartedEvent.php new file mode 100644 index 0000000..747ac99 --- /dev/null +++ b/src/Framework/Event/TestSuiteStartedEvent.php @@ -0,0 +1,17 @@ + + */ +final class TestSuiteStartedEvent extends AbstractEvent { + + public function __construct(TestSuiteSummary $testSuiteSummary) { + parent::__construct(Events::TEST_SUITE_STARTED, $testSuiteSummary); + } + +} \ No newline at end of file diff --git a/framework_src/Exception/AssertionFailedException.php b/src/Framework/Exception/AssertionFailedException.php similarity index 50% rename from framework_src/Exception/AssertionFailedException.php rename to src/Framework/Exception/AssertionFailedException.php index efb29e5..1109123 100644 --- a/framework_src/Exception/AssertionFailedException.php +++ b/src/Framework/Exception/AssertionFailedException.php @@ -1,14 +1,12 @@ detailedMessage; } - public function getAssertionFailureFile() : string { - return $this->assertionFailureFile; - } - - public function getAssertionFailureLine() : int { - return $this->assertionFailureLine; - } - -} \ No newline at end of file +} diff --git a/framework_src/Exception/Exception.php b/src/Framework/Exception/Exception.php similarity index 66% rename from framework_src/Exception/Exception.php rename to src/Framework/Exception/Exception.php index 139a33c..e560f33 100644 --- a/framework_src/Exception/Exception.php +++ b/src/Framework/Exception/Exception.php @@ -1,6 +1,6 @@ createdMocks[] = $mock; return $mock; } diff --git a/src/Framework/MockBridge/NoConstructorMockBridgeFactory.php b/src/Framework/MockBridge/NoConstructorMockBridgeFactory.php new file mode 100644 index 0000000..e86c3a7 --- /dev/null +++ b/src/Framework/MockBridge/NoConstructorMockBridgeFactory.php @@ -0,0 +1,13 @@ +prophet->prophesize($class); + public function createMock(string $type) : ObjectProphecy { + return $this->prophet->prophesize($type); } public function getAssertionCount(): int { diff --git a/framework_src/Model/CanBeDisabledTrait.php b/src/Framework/Model/CanBeDisabledTrait.php similarity index 91% rename from framework_src/Model/CanBeDisabledTrait.php rename to src/Framework/Model/CanBeDisabledTrait.php index c1fbbcf..8b2f501 100644 --- a/framework_src/Model/CanBeDisabledTrait.php +++ b/src/Framework/Model/CanBeDisabledTrait.php @@ -1,7 +1,7 @@ hooks[$hookType->name] ?? []; + } + + public function addHook(HookModel $hook) : void { + if (!isset($this->hooks[$hook->getType()->name])) { + $this->hooks[$hook->getType()->name] = []; + } + $this->hooks[$hook->getType()->name][] = $hook; + } + +} \ No newline at end of file diff --git a/framework_src/Model/HookModel.php b/src/Framework/Model/HookModel.php similarity index 88% rename from framework_src/Model/HookModel.php rename to src/Framework/Model/HookModel.php index a2a2997..cb8a9d4 100644 --- a/framework_src/Model/HookModel.php +++ b/src/Framework/Model/HookModel.php @@ -1,15 +1,15 @@ + */ public function getClass() : string { return $this->class; } diff --git a/framework_src/Parser/AsyncUnitModelCollector.php b/src/Framework/Parser/AsyncUnitModelCollector.php similarity index 87% rename from framework_src/Parser/AsyncUnitModelCollector.php rename to src/Framework/Parser/AsyncUnitModelCollector.php index c4a19f7..481ba8b 100644 --- a/framework_src/Parser/AsyncUnitModelCollector.php +++ b/src/Framework/Parser/AsyncUnitModelCollector.php @@ -1,13 +1,13 @@ , TestSuiteModel> */ private array $testSuiteModels = []; @@ -36,11 +36,6 @@ final class AsyncUnitModelCollector { */ private array $hookModels = []; - /** - * @var PluginModel[] - */ - private array $pluginModels= []; - public function attachTestSuite(TestSuiteModel $testSuiteModel) : void { if ($testSuiteModel->isDefaultTestSuite()) { $this->defaultTestSuite = $testSuiteModel->getClass(); @@ -60,22 +55,17 @@ public function attachHook(HookModel $hookModel) : void { $this->hookModels[] = $hookModel; } - public function attachPlugin(PluginModel $pluginModel) : void { - $this->pluginModels[] = $pluginModel; - } - public function hasDefaultTestSuite() : bool { return isset($this->defaultTestSuite); } + /** + * @return list + */ public function getTestSuiteModels() : array { return array_values($this->testSuiteModels); } - public function getPluginModels() : array { - return $this->pluginModels; - } - public function finishedCollection() : void { foreach ($this->hookModels as $hookModel) { foreach (array_merge([], $this->testSuiteModels, $this->testCaseModels) as $model) { @@ -94,6 +84,7 @@ public function finishedCollection() : void { // defined that matches the given test case namespace. $testCaseTestSuite = null; $testCaseNamespace = $testCaseModel->getNamespace(); + /** @var class-string $testSuiteClass */ foreach (array_keys($this->testSuiteModels) as $testSuiteClass) { $testSuiteAttachNamespaces = $testSuiteClass::getNamespacesToAttach(); foreach ($testSuiteAttachNamespaces as $testSuiteAttachNamespace) { @@ -143,4 +134,4 @@ public function finishedCollection() : void { unset($this->testModels); } -} \ No newline at end of file +} diff --git a/src/Framework/Parser/AsyncUnitModelNodeVisitor.php b/src/Framework/Parser/AsyncUnitModelNodeVisitor.php new file mode 100644 index 0000000..8c5acec --- /dev/null +++ b/src/Framework/Parser/AsyncUnitModelNodeVisitor.php @@ -0,0 +1,300 @@ +namespacedName !== null) { + $class = $node->namespacedName->toString(); + if (is_subclass_of($class, TestSuite::class)) { + $testSuiteReflection = new ReflectionClass($class); + $hasDefaultTestSuiteAttribute = $testSuiteReflection->getAttributes(DefaultTestSuite::class) !== []; + $testSuiteModel = new TestSuiteModel($class, $hasDefaultTestSuiteAttribute); + $disabledAttributes = $testSuiteReflection->getAttributes(Disabled::class); + if (count($disabledAttributes) === 1) { + $testSuiteModel->markDisabled($disabledAttributes[0]->newInstance()->reason); + } + $timeoutAttributes = $testSuiteReflection->getAttributes(Timeout::class); + if (count($timeoutAttributes) === 1) { + $testSuiteModel->setTimeout($timeoutAttributes[0]->newInstance()->timeoutInMilliseconds); + } + $this->collector->attachTestSuite($testSuiteModel); + } else if (is_subclass_of($class, TestCase::class)) { + if ($node->isAbstract()) { + return; + } + $testCaseReflection = new ReflectionClass($class); + + $testSuiteClassName = null; + $testSuiteAttributes = $testCaseReflection->getAttributes(AttachToTestSuite::class); + if (count($testSuiteAttributes) === 1) { + $testSuiteClassName = $testSuiteAttributes[0]->newInstance()->testSuiteClass; + } + $testCaseModel = new TestCaseModel($class, $testSuiteClassName); + $disabledAttributes = $testCaseReflection->getAttributes(Disabled::class); + if (count($disabledAttributes) === 1) { + $testCaseModel->markDisabled($disabledAttributes[0]->newInstance()->reason); + } + $timeoutAttributes = $testCaseReflection->getAttributes(Timeout::class); + if (count($timeoutAttributes) === 1) { + $testCaseModel->setTimeout($timeoutAttributes[0]->newInstance()->timeoutInMilliseconds); + } + + $this->collector->attachTestCase($testCaseModel); + } + } else if ($node instanceof Node\Stmt\ClassMethod) { + $this->collectIfHasAnyAsyncUnitAttribute($node); + } + } + + private function collectIfHasAnyAsyncUnitAttribute(Node\Stmt\ClassMethod $classMethod) : void { + $validAttributes = [ + Test::class => $this->validateTest(...), + BeforeAll::class => $this->validateBeforeAll(...), + BeforeEach::class => $this->validateBeforeEach(...), + AfterAll::class => $this->validateAfterAll(...), + AfterEach::class => $this->validateAfterEach(...), + BeforeEachTest::class => $this->validateBeforeEachTest(...), + AfterEachTest::class => $this->validateAfterEachTest(...) + ]; + foreach ($validAttributes as $validAttribute => $validator) { + $attribute = $this->findAttribute($validAttribute, ...$classMethod->attrGroups); + if (!is_null($attribute)) { + $className = $classMethod->getAttribute('parent')->namespacedName->toString(); + if (!class_exists($className)) { + $msg = sprintf( + 'Failure compiling %s. The class cannot be autoloaded. Please ensure your Composer autoloader settings have been configured correctly', + $className + ); + throw new TestCompilationException($msg); + } + + $reflectionMethod = new ReflectionMethod($className, $classMethod->name->toString()); + $validator($reflectionMethod); + } + } + } + + private function validateTest(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + if (!is_subclass_of($className, TestCase::class)) { + $msg = sprintf( + 'Failure compiling "%s". The method "%s" is annotated with #[Test] but this class does not extend "%s".', + $className, + $reflectionMethod->name, + TestCase::class + ); + throw new TestCompilationException($msg); + } + + $testModel = new TestModel($className, $reflectionMethod->name); + + $disabledAttributes = $reflectionMethod->getAttributes(Disabled::class); + if (count($disabledAttributes) === 1) { + $testModel->markDisabled($disabledAttributes[0]->newInstance()->reason); + } + $dataProviderAttributes = $reflectionMethod->getAttributes(DataProvider::class); + if (count($dataProviderAttributes) === 1) { + $testModel->setDataProvider($dataProviderAttributes[0]->newInstance()->methodName); + } + $timeoutAttributes = $reflectionMethod->getAttributes(Timeout::class); + if (count($timeoutAttributes) === 1) { + $testModel->setTimeout($timeoutAttributes[0]->newInstance()->timeoutInMilliseconds); + } + + $this->collector->attachTest($testModel); + } + + private function validateBeforeEach(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { + $msg = sprintf( + 'Failure compiling "%s". The method "%s" is annotated with #[BeforeEach] but this class does not extend "%s" or "%s".', + $className, + $reflectionMethod->name, + TestSuite::class, + TestCase::class + ); + throw new TestCompilationException($msg); + } + + $beforeEachAttributes = $reflectionMethod->getAttributes(BeforeEach::class); + assert($beforeEachAttributes !== []); + + $this->collector->attachHook( + new HookModel( + $className, + $reflectionMethod->name, + HookType::BeforeEach, + $beforeEachAttributes[0]->newInstance()->priority + ) + ); + } + + private function validateAfterEach(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { + $msg = sprintf( + 'Failure compiling "%s". The method "%s" is annotated with #[AfterEach] but this class does not extend "%s" or "%s".', + $className, + $reflectionMethod->name, + TestSuite::class, + TestCase::class + ); + throw new TestCompilationException($msg); + } + + $afterEachAttributes = $reflectionMethod->getAttributes(AfterEach::class); + assert($afterEachAttributes !== []); + + $this->collector->attachHook( + new HookModel( + $className, + $reflectionMethod->name, + HookType::AfterEach, + $afterEachAttributes[0]->newInstance()->priority + ) + ); + } + + private function validateBeforeAll(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { + $msg = sprintf( + 'Failure compiling "%s". The method "%s" is annotated with #[BeforeAll] but this class does not extend "%s" or "%s".', + $className, + $reflectionMethod->getName(), + TestSuite::class, + TestCase::class + ); + throw new TestCompilationException($msg); + } else if (is_subclass_of($className, TestCase::class)) { + if (!$reflectionMethod->isStatic()) { + $msg = sprintf( + 'Failure compiling "%s". The non-static method "%s" cannot be used as a #[BeforeAll] hook.', + $className, + $reflectionMethod->getName(), + ); + throw new TestCompilationException($msg); + } + } + + // We know there's an attribute here because we wouldn't call this method if the parser didn't know there + // was an attribute here + $beforeAllAttributes = $reflectionMethod->getAttributes(BeforeAll::class); + assert($beforeAllAttributes !== []); + + $this->collector->attachHook( + new HookModel( + $className, + $reflectionMethod->getName(), + HookType::BeforeAll, + $beforeAllAttributes[0]->newInstance()->priority + ) + ); + } + + private function validateAfterAll(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + if (!is_subclass_of($className, TestSuite::class) && !is_subclass_of($className, TestCase::class)) { + $msg = sprintf( + 'Failure compiling "%s". The method "%s" is annotated with #[AfterAll] but this class does not extend "%s" or "%s".', + $className, + $reflectionMethod->name, + TestSuite::class, + TestCase::class + ); + throw new TestCompilationException($msg); + } else if (is_subclass_of($className, TestCase::class)) { + if (!$reflectionMethod->isStatic()) { + $msg = sprintf( + 'Failure compiling "%s". The non-static method "%s" cannot be used as a #[AfterAll] hook.', + $className, + $reflectionMethod->name, + ); + throw new TestCompilationException($msg); + } + } + + $afterAllAttributes = $reflectionMethod->getAttributes(AfterAll::class); + assert($afterAllAttributes !== []); + + $this->collector->attachHook( + new HookModel( + $className, + $reflectionMethod->name, + HookType::AfterAll, + $afterAllAttributes[0]->newInstance()->priority + ) + ); + } + + private function validateBeforeEachTest(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + + $beforeEachTestAttributes = $reflectionMethod->getAttributes(BeforeEachTest::class); + assert($beforeEachTestAttributes !== []); + + $this->collector->attachHook( + new HookModel( + $className, + $reflectionMethod->name, + HookType::BeforeEachTest, + $beforeEachTestAttributes[0]->newInstance()->priority + ) + ); + } + + private function validateAfterEachTest(ReflectionMethod $reflectionMethod) : void { + $className = $reflectionMethod->class; + + $afterEachTestAttributes = $reflectionMethod->getAttributes(AfterEachTest::class); + assert($afterEachTestAttributes !== []); + + $this->collector->attachHook( + new HookModel( + $className, + $reflectionMethod->name, + HookType::AfterEachTest, + $afterEachTestAttributes[0]->newInstance()->priority + ) + ); + } +} \ No newline at end of file diff --git a/framework_src/Parser/AttributeGroupTraverser.php b/src/Framework/Parser/AttributeGroupTraverser.php similarity index 69% rename from framework_src/Parser/AttributeGroupTraverser.php rename to src/Framework/Parser/AttributeGroupTraverser.php index a9a89f2..b1ab6eb 100644 --- a/framework_src/Parser/AttributeGroupTraverser.php +++ b/src/Framework/Parser/AttributeGroupTraverser.php @@ -1,6 +1,6 @@ $attributeType + * @param AttributeGroup ...$attributeGroups + * @return Attribute|null + */ private function findAttribute(string $attributeType, AttributeGroup... $attributeGroups) : ?Attribute { foreach ($attributeGroups as $attributeGroup) { foreach ($attributeGroup->attrs as $attribute) { diff --git a/src/Framework/Parser/Parser.php b/src/Framework/Parser/Parser.php new file mode 100644 index 0000000..bd5032f --- /dev/null +++ b/src/Framework/Parser/Parser.php @@ -0,0 +1,13 @@ +|string $dirs + * @return ParserResult + */ + public function parse(array|string $dirs) : ParserResult; + +} \ No newline at end of file diff --git a/framework_src/Parser/ParserResult.php b/src/Framework/Parser/ParserResult.php similarity index 52% rename from framework_src/Parser/ParserResult.php rename to src/Framework/Parser/ParserResult.php index 65a55bf..7229bd3 100644 --- a/framework_src/Parser/ParserResult.php +++ b/src/Framework/Parser/ParserResult.php @@ -1,34 +1,28 @@ summaryCalculator = new SummaryCalculator($this); + } /** - * @return TestSuiteModel[] + * @return list */ public function getTestSuiteModels() : array { return $this->collector->getTestSuiteModels(); } - /** - * @return PluginModel[] - */ - public function getPluginModels() : array { - return $this->collector->getPluginModels(); - } - public function getAggregateSummary() : AggregateSummary { return $this->getSummaryCalculator()->getAggregateSummary(); } @@ -42,9 +36,6 @@ public function getTestCaseSummary(string $testCase) : TestCaseSummary { } private function getSummaryCalculator() : SummaryCalculator { - if (!isset($this->summaryCalculator)) { - $this->summaryCalculator = new SummaryCalculator($this); - } return $this->summaryCalculator; } diff --git a/src/Framework/Parser/StaticAnalysisParser.php b/src/Framework/Parser/StaticAnalysisParser.php new file mode 100644 index 0000000..efeec1b --- /dev/null +++ b/src/Framework/Parser/StaticAnalysisParser.php @@ -0,0 +1,89 @@ +phpParser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7); + $this->nodeTraverser = new NodeTraverser(); + $this->filesystem = filesystem(); + } + + public function parse(string|array $dirs) : ParserResult { + $dirs = is_string($dirs) ? [$dirs] : $dirs; + + $collector = new AsyncUnitModelCollector(); + $nodeConnectingVisitor = new NodeConnectingVisitor(); + $nameResolver = new NameResolver(); + $asyncUnitVisitor = new AsyncUnitModelNodeVisitor($collector); + + $this->nodeTraverser->addVisitor($nameResolver); + $this->nodeTraverser->addVisitor($nodeConnectingVisitor); + $this->nodeTraverser->addVisitor($asyncUnitVisitor); + + foreach ($dirs as $dir) { + $this->traverseDir($dir); + } + + if (!$collector->hasDefaultTestSuite()) { + $collector->attachTestSuite(new TestSuiteModel(ImplicitTestSuite::class, true)); + } + $collector->finishedCollection(); + + return new ParserResult($collector); + } + + private function traverseDir(string $dir) : void { + $files = $this->filesystem->listFiles($dir); + + foreach ($files as $fileOrDir) { + $fullPath = $dir . '/' . $fileOrDir; + if ($this->filesystem->isDirectory($fullPath)) { + $this->traverseDir($fullPath); + } else { + $pathFragments = explode(DIRECTORY_SEPARATOR, $fullPath); + $lastPathFragment = array_pop($pathFragments); + if (!strpos($lastPathFragment, '.')) { // intentionally treating 0 as false because a hidden file shouldn't be tested + continue; + } + $extension = strtolower(explode('.', $lastPathFragment, 2)[1]); + if ($extension !== 'php') { + continue; + } + + $handle = $this->filesystem->openFile($fullPath, 'r'); + $statements = $this->phpParser->parse($handle->read()); + $this->nodeTraverser->traverse($statements); + $handle->close(); + + unset($handle); + } + } + } + +} \ No newline at end of file diff --git a/src/Framework/Prototype/AfterEachPrototype.php b/src/Framework/Prototype/AfterEachPrototype.php new file mode 100644 index 0000000..a950a8b --- /dev/null +++ b/src/Framework/Prototype/AfterEachPrototype.php @@ -0,0 +1,19 @@ + $items + * @return list + */ + public function randomize(array $items) : array; + +} \ No newline at end of file diff --git a/framework_src/ShuffleRandomizer.php b/src/Framework/Randomizer/ShuffleRandomizer.php similarity index 79% rename from framework_src/ShuffleRandomizer.php rename to src/Framework/Randomizer/ShuffleRandomizer.php index 5965558..ea5486e 100644 --- a/framework_src/ShuffleRandomizer.php +++ b/src/Framework/Randomizer/ShuffleRandomizer.php @@ -1,6 +1,6 @@ isDisabled() ? 'disabled' : 'enabled'; $this->testSuites[$testCaseModel->getTestSuiteClass()][$key][$testCaseModel->getClass()] = [ - TestState::Passed()->toString() => [], - TestState::Failed()->toString() => [], - TestState::Disabled()->toString() => [], - TestState::Errored()->toString() => [], + TestState::Passed->name => [], + TestState::Failed->name => [], + TestState::Disabled->name => [], + TestState::Errored->name => [], 'timer' => $timer ]; $this->totalTestCaseCount++; @@ -85,24 +84,22 @@ public function finishTestCase(TestCaseModel $testCaseModel) : ProcessedTestCase $failedTestCount = 0; $erroredTestCount = 0; $assertionCount = 0; - $asyncAssertionCount = 0; foreach ($tests as $state => $stateTests) { if ($state === 'duration') { continue; } - $coalescedTests = array_merge($coalescedTests, array_keys($stateTests)); - if ($state === TestState::Disabled()->toString()) { + $coalescedTests = [...$coalescedTests, ...array_keys($stateTests)]; + if ($state === TestState::Disabled->name) { $disabledTestCount += count($stateTests); - } else if ($state === TestState::Passed()->toString()) { + } else if ($state === TestState::Passed->name) { $passedTestCount += count($stateTests); - } else if ($state === TestState::Failed()->toString()) { + } else if ($state === TestState::Failed->name) { $failedTestCount += count($stateTests); - } else if ($state === TestState::Errored()->toString()) { + } else if ($state === TestState::Errored->name) { $erroredTestCount += count($stateTests); } foreach ($stateTests as $test) { $assertionCount += $test['assertion']; - $asyncAssertionCount += $test['asyncAssertion']; } } return new class( @@ -115,7 +112,6 @@ public function finishTestCase(TestCaseModel $testCaseModel) : ProcessedTestCase $failedTestCount, $erroredTestCount, $assertionCount, - $asyncAssertionCount, $duration ) implements ProcessedTestCaseSummary { @@ -129,7 +125,6 @@ public function __construct( private int $failedTestCount, private int $erroredTestCount, private int $assertionCount, - private int $asyncAssertionCount, private Duration $duration ) {} @@ -169,10 +164,6 @@ public function getAssertionCount() : int { return $this->assertionCount; } - public function getAsyncAssertionCount() : int { - return $this->asyncAssertionCount; - } - public function getDuration() : Duration { return $this->duration; } @@ -180,10 +171,10 @@ public function getDuration() : Duration { } public function processedTest(TestResult $testResult) : void { - $testSuiteClass = $testResult->getTestCase()->testSuite()::class; + $testSuiteClass = $testResult->getTestCase()->testSuite::class; $testCaseClass = $testResult->getTestCase()::class; $key = isset($this->testSuites[$testSuiteClass]['enabled'][$testCaseClass]) ? 'enabled' : 'disabled'; - $stateKey = $testResult->getState()->toString(); + $stateKey = $testResult->getState()->name; if (is_null($testResult->getDataSetLabel())) { $testName = sprintf('%s::%s', $testCaseClass, $testResult->getTestMethod()); @@ -191,20 +182,18 @@ public function processedTest(TestResult $testResult) : void { $testName = sprintf('%s::%s#%s', $testCaseClass, $testResult->getTestMethod(), $testResult->getDataSetLabel()); } $this->testSuites[$testSuiteClass][$key][$testCaseClass][$stateKey][$testName] = [ - 'assertion' => $testResult->getTestCase()->getAssertionCount(), - 'asyncAssertion' => $testResult->getTestCase()->getAsyncAssertionCount() + 'assertion' => $testResult->getTestCase()->getAssertionCount() ]; $this->totalTestCount++; $this->assertionCount += $testResult->getTestCase()->getAssertionCount(); - $this->asyncAssertionCount += $testResult->getTestCase()->getAsyncAssertionCount(); - if (TestState::Disabled()->equals($testResult->getState())) { + if (TestState::Disabled === $testResult->getState()) { $this->disabledTestCount++; - } else if (TestState::Passed()->equals($testResult->getState())) { + } else if (TestState::Passed === $testResult->getState()) { $this->passedTestCount++; - } else if (TestState::Failed()->equals($testResult->getState())) { + } else if (TestState::Failed === $testResult->getState()) { $this->failedTestCount++; - } else if (TestState::Errored()->equals($testResult->getState())) { + } else if (TestState::Errored === $testResult->getState()) { $this->erroredTestCount++; } } @@ -229,7 +218,6 @@ private function buildAggregate() : ProcessedAggregateSummary { $this->failedTestCount, $this->erroredTestCount, $this->assertionCount, - $this->asyncAssertionCount, $this->duration, $this->memoryUsageInBytes ) implements ProcessedAggregateSummary { @@ -246,7 +234,6 @@ public function __construct( private int $failedTestCount, private int $erroredTestCount, private int $assertionCount, - private int $asyncAssertionCount, private Duration $duration, private int $memoryUsageInBytes ) {} @@ -302,10 +289,6 @@ public function getMemoryUsageInBytes() : int { public function getAssertionCount() : int { return $this->assertionCount; } - - public function getAsyncAssertionCount() : int { - return $this->asyncAssertionCount; - } }; } @@ -319,28 +302,25 @@ private function buildTestSuiteSummary(TestSuiteModel $testSuiteModel) : Process $failedTestCount = 0; $erroredTestCount = 0; $assertionCount = 0; - $asyncAssertionCount = 0; foreach ($enabledTestCases as $testCase) { $tests = $this->testSuites[$testSuiteName]['enabled'][$testCase]; - $passedTestCount += count($tests[TestState::Passed()->toString()]); - $failedTestCount += count($tests[TestState::Failed()->toString()]); - $erroredTestCount += count($tests[TestState::Errored()->toString()]); - $disabledTestCount += count($tests[TestState::Disabled()->toString()]); - foreach ($tests[TestState::Passed()->toString()] as $assertionCounts) { + $passedTestCount += count($tests[TestState::Passed->name]); + $failedTestCount += count($tests[TestState::Failed->name]); + $erroredTestCount += count($tests[TestState::Errored->name]); + $disabledTestCount += count($tests[TestState::Disabled->name]); + foreach ($tests[TestState::Passed->name] as $assertionCounts) { $assertionCount += $assertionCounts['assertion']; - $asyncAssertionCount += $assertionCounts['asyncAssertion']; } - foreach ($tests[TestState::Failed()->toString()] as $assertionCounts) { + foreach ($tests[TestState::Failed->name] as $assertionCounts) { $assertionCount += $assertionCounts['assertion']; - $asyncAssertionCount += $assertionCounts['asyncAssertion']; } } foreach ($disabledTestCases as $testCase) { $tests = $this->testSuites[$testSuiteName]['disabled'][$testCase]; - $disabledTestCount += count($tests[TestState::Disabled()->toString()]); - $passedDisabledTestCount = count($tests[TestState::Passed()->toString()]); - $failedDisabledTestCount = count($tests[TestState::Failed()->toString()]); + $disabledTestCount += count($tests[TestState::Disabled->name]); + $passedDisabledTestCount = count($tests[TestState::Passed->name]); + $failedDisabledTestCount = count($tests[TestState::Failed->name]); // TODO make sure this logs a warning when we implement our logger assert($passedDisabledTestCount === 0, 'A disabled TestCase had passed tests associated to it.'); @@ -360,7 +340,6 @@ private function buildTestSuiteSummary(TestSuiteModel $testSuiteModel) : Process $failedTestCount, $erroredTestCount, $assertionCount, - $asyncAssertionCount, $this->testSuites[$testSuiteName]['duration'] ) implements ProcessedTestSuiteSummary { @@ -375,7 +354,6 @@ public function __construct( private int $failedTestCount, private int $erroredTestCount, private int $assertionCount, - private int $asyncAssertionCount, private Duration $duration ) {} @@ -419,10 +397,6 @@ public function getAssertionCount() : int { return $this->assertionCount; } - public function getAsyncAssertionCount() : int { - return $this->asyncAssertionCount; - } - public function getDuration() : Duration { return $this->duration; } diff --git a/framework_src/Statistics/ProcessedTestCaseSummary.php b/src/Framework/Statistics/ProcessedTestCaseSummary.php similarity index 85% rename from framework_src/Statistics/ProcessedTestCaseSummary.php rename to src/Framework/Statistics/ProcessedTestCaseSummary.php index 2e2a2d3..fd5df2c 100644 --- a/framework_src/Statistics/ProcessedTestCaseSummary.php +++ b/src/Framework/Statistics/ProcessedTestCaseSummary.php @@ -1,7 +1,7 @@ calculateModelRelationships($this->parserResult); + $this->aggregateSummary = $this->constructAggregateSummary(); } - private function calculateModelRelationships(ParserResult $parserResult) { + private function calculateModelRelationships(ParserResult $parserResult): void { foreach ($parserResult->getTestSuiteModels() as $testSuiteModel) { $testSuite = $testSuiteModel->getClass(); $this->testSuiteCount++; @@ -65,10 +66,6 @@ private function calculateModelRelationships(ParserResult $parserResult) { } public function getAggregateSummary() : AggregateSummary { - if (!isset($this->aggregateSummary)) { - $this->aggregateSummary = $this->constructAggregateSummary(); - } - return $this->aggregateSummary; } diff --git a/framework_src/Statistics/TestCaseSummary.php b/src/Framework/Statistics/TestCaseSummary.php similarity index 85% rename from framework_src/Statistics/TestCaseSummary.php rename to src/Framework/Statistics/TestCaseSummary.php index 41338d3..81e22bf 100644 --- a/framework_src/Statistics/TestCaseSummary.php +++ b/src/Framework/Statistics/TestCaseSummary.php @@ -1,6 +1,6 @@ assert->getAssertionCount(); + } + + final protected function expect() : TestExpector { + return $this->expectationContext; + } + + final public function mocks() : MockBridge { + if (is_null($this->testMocker)) { + $msg = 'Attempted to create a mock but no MockBridge was defined. Please ensure you\'ve configured a mockBridge in your configuration.'; + throw new InvalidStateException($msg); + } + + return $this->testMocker; + } + +} diff --git a/framework_src/TestResult.php b/src/Framework/TestResult.php similarity index 66% rename from framework_src/TestResult.php rename to src/Framework/TestResult.php index 5e1019d..61540e9 100644 --- a/framework_src/TestResult.php +++ b/src/Framework/TestResult.php @@ -1,18 +1,18 @@ mockBridgeClass = $mockBridge; + } + + public function runTestSuites(ParserResult $parserResult) : Future { + $deferred = new DeferredFuture(); + EventLoop::queue(function() use($parserResult, $deferred) { + $exception = null; + try { + $this->doProcessing($parserResult); + } catch (Throwable $throwable) { + $exception = $throwable; + } finally { + if ($exception !== null) { + $deferred->error($exception); + } else { + $deferred->complete(); + } + } + }); + return $deferred->getFuture(); + } + + private function doProcessing(ParserResult $parserResult) : void { + $this->emitter->emit( + new ProcessingStartedEvent($parserResult->getAggregateSummary()) + )->awaitAll(); + + $testSuiteModels = $this->randomizer->randomize($parserResult->getTestSuiteModels()); + + $aggregateSummaryBuilder = new ProcessedSummaryBuilder(); + $aggregateSummaryBuilder->startProcessing(); + + foreach ($testSuiteModels as $testSuiteModel) { + $testSuiteClass = $testSuiteModel->getClass(); + $testSuite = new $testSuiteClass(); + $testSuiteSummary = $parserResult->getTestSuiteSummary($testSuite::class); + $this->emitter->emit(new TestSuiteStartedEvent($testSuiteSummary)); + + $aggregateSummaryBuilder->startTestSuite($testSuiteModel); + if (!$testSuiteModel->isDisabled()) { + $this->invokeHooks( + $testSuite, + $testSuiteModel, + HookType::BeforeAll, + TestSuiteSetUpException::class + ); + } + + /** @var TestCaseModel[] $testCaseModels */ + $testCaseModels = $this->randomizer->randomize($testSuiteModel->getTestCaseModels()); + foreach ($testCaseModels as $testCaseModel) { + $testCaseSummary = $parserResult->getTestCaseSummary($testCaseModel->getClass()); + $this->emitter->emit(new TestCaseStartedEvent($testCaseSummary))->awaitAll(); + + $aggregateSummaryBuilder->startTestCase($testCaseModel); + if (!$testSuiteModel->isDisabled()) { + $this->invokeHooks($testSuite, $testSuiteModel, HookType::BeforeEach, TestSuiteSetUpException::class); + } + if (!$testCaseModel->isDisabled()) { + $this->invokeHooks($testCaseModel->getClass(), $testCaseModel, HookType::BeforeAll, TestCaseSetUpException::class, [$testSuite]); + } + + $testMethodModels = $this->randomizer->randomize($testCaseModel->getTestModels()); + foreach ($testMethodModels as $testMethodModel) { + /** @var AssertionContext $assertionContext */ + [ + $testCase, + $assertionContext, + $expectationContext, + $mockBridge + ] = $this->invokeTestCaseConstructor($testCaseModel->getClass(), $testSuite, $testMethodModel); + if ($testMethodModel->getDataProvider() !== null) { + $dataProvider = $testMethodModel->getDataProvider(); + $dataSets = $testCase->$dataProvider(); + foreach ($dataSets as $label => $args) { + $this->invokeTest( + $aggregateSummaryBuilder, + $testCase, + $assertionContext, + $expectationContext, + $mockBridge, + $testSuiteModel, + $testCaseModel, + $testMethodModel, + $args, + (string) $label // make sure 0-index array keys are treated as strings + ); + [ + $testCase, + $assertionContext, + $expectationContext, + $mockBridge + ] = $this->invokeTestCaseConstructor($testCaseModel->getClass(), $testSuite, $testMethodModel); + } + } else { + $this->invokeTest( + $aggregateSummaryBuilder, + $testCase, + $assertionContext, + $expectationContext, + $mockBridge, + $testSuiteModel, + $testCaseModel, + $testMethodModel + ); + } + } + + if (!$testCaseModel->isDisabled()) { + $this->invokeHooks($testCaseModel->getClass(), $testCaseModel, HookType::AfterAll, TestCaseTearDownException::class, [$testSuite]); + } + if (!$testSuiteModel->isDisabled()) { + $this->invokeHooks($testSuite, $testSuiteModel, HookType::AfterEach, TestSuiteTearDownException::class); + } + $this->emitter->emit(new TestCaseFinishedEvent($aggregateSummaryBuilder->finishTestCase($testCaseModel))); + } + + if (!$testSuiteModel->isDisabled()) { + $this->invokeHooks($testSuite, $testSuiteModel, HookType::AfterAll, TestSuiteTearDownException::class); + } + $this->emitter->emit(new TestSuiteFinishedEvent($aggregateSummaryBuilder->finishTestSuite($testSuiteModel))); + } + + $this->emitter->emit( + new ProcessingFinishedEvent($aggregateSummaryBuilder->finishProcessing()) + ); + } + + /** + * @param class-string $exceptionType + * @param list $args + * @throws Throwable + */ + private function invokeHooks( + TestSuite|TestCase|string $hookTarget, + TestSuiteModel|TestCaseModel $model, + HookType $hookType, + string $exceptionType, + array $args = [] + ) : void { + $hooks = $model->getHooks($hookType); + usort($hooks, static fn(HookModel $one, HookModel $two) => $one->getPriority() <=> $two->getPriority()); + foreach ($hooks as $hookMethodModel) { + try { + if (is_string($hookTarget)) { + $hookTarget::{$hookMethodModel->getMethod()}(...$args); + } else { + $hookTarget->{$hookMethodModel->getMethod()}(...$args); + } + } catch (Throwable $throwable) { + $hookTypeInflected = str_starts_with($hookType->value, 'Before') ? 'setting up' : 'tearing down'; + $msg = sprintf( + 'Failed %s "%s::%s" #[%s] hook with exception of type "%s" with code %d and message "%s".', + $hookTypeInflected, + is_string($hookTarget) ? $hookTarget : $hookTarget::class, + $hookMethodModel->getMethod(), + $hookType->value, + $throwable::class, + $throwable->getCode(), + $throwable->getMessage() + ); + throw new $exceptionType($msg, previous: $throwable); + } + } + } + + private function invokeTest( + ProcessedSummaryBuilder $aggregateSummaryBuilder, + TestCase $testCase, + AssertionContext $assertionContext, + ExpectationContext $expectationContext, + ?MockBridge $mockBridge, + TestSuiteModel $testSuiteModel, + TestCaseModel $testCaseModel, + TestModel $testModel, + array $args = [], + ?string $dataSetLabel = null + ) : void { + if ($testModel->isDisabled()) { + $msg = $testModel->getDisabledReason() ?? + $testCaseModel->getDisabledReason() ?? + $testSuiteModel->getDisabledReason() ?? + sprintf('%s::%s has been marked disabled via annotation', $testCaseModel->getClass(), $testModel->getMethod()); + $exception = new TestDisabledException($msg); + $testResult = $this->getDisabledTestResult($testCase, $testModel->getMethod(), $exception); + $this->emitter->emit(new TestProcessedEvent($testResult))->awaitAll(); + $this->emitter->emit(new TestDisabledEvent($testResult))->awaitAll(); + $aggregateSummaryBuilder->processedTest($testResult); + return; + } + + if (isset($mockBridge)) { + $mockBridge->initialize(); + } + + $this->invokeHooks($testCase->testSuite, $testSuiteModel, HookType::BeforeEachTest, TestSetupException::class); + $this->invokeHooks($testCase, $testCaseModel, HookType::BeforeEach, TestSetupException::class); + + $testCaseMethod = $testModel->getMethod(); + $failureException = null; + $timer = new Timer(); + $timer->start(); + /** @var string|null $timeoutWatcherId */ + $timeoutWatcherId = null; + if (!is_null($testModel->getTimeout())) { + $timeoutWatcherId = EventLoop::delay($testModel->getTimeout() / 1000, static function() use(&$timeoutWatcherId, $testModel) { + assert($timeoutWatcherId !== null); + EventLoop::cancel($timeoutWatcherId); + $msg = sprintf( + 'Expected %s::%s to complete within %sms', + $testModel->getClass(), + $testModel->getMethod(), + $testModel->getTimeout() + ); + throw new TestFailedException($msg); + }); + } + EventLoop::setErrorHandler(static function(Throwable $error) use(&$failureException, $expectationContext) { + if ($error instanceof TestFailedException) { + $failureException = $error; + } else { + $expectationContext->setThrownException($error); + } + }); + try { + ob_start(); + $testReturn = $testCase->$testCaseMethod(...$args); + if ($testReturn instanceof CompositeFuture) { + $testReturn->awaitAll(); + } else if ($testReturn instanceof Future) { + $testReturn->await(); + } + } catch (TestFailedException $exception) { + $failureException = $exception; + } catch (Throwable $throwable) { + $expectationContext->setThrownException($throwable); + } finally { + EventLoop::setErrorHandler(null); + if (isset($timeoutWatcherId)) { + EventLoop::cancel($timeoutWatcherId); + } + $expectationContext->setActualOutput(ob_get_clean()); + if (isset($mockBridge)) { + $assertionContext->addToAssertionCount($mockBridge->getAssertionCount()); + } + // If something else failed we don't need to make validations about expectations + if (is_null($failureException)) { + $failureException = $expectationContext->validateExpectations(); + } + if (is_null($failureException)) { + $state = TestState::Passed; + } else if ($failureException instanceof TestFailedException) { + $state = TestState::Failed; + } else { + $state = TestState::Errored; + } + $testResult = $this->getTestResult($testCase, $testCaseMethod, $state, $timer->stop(), $failureException, $dataSetLabel); + } + + $this->invokeHooks($testCase, $testCaseModel, HookType::AfterEach, TestTearDownException::class); + $this->invokeHooks($testCase->testSuite, $testSuiteModel, HookType::AfterEachTest, TestTearDownException::class); + + $this->emitter->emit(new TestProcessedEvent($testResult))->awaitAll(); + + if (TestState::Passed === $testResult->getState()) { + $this->emitter->emit(new TestPassedEvent($testResult)); + } else if (TestState::Errored === $testResult->getState()) { + $this->emitter->emit(new TestErroredEvent($testResult)); + } else { + $this->emitter->emit(new TestFailedEvent($testResult)); + } + + $aggregateSummaryBuilder->processedTest($testResult); + + unset($failureException, $testResult); + } + + private function getReflectionClass(string $class) : ReflectionClass { + if (!isset($this->reflectionCache[$class])) { + $this->reflectionCache[$class] = new ReflectionClass($class); + } + + return $this->reflectionCache[$class]; + } + + private function getDisabledTestResult(TestCase $testCase, string $testMethod, TestDisabledException $exception) : TestResult { + return new class($testCase, $testMethod, $exception) implements TestResult { + + public function __construct( + private TestCase $testCase, + private string $testMethod, + private TestDisabledException $exception + ) {} + + public function getTestCase() : TestCase { + return $this->testCase; + } + + public function getTestMethod() : string { + return $this->testMethod; + } + + public function getDataSetLabel() : ?string { + return null; + } + + public function getState() : TestState { + return TestState::Disabled; + } + + public function getDuration() : Duration { + return Duration::fromNanoseconds(0); + } + + public function getException() : TestFailedException|AssertionFailedException|TestDisabledException|null { + return $this->exception; + } + }; + } + + private function getTestResult( + TestCase $testCase, + string $method, + TestState $state, + Duration $duration, + TestFailedException|TestErrorException|null $testFailedException, + ?string $dataSetLabel + ) : TestResult { + return new class($testCase, $method, $state, $duration, $testFailedException, $dataSetLabel) implements TestResult { + + public function __construct( + private TestCase $testCase, + private string $method, + private TestState $state, + private Duration $duration, + private TestFailedException|TestErrorException|null $testFailedException, + private ?string $dataSetLabel + ) {} + + public function getTestCase() : TestCase { + return $this->testCase; + } + + public function getTestMethod() : string { + return $this->method; + } + + public function getDataSetLabel() : ?string { + return $this->dataSetLabel; + } + + public function getState() : TestState { + return $this->state; + } + + public function getDuration() : Duration { + return $this->duration; + } + + public function getException() : TestFailedException|AssertionFailedException|TestDisabledException|TestErrorException|null { + return $this->testFailedException; + } + }; + } + + private function invokeTestCaseConstructor(string $testCaseClass, TestSuite $testSuite, TestModel $testModel) : array { + $assertionContext = new AssertionContext(); + $testMocker = null; + if (isset($this->mockBridgeClass)) { + $testMocker = $this->mockBridgeFactory->make($this->mockBridgeClass); + } + $expectationContext = new ExpectationContext( + $testModel, + $assertionContext, + $testMocker + ); + + $testCase = new $testCaseClass( + $testSuite, + $assertionContext, + $expectationContext, + $testMocker + ); + + return [$testCase, $assertionContext, $expectationContext, $testMocker]; + } + +} \ No newline at end of file diff --git a/framework_test/Assertion/AbstractAssertionTestCase.php b/tests/Unit/Framework/Assertion/AbstractAssertionTestCase.php similarity index 85% rename from framework_test/Assertion/AbstractAssertionTestCase.php rename to tests/Unit/Framework/Assertion/AbstractAssertionTestCase.php index 9ef943c..2f23687 100644 --- a/framework_test/Assertion/AbstractAssertionTestCase.php +++ b/tests/Unit/Framework/Assertion/AbstractAssertionTestCase.php @@ -1,8 +1,8 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(string $a, mixed $b) : void { $message = new BinaryOperandDetails($a, $b); $expected = sprintf( diff --git a/framework_test/Assertion/AssertionMessage/BinaryOperandSummaryTest.php b/tests/Unit/Framework/Assertion/AssertionMessage/BinaryOperandSummaryTest.php similarity index 76% rename from framework_test/Assertion/AssertionMessage/BinaryOperandSummaryTest.php rename to tests/Unit/Framework/Assertion/AssertionMessage/BinaryOperandSummaryTest.php index 907ce46..78f301d 100644 --- a/framework_test/Assertion/AssertionMessage/BinaryOperandSummaryTest.php +++ b/tests/Unit/Framework/Assertion/AssertionMessage/BinaryOperandSummaryTest.php @@ -1,12 +1,14 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(string $a, mixed $b) : void { $message = new BinaryOperandSummary($a, $b) ; $expected = sprintf( diff --git a/framework_test/Assertion/AssertionMessage/CountEqualsMessageTest.php b/tests/Unit/Framework/Assertion/AssertionMessage/CountEqualsMessageTest.php similarity index 84% rename from framework_test/Assertion/AssertionMessage/CountEqualsMessageTest.php rename to tests/Unit/Framework/Assertion/AssertionMessage/CountEqualsMessageTest.php index fcaea83..c01cd36 100644 --- a/framework_test/Assertion/AssertionMessage/CountEqualsMessageTest.php +++ b/tests/Unit/Framework/Assertion/AssertionMessage/CountEqualsMessageTest.php @@ -1,8 +1,9 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(mixed $actual) : void { $message = new FalseUnaryOperandSummary($actual); $expected = sprintf( diff --git a/framework_test/Assertion/AssertionMessage/InstanceOfSummaryTest.php b/tests/Unit/Framework/Assertion/AssertionMessage/InstanceOfSummaryTest.php similarity index 88% rename from framework_test/Assertion/AssertionMessage/InstanceOfSummaryTest.php rename to tests/Unit/Framework/Assertion/AssertionMessage/InstanceOfSummaryTest.php index f671351..a7b9314 100644 --- a/framework_test/Assertion/AssertionMessage/InstanceOfSummaryTest.php +++ b/tests/Unit/Framework/Assertion/AssertionMessage/InstanceOfSummaryTest.php @@ -1,8 +1,9 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(mixed $actual) { $message = new NullUnaryOperandDetails($actual); $expectedDetails = var_export($actual, true); diff --git a/framework_test/Assertion/AssertionMessage/NullUnaryOperandTest.php b/tests/Unit/Framework/Assertion/AssertionMessage/NullUnaryOperandTest.php similarity index 73% rename from framework_test/Assertion/AssertionMessage/NullUnaryOperandTest.php rename to tests/Unit/Framework/Assertion/AssertionMessage/NullUnaryOperandTest.php index fd16fad..bcadb77 100644 --- a/framework_test/Assertion/AssertionMessage/NullUnaryOperandTest.php +++ b/tests/Unit/Framework/Assertion/AssertionMessage/NullUnaryOperandTest.php @@ -1,12 +1,14 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(mixed $actual) : void { $message = new NullUnaryOperandSummary($actual); $expected = sprintf( diff --git a/framework_test/Assertion/AssertionMessage/TrueUnaryOperandDetailsTest.php b/tests/Unit/Framework/Assertion/AssertionMessage/TrueUnaryOperandDetailsTest.php similarity index 77% rename from framework_test/Assertion/AssertionMessage/TrueUnaryOperandDetailsTest.php rename to tests/Unit/Framework/Assertion/AssertionMessage/TrueUnaryOperandDetailsTest.php index 229da08..03aa1a8 100644 --- a/framework_test/Assertion/AssertionMessage/TrueUnaryOperandDetailsTest.php +++ b/tests/Unit/Framework/Assertion/AssertionMessage/TrueUnaryOperandDetailsTest.php @@ -1,12 +1,14 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(mixed $actual) { $message = new TrueUnaryOperandDetails($actual); $expectedDetails = var_export($actual, true); diff --git a/framework_test/Assertion/AssertionMessage/TrueUnaryOperandTest.php b/tests/Unit/Framework/Assertion/AssertionMessage/TrueUnaryOperandTest.php similarity index 73% rename from framework_test/Assertion/AssertionMessage/TrueUnaryOperandTest.php rename to tests/Unit/Framework/Assertion/AssertionMessage/TrueUnaryOperandTest.php index cb17d22..586206f 100644 --- a/framework_test/Assertion/AssertionMessage/TrueUnaryOperandTest.php +++ b/tests/Unit/Framework/Assertion/AssertionMessage/TrueUnaryOperandTest.php @@ -1,12 +1,14 @@ assertSame($expected, $message->toString()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testToNotString(mixed $actual) : void { $message = new TrueUnaryOperandSummary($actual); $expected = sprintf( diff --git a/tests/Unit/Framework/AsyncUnitApplicationTest.php b/tests/Unit/Framework/AsyncUnitApplicationTest.php new file mode 100644 index 0000000..d8e6612 --- /dev/null +++ b/tests/Unit/Framework/AsyncUnitApplicationTest.php @@ -0,0 +1,211 @@ +createMock(ConfigurationFactory::class); + $configurationFactory->expects($this->once()) + ->method('make') + ->with($configPath) + ->willReturn($configuration); + + $this->mockBridgeStub = new MockBridgeStub(); + $this->mockBridgeFactory = $this->createMock(MockBridgeFactory::class); + + $emitter = new AmpEmitter(); + + $application = new AsyncUnitApplication( + new AsyncUnitConfigurationValidator(), + $configurationFactory, + new StaticAnalysisParser(), + new TestSuiteRunner( + $emitter, + new ShuffleRandomizer(), + $this->mockBridgeFactory + ), + $configPath + ); + + $state = new stdClass(); + $state->events = [ + Events::TEST_DISABLED => [], + Events::TEST_PASSED => [], + Events::TEST_FAILED => [], + Events::TEST_ERRORED => [], + ]; + + $listener = new class($state) implements Listener { + + public function __construct(private readonly stdClass $data) {} + + public function handle(Event $event) : Future|CompositeFuture|null { + $this->data->events[$event->name()][] = $event; + return null; + } + }; + $emitter->register(Events::TEST_PASSED, $listener); + $emitter->register(Events::TEST_FAILED, $listener); + $emitter->register(Events::TEST_DISABLED, $listener); + $emitter->register(Events::TEST_ERRORED, $listener); + + return [$state, $application]; + } + + public function testSimpleTestCaseImplicitDefaultTestSuiteSingleTest() : void { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('SingleTest')]); + [$state, $application] = $this->getStateAndApplication('singleTest', $configuration); + + $application->run(); + + $this->assertCount(1, $state->events[Events::TEST_PASSED]); + $this->assertCount(0, $state->events[Events::TEST_FAILED]); + /** @var TestPassedEvent $event */ + $event = $state->events[Events::TEST_PASSED][0]; + $this->assertInstanceOf(TestPassedEvent::class, $event); + + $testResult = $event->payload(); + + $this->assertInstanceOf(ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, $testResult->getTestCase()); + $this->assertSame('ensureSomethingHappens', $testResult->getTestMethod()); + $this->assertSame(TestState::Passed, $testResult->getState()); + } + + public function testSimpleTestCaseImplicitDefaultTestSuiteNoAssertions() : void { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('NoAssertions')]); + [$state, $application] = $this->getStateAndApplication('noAssertions', $configuration); + + $application->run(); + + $this->assertCount(0, $state->events[Events::TEST_PASSED]); + $this->assertCount(1, $state->events[Events::TEST_FAILED]); + /** @var TestFailedEvent $event */ + $event = $state->events[Events::TEST_FAILED][0]; + $this->assertInstanceOf(TestFailedEvent::class, $event); + + $testResult = $event->payload(); + + $this->assertInstanceOf(ImplicitDefaultTestSuite\NoAssertions\MyTestCase::class, $testResult->getTestCase()); + $this->assertSame('noAssertions', $testResult->getTestMethod()); + $this->assertSame(TestState::Failed, $testResult->getState()); + $msg = sprintf( + 'Expected "%s::%s" #[Test] to make at least 1 Assertion but none were made.', + ImplicitDefaultTestSuite\NoAssertions\MyTestCase::class, + 'noAssertions' + ); + $this->assertSame($msg, $testResult->getException()->getMessage()); + } + + public function testSimpleTestCaseImplicitDefaultTestSuiteFailedAssertion() { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('FailedAssertion')]); + [$state, $application] = $this->getStateAndApplication('failedAssertion', $configuration); + + $application->run(); + + $this->assertCount(0, $state->events[Events::TEST_PASSED]); + $this->assertCount(1, $state->events[Events::TEST_FAILED]); + /** @var TestFailedEvent $event */ + $event = $state->events[Events::TEST_FAILED][0]; + $this->assertInstanceOf(TestFailedEvent::class, $event); + + $testResult = $event->payload(); + $this->assertSame(TestState::Failed, $testResult->getState()); + } + + public function testExplicitTestSuiteTestSuiteStateShared() { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([$this->explicitTestSuitePath('TestSuiteStateBeforeAll')]); + [$state, $application] = $this->getStateAndApplication('testSuiteBeforeAll', $configuration); + + $application->run(); + + $this->assertCount(1, $state->events[Events::TEST_PASSED]); + $this->assertCount(0, $state->events[Events::TEST_FAILED]); + } + + public function testExplicitTestSuiteTestCaseBeforeAllHasTestSuiteState() { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([$this->explicitTestSuitePath('TestCaseBeforeAllHasTestSuiteState')]); + [$state, $application] = $this->getStateAndApplication('testCaseBeforeAllHasTestSuiteState', $configuration); + + $application->run(); + + $this->assertCount(1, $state->events[Events::TEST_PASSED]); + $this->assertCount(0, $state->events[Events::TEST_FAILED]); + } + + public function testExplicitTestSuiteTestCaseAfterAllHasTestSuiteState() { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([$this->explicitTestSuitePath('TestCaseAfterAllHasTestSuiteState')]); + [$state, $application] = $this->getStateAndApplication('testCaseAfterAllHasTestSuiteState', $configuration); + + $application->run(); + + $this->assertCount(1, $state->events[Events::TEST_PASSED]); + $this->assertCount(0, $state->events[Events::TEST_FAILED]); + + $this->assertSame('AsyncUnit', $state->events[Events::TEST_PASSED][0]->payload()->getTestCase()->getState()); + } + + public function testConfigurationInvalidThrowsException() { + $configuration = new TestConfiguration(); + $configuration->setTestDirectories([]); + $configuration->setResultPrinterClass('Not a class'); + [, $application] = $this->getStateAndApplication('invalidConfig', $configuration); + + $this->expectException(InvalidConfigurationException::class); + $expectedMessage = <<<'msg' +The configuration at path "invalidConfig" has the following errors: + +- The result printer "Not a class" is not a class that can be found. Please ensure this class is configured to be autoloaded through Composer. + +Please fix the errors listed above and try running your tests again. +msg; + $this->expectExceptionMessage($expectedMessage); + $application->run(); + } + +} \ No newline at end of file diff --git a/framework_test/AsyncUnitAssertions.php b/tests/Unit/Framework/AsyncUnitAssertions.php similarity index 64% rename from framework_test/AsyncUnitAssertions.php rename to tests/Unit/Framework/AsyncUnitAssertions.php index a6d2924..bb35180 100644 --- a/framework_test/AsyncUnitAssertions.php +++ b/tests/Unit/Framework/AsyncUnitAssertions.php @@ -1,11 +1,11 @@ subject = new AsyncUnitConfigurationValidator(); + $this->testConfiguration = new TestConfiguration(); + } + + public function testNonDirectoriesIsInvalid() { + $this->testConfiguration->setTestDirectories([ + __DIR__, + 'not a dir', + dirname(__DIR__), + 'definitely not a dir' + ]); + $results = $this->subject->validate($this->testConfiguration); + + $this->assertInstanceOf(ConfigurationValidationResults::class, $results); + $this->assertFalse($results->isValid()); + $this->assertArrayHasKey('testDirectories', $results->getValidationErrors()); + $this->assertSame( + [ + 'A configured directory to scan, "not a dir", is not a directory.', + 'A configured directory to scan, "definitely not a dir", is not a directory.' + ], + $results->getValidationErrors()['testDirectories'] + ); + } + + public function testResultPrinterClassIsNotClass() { + $this->testConfiguration->setResultPrinterClass('Not a class'); + $results = $this->subject->validate($this->testConfiguration); + + $this->assertInstanceOf(ConfigurationValidationResults::class, $results); + $this->assertFalse($results->isValid()); + $this->assertArrayHasKey('resultPrinter', $results->getValidationErrors()); + $this->assertSame( + ['The result printer "Not a class" is not a class that can be found. Please ensure this class is configured to be autoloaded through Composer.'], + $results->getValidationErrors()['resultPrinter'] + ); + } + + public function testResultPrinterClassIsNotResultPrinterPlugin() { + $this->testConfiguration->setResultPrinterClass(Generator::class); + $results = $this->subject->validate($this->testConfiguration); + + $this->assertInstanceOf(ConfigurationValidationResults::class, $results); + $this->assertFalse($results->isValid()); + $this->assertArrayHasKey('resultPrinter', $results->getValidationErrors()); + $this->assertSame( + ['The result printer "Generator" is not a ' . ResultPrinter::class . '. Please ensure your result printer implements this interface.'], + $results->getValidationErrors()['resultPrinter'] + ); + } + +} \ No newline at end of file diff --git a/framework_test/AsyncUnitFrameworkRunnerTest.php b/tests/Unit/Framework/AsyncUnitFrameworkRunnerTest.php similarity index 63% rename from framework_test/AsyncUnitFrameworkRunnerTest.php rename to tests/Unit/Framework/AsyncUnitFrameworkRunnerTest.php index 1d8cea5..2877a0b 100644 --- a/framework_test/AsyncUnitFrameworkRunnerTest.php +++ b/tests/Unit/Framework/AsyncUnitFrameworkRunnerTest.php @@ -1,13 +1,13 @@ setTestDirectories([$this->implicitDefaultTestSuitePath('SingleTest')]); @@ -24,20 +23,17 @@ public function testSinglePassingTest() { $configurationFactory->expects($this->once()) ->method('make') ->with('configPath') - ->willReturn(new Success($configuration)); + ->willReturn($configuration); $frameworkRunner = new AsyncUnitFrameworkRunner( - $environment, - $logger, + new AmpEmitter(), $configurationFactory, - new OutputBuffer() ); - $this->assertTrue($frameworkRunner->run('configPath')); + $frameworkRunner->run('configPath'); } public function testFailedAssertionTest() { - $environment = new StandardEnvironment(EnvironmentType::Test()); $logger = new NullLogger(); $configuration = new TestConfiguration(); $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('FailedAssertion')]); @@ -45,20 +41,17 @@ public function testFailedAssertionTest() { $configurationFactory->expects($this->once()) ->method('make') ->with('configPath') - ->willReturn(new Success($configuration)); + ->willReturn($configuration); $frameworkRunner = new AsyncUnitFrameworkRunner( - $environment, - $logger, + new AmpEmitter(), $configurationFactory, - new OutputBuffer() ); - $this->assertFalse($frameworkRunner->run('configPath')); + $frameworkRunner->run('configPath'); } public function testSingleMockWithNoAssertion() { - $environment = new StandardEnvironment(EnvironmentType::Test()); $logger = new NullLogger(); $configuration = new TestConfiguration(); $configuration->setTestDirectories([$this->implicitDefaultTestSuitePath('MockeryTestNoAssertion')]); @@ -67,16 +60,14 @@ public function testSingleMockWithNoAssertion() { $configurationFactory->expects($this->once()) ->method('make') ->with('configPath') - ->willReturn(new Success($configuration)); + ->willReturn($configuration); $frameworkRunner = new AsyncUnitFrameworkRunner( - $environment, - $logger, + new AmpEmitter(), $configurationFactory, - new OutputBuffer() ); - $this->assertTrue($frameworkRunner->run('configPath')); + $frameworkRunner->run('configPath'); } } \ No newline at end of file diff --git a/framework_test/Constraint/TestCaseModelHasTestMethod.php b/tests/Unit/Framework/Constraint/TestCaseModelHasTestMethod.php similarity index 83% rename from framework_test/Constraint/TestCaseModelHasTestMethod.php rename to tests/Unit/Framework/Constraint/TestCaseModelHasTestMethod.php index aa36a12..772d8e9 100644 --- a/framework_test/Constraint/TestCaseModelHasTestMethod.php +++ b/tests/Unit/Framework/Constraint/TestCaseModelHasTestMethod.php @@ -1,9 +1,9 @@ $model->getClass(), $testCases); + $testCaseClasses = array_map(static fn(TestCaseModel $model) => $model->getClass(), $testCases); return in_array($this->expectedClass, $testCaseClasses, true); } diff --git a/framework_test/Constraint/TestSuiteModelHasTestCaseModelTest.php b/tests/Unit/Framework/Constraint/TestSuiteModelHasTestCaseModelTest.php similarity index 85% rename from framework_test/Constraint/TestSuiteModelHasTestCaseModelTest.php rename to tests/Unit/Framework/Constraint/TestSuiteModelHasTestCaseModelTest.php index 4cdfcc3..2639e1e 100644 --- a/framework_test/Constraint/TestSuiteModelHasTestCaseModelTest.php +++ b/tests/Unit/Framework/Constraint/TestSuiteModelHasTestCaseModelTest.php @@ -1,11 +1,11 @@ subject = new JsonConfigurationFactory(); + } + + public static function badSchemaProvider() : array { + return [ + 'empty_object' => [__DIR__ . '/Resources/dummy_configs/empty_object.json'], + 'bad_keys' => [__DIR__ . '/Resources/dummy_configs/bad_keys.json'], + 'good_keys_bad_types' => [__DIR__ . '/Resources/dummy_configs/good_keys_bad_types.json'], + 'test_dirs_empty' => [__DIR__ . '/Resources/dummy_configs/test_dirs_empty.json'], + 'test_dirs_non_string' => [__DIR__ . '/Resources/dummy_configs/test_dirs_non_string.json'], + 'test_dirs_empty_string' => [__DIR__ . '/Resources/dummy_configs/test_dirs_empty_string.json'], + 'good_keys_but_extra' => [__DIR__ . '/Resources/dummy_configs/good_keys_but_extra.json'], + 'result_printer_null' => [__DIR__ . '/Resources/dummy_configs/result_printer_null.json'], + 'result_printer_empty' => [__DIR__ . '/Resources/dummy_configs/result_printer_empty.json'], + 'mock_bridge_empty_string' => [__DIR__ . '/Resources/dummy_configs/mock_bridge_empty_string.json'] + ]; + } + + #[DataProvider('badSchemaProvider')] + public function testBadSchemaThrowsException(string $file) { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage(sprintf( + 'The JSON file at "%s" does not adhere to the JSON Schema https://labrador-kennel.io/dev/async-unit/schema/cli-config.json', + $file + )); + + $this->subject->make($file); + } + + public function testMinimallyValidReturnsCorrectInformation() { + $configuration = $this->subject->make(__DIR__ . '/Resources/dummy_configs/minimally_valid.json'); + + $this->assertSame([getcwd()], $configuration->getTestDirectories()); + $this->assertSame(TerminalResultPrinter::class, $configuration->getResultPrinter()); + } + + public function testHasMockBridgeReturnsCorrectInformation() { + $configuration = $this->subject->make(__DIR__ . '/Resources/dummy_configs/has_mock_bridge.json'); + + $this->assertSame([getcwd()], $configuration->getTestDirectories()); + $this->assertSame(MockeryMockBridge::class, $configuration->getMockBridge()); + } + +} \ No newline at end of file diff --git a/tests/Unit/Framework/MockBridge/MockeryMockBridgeTest.php b/tests/Unit/Framework/MockBridge/MockeryMockBridgeTest.php new file mode 100644 index 0000000..eab43ed --- /dev/null +++ b/tests/Unit/Framework/MockBridge/MockeryMockBridgeTest.php @@ -0,0 +1,42 @@ +initialize(); + $mock = $subject->createMock(Configuration::class); + + $mock->shouldReceive('getTestDirectories')->once()->andReturn([]); + + $this->expectException(MockFailureException::class); + + $subject->finalize(); + } + + public function testMockWithGoodPredictions() : void { + $subject = new MockeryMockBridge(); + + $subject->initialize(); + $mock = $subject->createMock(Configuration::class); + + $mock->shouldReceive('getTestDirectories')->once()->andReturn([]); + + $mock->getTestDirectories(); + + $subject->finalize(); + + self::assertSame(1, $subject->getAssertionCount()); + } + +} \ No newline at end of file diff --git a/tests/Unit/Framework/MockBridge/ProphecyMockBridgeTest.php b/tests/Unit/Framework/MockBridge/ProphecyMockBridgeTest.php new file mode 100644 index 0000000..5373806 --- /dev/null +++ b/tests/Unit/Framework/MockBridge/ProphecyMockBridgeTest.php @@ -0,0 +1,54 @@ +initialize(); + $mock = $subject->createMock(Configuration::class); + + $mock->getTestDirectories()->shouldBeCalled()->willReturn([]); + + $this->expectException(MockFailureException::class); + + $subject->finalize(); + } + + public function testMockWithGoodPredictions() { + $subject = new ProphecyMockBridge(); + + $subject->initialize(); + $mock = $subject->createMock(Configuration::class); + + $mock->getTestDirectories()->shouldBeCalled()->willReturn([]); + + $mock->reveal()->getTestDirectories(); + + $subject->finalize(); + + self::assertSame(1, $subject->getAssertionCount()); + } + + public function testMockAssertionCount() { + $subject = new ProphecyMockBridge(); + + $subject->initialize(); + $mock = $subject->createMock(Configuration::class); + + $mock->getTestDirectories()->shouldBeCalled()->willReturn([]); + + $secondMock = $subject->createMock(Configuration::class); + $secondMock->getTestDirectories()->shouldBeCalled()->willReturn([]); + + $this->assertSame(2, $subject->getAssertionCount()); + } + +} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/bad_keys.json b/tests/Unit/Framework/Resources/dummy_configs/bad_keys.json similarity index 100% rename from framework_test/Resources/dummy_configs/bad_keys.json rename to tests/Unit/Framework/Resources/dummy_configs/bad_keys.json diff --git a/framework_test/Resources/dummy_configs/empty_object.json b/tests/Unit/Framework/Resources/dummy_configs/empty_object.json similarity index 100% rename from framework_test/Resources/dummy_configs/empty_object.json rename to tests/Unit/Framework/Resources/dummy_configs/empty_object.json diff --git a/framework_test/Resources/dummy_configs/good_keys_bad_types.json b/tests/Unit/Framework/Resources/dummy_configs/good_keys_bad_types.json similarity index 100% rename from framework_test/Resources/dummy_configs/good_keys_bad_types.json rename to tests/Unit/Framework/Resources/dummy_configs/good_keys_bad_types.json diff --git a/framework_test/Resources/dummy_configs/good_keys_but_extra.json b/tests/Unit/Framework/Resources/dummy_configs/good_keys_but_extra.json similarity index 100% rename from framework_test/Resources/dummy_configs/good_keys_but_extra.json rename to tests/Unit/Framework/Resources/dummy_configs/good_keys_but_extra.json diff --git a/tests/Unit/Framework/Resources/dummy_configs/has_mock_bridge.json b/tests/Unit/Framework/Resources/dummy_configs/has_mock_bridge.json new file mode 100644 index 0000000..11a9e4e --- /dev/null +++ b/tests/Unit/Framework/Resources/dummy_configs/has_mock_bridge.json @@ -0,0 +1,5 @@ +{ + "testDirectories": ["."], + "resultPrinter": "Cspray\\Labrador\\AsyncUnitCli\\DefaultResultPrinter", + "mockBridge": "Labrador\\AsyncUnit\\Framework\\MockBridge\\MockeryMockBridge" +} diff --git a/tests/Unit/Framework/Resources/dummy_configs/minimally_valid.json b/tests/Unit/Framework/Resources/dummy_configs/minimally_valid.json new file mode 100644 index 0000000..8f351e9 --- /dev/null +++ b/tests/Unit/Framework/Resources/dummy_configs/minimally_valid.json @@ -0,0 +1,5 @@ +{ + "testDirectories": ["."], + "resultPrinter": "Labrador\\AsyncUnit\\Cli\\TerminalResultPrinter", + "mockBridge": "Cspray\\Labrador\\AsyncUnit\\Stub\\MockBridgeStub" +} \ No newline at end of file diff --git a/framework_test/Resources/dummy_configs/mock_bridge_empty_string.json b/tests/Unit/Framework/Resources/dummy_configs/mock_bridge_empty_string.json similarity index 100% rename from framework_test/Resources/dummy_configs/mock_bridge_empty_string.json rename to tests/Unit/Framework/Resources/dummy_configs/mock_bridge_empty_string.json diff --git a/framework_test/Resources/dummy_configs/result_printer_empty.json b/tests/Unit/Framework/Resources/dummy_configs/result_printer_empty.json similarity index 100% rename from framework_test/Resources/dummy_configs/result_printer_empty.json rename to tests/Unit/Framework/Resources/dummy_configs/result_printer_empty.json diff --git a/framework_test/Resources/dummy_configs/result_printer_null.json b/tests/Unit/Framework/Resources/dummy_configs/result_printer_null.json similarity index 100% rename from framework_test/Resources/dummy_configs/result_printer_null.json rename to tests/Unit/Framework/Resources/dummy_configs/result_printer_null.json diff --git a/framework_test/Resources/dummy_configs/test_dirs_empty.json b/tests/Unit/Framework/Resources/dummy_configs/test_dirs_empty.json similarity index 100% rename from framework_test/Resources/dummy_configs/test_dirs_empty.json rename to tests/Unit/Framework/Resources/dummy_configs/test_dirs_empty.json diff --git a/framework_test/Resources/dummy_configs/test_dirs_empty_string.json b/tests/Unit/Framework/Resources/dummy_configs/test_dirs_empty_string.json similarity index 100% rename from framework_test/Resources/dummy_configs/test_dirs_empty_string.json rename to tests/Unit/Framework/Resources/dummy_configs/test_dirs_empty_string.json diff --git a/framework_test/Resources/dummy_configs/test_dirs_non_string.json b/tests/Unit/Framework/Resources/dummy_configs/test_dirs_non_string.json similarity index 100% rename from framework_test/Resources/dummy_configs/test_dirs_non_string.json rename to tests/Unit/Framework/Resources/dummy_configs/test_dirs_non_string.json diff --git a/framework_test/ShuffleRandomizerTest.php b/tests/Unit/Framework/ShuffleRandomizerTest.php similarity index 79% rename from framework_test/ShuffleRandomizerTest.php rename to tests/Unit/Framework/ShuffleRandomizerTest.php index 2415261..090a67a 100644 --- a/framework_test/ShuffleRandomizerTest.php +++ b/tests/Unit/Framework/ShuffleRandomizerTest.php @@ -1,7 +1,8 @@ subject = new StaticAnalysisParser(); + } + + public function testErrorConditionsNoTestsTestCase() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\NoTestsTestCase\\BadTestCase". There were no #[Test] found.'); + + $this->subject->parse(self::errorConditionsPath('NoTestsTestCase')); + } + + public function testErrorConditionsBeforeAllNonStaticMethod() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\BeforeAllNonStaticMethod\\BadTestCase". The non-static method "badBeforeAllMustBeStatic" cannot be used as a #[BeforeAll] hook.'); + + $this->subject->parse(self::errorConditionsPath('BeforeAllNonStaticMethod')); + } + + public function testErrorConditionsAfterAllNonStaticMethod() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\AfterAllNonStaticMethod\\BadTestCase". The non-static method "badAfterAllMustBeStatic" cannot be used as a #[AfterAll] hook.'); + + $this->subject->parse(self::errorConditionsPath('AfterAllNonStaticMethod')); + } + + public function testErrorConditionsTestAttributeOnNotTestCase() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\TestAttributeOnNotTestCase\\BadTestCase". The method "ensureSomething" is annotated with #[Test] but this class does not extend "' . TestCase::class . '".'); + + $this->subject->parse(self::errorConditionsPath('TestAttributeOnNotTestCase')); + } + + public function testErrorConditionsBeforeAllAttributeOnNotTestCaseOrTestSuite() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\BeforeAllAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[BeforeAll] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); + + $this->subject->parse(self::errorConditionsPath('BeforeAllAttributeOnNotTestCaseOrTestSuite')); + } + + public function testErrorConditionsAfterAllAttributeOnNotTestCaseOrTestSuite() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\AfterAllAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[AfterAll] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); + + $this->subject->parse(self::errorConditionsPath('AfterAllAttributeOnNotTestCaseOrTestSuite')); + } + + public function testErrorConditionsAfterEachAttributeOnNotTestCaseOrTestSuite() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\AfterEachAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[AfterEach] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); + + $this->subject->parse(self::errorConditionsPath('AfterEachAttributeOnNotTestCaseOrTestSuite')); + } + + public function testErrorConditionsBeforeEachAttributeOnNotTestCaseOrTestSuite() { + $this->expectException(TestCompilationException::class); + $this->expectExceptionMessage('Failure compiling "Acme\\DemoSuites\\ErrorConditions\\BeforeEachAttributeOnNotTestCaseOrTestSuite\\BadTestCase". The method "ensureSomething" is annotated with #[BeforeEach] but this class does not extend "' . TestSuite::class . '" or "' . TestCase::class . '".'); + $this->subject->parse(self::errorConditionsPath('BeforeEachAttributeOnNotTestCaseOrTestSuite')); + } + + public static function badNamespaceDataProvider() : array { + return [ + ['BadNamespaceTest', 'MyTestCase'], + ['BadNamespaceTestCaseAfterAll', 'MyTestCase'], + ['BadNamespaceTestCaseAfterEach', 'MyTestCase'], + ['BadNamespaceTestCaseBeforeAll', 'MyTestCase'], + ['BadNamespaceTestCaseBeforeEach', 'MyTestCase'], + ['BadNamespaceTestSuiteAfterAll', 'MyTestSuite'], + ['BadNamespaceTestSuiteAfterEach', 'MyTestSuite'], + ['BadNamespaceTestSuiteAfterEachTest', 'MyTestSuite'], + ['BadNamespaceTestSuiteBeforeAll', 'MyTestSuite'], + ['BadNamespaceTestSuiteBeforeEach', 'MyTestSuite'], + ['BadNamespaceTestSuiteBeforeEachTest', 'MyTestSuite'] + ]; + } + + #[DataProvider('badNamespaceDataProvider')] + public function testErrorConditionsBadNamespace(string $errorConditionNamespace, string $simpleClass) { + $this->expectException(TestCompilationException::class); + $expected = sprintf( + 'Failure compiling Acme\\DemoSuites\\ErrorConditions\\%s\\IntentionallyBad\\%s. The class cannot be autoloaded. Please ensure your Composer autoloader settings have been configured correctly', + $errorConditionNamespace, + $simpleClass + + ); + $this->expectExceptionMessage($expected); + + $this->subject->parse(self::errorConditionsPath($errorConditionNamespace)); + } + + public function testDefaultTestSuiteName() : void { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('SingleTest')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + + $this->assertSame(ImplicitTestSuite::class, $testSuite->getClass()); + } + + public function testTestCaseModelAlwaysHasTestSuite() : void { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('SingleTest')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + + $testCases = $testSuites[0]->getTestCaseModels(); + + $this->assertCount(1, $testCases); + + $this->assertSame(ImplicitTestSuite::class, $testCases[0]->getTestSuiteClass()); + } + + public function testParsingSimpleTestCaseImplicitDefaultTestSuiteSingleTest() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('SingleTest')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + + $expectedTestCase = ImplicitDefaultTestSuite\SingleTest\MyTestCase::class; + $this->assertCount(1, $testSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite($expectedTestCase, $testSuite); + + $testCaseModel = $this->fetchTestCaseModel($testSuite, $expectedTestCase); + + $this->assertCount(1, $testCaseModel->getTestModels()); + $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappens', $testCaseModel); + } + + public function testParsingSimpleTestCaseImplicitDefaultTestSuiteMultipleTest() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('MultipleTest')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + $expectedTestCase = ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class; + $this->assertCount(1, $testSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite( + $expectedTestCase, + $testSuite + ); + + $testCase = $this->fetchTestCaseModel($testSuite, $expectedTestCase); + + $this->assertCount(3, $testCase->getTestModels()); + $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappens', $testCase); + $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappensTwice', $testCase); + $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappensThreeTimes', $testCase); + } + + public function testParsingSimpleTestCaseImplicitDefaultTestSuiteHasNotTestCaseObject() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('HasNotTestCaseObject')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + + $expectedTestCase = ImplicitDefaultTestSuite\HasNotTestCaseObject\MyTestCase::class; + $this->assertCount(1, $testSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite( + $expectedTestCase, + $testSuite + ); + + $testCase = $this->fetchTestCaseModel($testSuite, $expectedTestCase); + + $this->assertCount(1, $testCase->getTestModels()); + $this->assertTestMethodBelongsToTestCase($expectedTestCase . '::ensureSomethingHappens', $testCase); + } + + public function testParsingSimpleTestCaseImplicitDefaultTestSuiteMultipleTestCase() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('MultipleTestCase')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + + $barTestCaseClass = ImplicitDefaultTestSuite\MultipleTestCase\BarTestCase::class; + $bazTestCaseClass = ImplicitDefaultTestSuite\MultipleTestCase\BazTestCase::class; + $fooTestCaseClass = ImplicitDefaultTestSuite\MultipleTestCase\FooTestCase::class; + + $this->assertCount(3, $testSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite($barTestCaseClass, $testSuite); + $this->assertTestCaseClassBelongsToTestSuite($bazTestCaseClass, $testSuite); + $this->assertTestCaseClassBelongsToTestSuite($fooTestCaseClass, $testSuite); + + $barTestCase = $this->fetchTestCaseModel($testSuite, $barTestCaseClass); + $bazTestCase = $this->fetchTestCaseModel($testSuite, $bazTestCaseClass); + $fooTestCase = $this->fetchTestCaseModel($testSuite, $fooTestCaseClass); + + $this->assertCount(1, $barTestCase->getTestModels()); + $this->assertCount(1, $bazTestCase->getTestModels()); + $this->assertCount(2, $fooTestCase->getTestModels()); + } + + public function testParsingImplicitDefaultTestSuiteExtendedTestCases() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('ExtendedTestCases')); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + + $firstTestCaseClass = ImplicitDefaultTestSuite\ExtendedTestCases\FirstTestCase::class; + $thirdTestCaseClass = ImplicitDefaultTestSuite\ExtendedTestCases\ThirdTestCase::class; + $fifthTestCaseClass = ImplicitDefaultTestSuite\ExtendedTestCases\FifthTestCase::class; + + $this->assertCount(3, $testSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite($firstTestCaseClass, $testSuite); + $this->assertTestCaseClassBelongsToTestSuite($thirdTestCaseClass, $testSuite); + $this->assertTestCaseClassBelongsToTestSuite($fifthTestCaseClass, $testSuite); + + $firstTestCase = $this->fetchTestCaseModel($testSuite, $firstTestCaseClass); + $this->assertCount(1, $firstTestCase->getTestModels()); + $this->assertTestMethodBelongsToTestCase($firstTestCaseClass . '::firstEnsureSomething', $firstTestCase); + + $thirdTestCase = $this->fetchTestCaseModel($testSuite, $thirdTestCaseClass); + $this->assertCount(3, $thirdTestCase->getTestModels()); + $this->assertTestMethodBelongsToTestCase($thirdTestCaseClass . '::firstEnsureSomething', $thirdTestCase); + $this->assertTestMethodBelongsToTestCase($thirdTestCaseClass . '::secondEnsureSomething', $thirdTestCase); + $this->assertTestMethodBelongsToTestCase($thirdTestCaseClass . '::thirdEnsureSomething', $thirdTestCase); + + $fifthTestCase = $this->fetchTestCaseModel($testSuite, $fifthTestCaseClass); + $this->assertCount(5, $fifthTestCase->getTestModels()); + $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::firstEnsureSomething', $fifthTestCase); + $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::secondEnsureSomething', $fifthTestCase); + $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::thirdEnsureSomething', $fifthTestCase); + $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::fourthEnsureSomething', $fifthTestCase); + $this->assertTestMethodBelongsToTestCase($fifthTestCaseClass . '::fifthEnsureSomething', $fifthTestCase); + } + + public static function hooksProvider() : array { + return [ + [HookType::BeforeAll, 'HasSingleBeforeAllHook', 'beforeAll'], + [HookType::BeforeEach, 'HasSingleBeforeEachHook', 'beforeEach'], + [HookType::AfterAll, 'HasSingleAfterAllHook', 'afterAll'], + [HookType::AfterEach, 'HasSingleAfterEachHook', 'afterEach'] + ]; + } + + #[DataProvider('hooksProvider')] + public function testParsingSimpleTestCaseHasHooks(HookType $hookType, string $subNamespace, string $methodName) { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath($subNamespace)); + $testSuites = $results->getTestSuiteModels(); + + $this->assertCount(1, $testSuites); + $testSuite = $testSuites[0]; + + $this->assertCount(1, $testSuite->getTestCaseModels()); + $myTestCase = $testSuite->getTestCaseModels()[0]; + + $this->assertCount(1, $myTestCase->getHooks($hookType)); + $this->assertSame('Acme\\DemoSuites\\ImplicitDefaultTestSuite\\' . $subNamespace . '\\MyTestCase', $myTestCase->getHooks($hookType)[0]->getClass()); + $this->assertSame($methodName, $myTestCase->getHooks($hookType)[0]->getMethod()); + } + + public function testParsingDataProvider() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('HasDataProvider')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $results->getTestSuiteModels()[0]; + + $this->assertCount(1, $testSuite->getTestCaseModels()); + $testCaseModel = $testSuite->getTestCaseModels()[0]; + + $this->assertSame(ImplicitDefaultTestSuite\HasDataProvider\MyTestCase::class, $testCaseModel->getClass()); + $this->assertCount(1, $testCaseModel->getTestModels()); + $testMethodModel = $testCaseModel->getTestModels()[0]; + + $this->assertSame('ensureStringsEqual', $testMethodModel->getMethod()); + $this->assertSame('myDataProvider', $testMethodModel->getDataProvider()); + } + + public function testExplicitTestSuiteAnnotatedDefaultTestSuite() { + $results = $this->subject->parse($this->explicitTestSuitePath('AnnotatedDefaultTestSuite')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $results->getTestSuiteModels()[0]; + + $this->assertSame(ExplicitTestSuite\AnnotatedDefaultTestSuite\MyTestSuite::class, $testSuite->getClass()); + $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\AnnotatedDefaultTestSuite\MyTestCase::class, $testSuite); + } + + public function testExplicitTestSuiteTestCaseDefinesTestSuite() { + $results = $this->subject->parse($this->explicitTestSuitePath('TestCaseDefinesTestSuite')); + + $this->assertCount(2, $results->getTestSuiteModels()); + + $firstTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class); + $this->assertCount(1, $firstTestSuite->getTestCaseModels()); + + $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinesTestSuite\FirstTestCase::class, $firstTestSuite); + + $secondTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class); + $this->assertCount(2, $secondTestSuite->getTestCaseModels()); + + $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinesTestSuite\SecondTestCase::class, $secondTestSuite); + $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinesTestSuite\ThirdTestCase::class, $secondTestSuite); + } + + public function testExplicitTestSuiteTestCaseDefinesAndTestCaseDefaultTestSuite() { + $results = $this->subject->parse($this->explicitTestSuitePath('TestCaseDefinedAndImplicitDefaultTestSuite')); + + $this->assertCount(2, $results->getTestSuiteModels()); + + $defaultTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); + $this->assertCount(1, $defaultTestSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite\FirstTestCase::class, $defaultTestSuite); + + $myTestSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite\MyTestSuite::class); + $this->assertCount(1, $myTestSuite->getTestCaseModels()); + $this->assertTestCaseClassBelongsToTestSuite(ExplicitTestSuite\TestCaseDefinedAndImplicitDefaultTestSuite\SecondTestCase::class, $myTestSuite); + } + + public function testImplicitDefaultTestSuitePathTestDisabled() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestDisabled')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); + $testCase = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class); + + $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class . '::checkSomething', $testCase); + $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class . '::skippedTest', $testCase); + + $checkSomething = $this->fetchTestModel($testCase, 'checkSomething'); + $skippedTest = $this->fetchTestModel($testCase, 'skippedTest'); + + $this->assertFalse($checkSomething->isDisabled()); + $this->assertTrue($skippedTest->isDisabled()); + $this->assertNull($skippedTest->getDisabledReason()); + } + + public function testImplicitDefaultTestSuitePathTestCaseDisabled() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseDisabled')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); + $testCase = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class); + + $this->assertTrue($testCase->isDisabled()); + + $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class . '::skippedOne', $testCase); + $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class . '::skippedTwo', $testCase); + $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class . '::skippedThree', $testCase); + + $one = $this->fetchTestModel($testCase, 'skippedOne'); + $two = $this->fetchTestModel($testCase, 'skippedTwo'); + $three = $this->fetchTestModel($testCase, 'skippedThree'); + + $this->assertTrue($one->isDisabled()); + $this->assertNull($one->getDisabledReason()); + $this->assertTrue($two->isDisabled()); + $this->assertNull($two->getDisabledReason()); + $this->assertTrue($three->isDisabled()); + $this->assertNull($three->getDisabledReason()); + } + + public function testExplicitTestSuiteTestSuiteDisabled() { + $results = $this->subject->parse($this->explicitTestSuitePath('TestSuiteDisabled')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class); + $this->assertTrue($testSuite->isDisabled()); + + $this->assertCount(2, $testSuite->getTestCaseModels()); + $firstTestCase = $this->fetchTestCaseModel($testSuite, ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class); + $secondTestCase = $this->fetchTestCaseModel($testSuite, ExplicitTestSuite\TestSuiteDisabled\SecondTestCase::class); + + $this->assertTrue($firstTestCase->isDisabled()); + $this->assertTrue($secondTestCase->isDisabled()); + + $this->assertTestMethodBelongsToTestCase(ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class . '::testOne', $firstTestCase); + $this->assertTestMethodBelongsToTestCase(ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class . '::testTwo', $firstTestCase); + $this->assertTestMethodBelongsToTestCase(ExplicitTestSuite\TestSuiteDisabled\SecondTestCase::class . '::testOne', $secondTestCase); + + $one = $this->fetchTestModel($firstTestCase, 'testOne'); + $two = $this->fetchTestModel($firstTestCase, 'testTwo'); + $three = $this->fetchTestModel($firstTestCase, 'testOne'); + + $this->assertTrue($one->isDisabled()); + $this->assertNull($one->getDisabledReason()); + $this->assertTrue($two->isDisabled()); + $this->assertNull($two->getDisabledReason()); + $this->assertTrue($three->isDisabled()); + $this->assertNull($three->getDisabledReason()); + } + + public function testImplicitDefaultTestSuiteTestDisabledCustomMessage() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestDisabledCustomMessage')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); + $this->assertFalse($testSuite->isDisabled()); + + $this->assertCount(1, $testSuite->getTestCaseModels()); + $testCaseModel = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestDisabledCustomMessage\MyTestCase::class); + + $this->assertTestMethodBelongsToTestCase(ImplicitDefaultTestSuite\TestDisabledCustomMessage\MyTestCase::class . '::testOne', $testCaseModel); + + $testModel = $this->fetchTestModel($testCaseModel, 'testOne'); + + $this->assertTrue($testModel->isDisabled()); + $this->assertSame('Not sure what we should do here yet', $testModel->getDisabledReason()); + } + + public function testImplicitDefaultTestSuiteTestCaseDisabledCustomMessage() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseDisabledCustomMessage')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ImplicitTestSuite::class); + $this->assertFalse($testSuite->isDisabled()); + + $this->assertCount(1, $testSuite->getTestCaseModels()); + $testCaseModel = $this->fetchTestCaseModel($testSuite, ImplicitDefaultTestSuite\TestCaseDisabledCustomMessage\MyTestCase::class); + + $this->assertTrue($testCaseModel->isDisabled()); + $this->assertSame('The TestCase is disabled', $testCaseModel->getDisabledReason()); + } + + public function testExplicitTestSuiteTestSuiteDisabledCustomMessage() { + $results = $this->subject->parse($this->explicitTestSuitePath('TestSuiteDisabledCustomMessage')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestSuiteDisabledCustomMessage\MyTestSuite::class); + $this->assertTrue($testSuite->isDisabled()); + $this->assertSame('The AttachToTestSuite is disabled', $testSuite->getDisabledReason()); + } + + public function testImplicitDefaultTestSuiteRecursiveTestLayout() { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('RecursiveTestLayout')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $this->assertCount(5, $results->getTestSuiteModels()[0]->getTestCaseModels()); + } + + public function testImplicitDefaultTestSuiteTestHasTimeoutTestModelHasCorrectValue() : void { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestHasTimeout')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $results->getTestSuiteModels()[0]; + $this->assertCount(1, $testSuite->getTestCaseModels()); + + $test = $this->fetchTestModel($testSuite->getTestCaseModels()[0], 'timeOutTest'); + + $this->assertSame(100, $test->getTimeout()); + } + + public function testImplicitDefaultTestSuiteTestCaseHasTimeoutIsSetOnTestModel() : void { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseHasTimeout')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $results->getTestSuiteModels()[0]; + $this->assertCount(1, $testSuite->getTestCaseModels()); + $testCase = $testSuite->getTestCaseModels()[0]; + $this->assertCount(2, $testCase->getTestModels()); + + $actual = [ + $testCase->getTestModels()[0]->getTimeout(), + $testCase->getTestModels()[1]->getTimeout(), + ]; + + $this->assertSame([150, 150], $actual); + } + + public function testExplicitTestSuiteTestSuiteHasTimeoutIsSetOnAllTestModels() : void { + $results = $this->subject->parse($this->explicitTestSuitePath('TestSuiteHasTimeout')); + + $this->assertCount(1, $results->getTestSuiteModels()); + $testSuite = $results->getTestSuiteModels()[0]; + $this->assertCount(2, $testSuite->getTestCaseModels()); + $this->assertCount(1, $testSuite->getTestCaseModels()[0]->getTestModels()); + $this->assertCount(1, $testSuite->getTestCaseModels()[1]->getTestModels()); + + $this->assertSame(125, $testSuite->getTestCaseModels()[0]->getTestModels()[0]->getTimeout()); + $this->assertSame(125, $testSuite->getTestCaseModels()[1]->getTestModels()[0]->getTimeout()); + } + + public static function hookPriorityProvider() : array { + return [ + [HookType::BeforeAll, 'beforeAll'], + [HookType::AfterAll, 'afterAll'], + [HookType::BeforeEach, 'beforeEach'], + [HookType::AfterEach, 'afterEach'] + ]; + } + + #[DataProvider('hookPriorityProvider')] + public function testImplicitDefaultTestSuiteTestCaseHooksPriorityBeforeAll(HookType $hookType, string $typePrefix) : void { + $results = $this->subject->parse($this->implicitDefaultTestSuitePath('TestCaseHooksPriority')); + + $testCase = $this->fetchTestCaseModel( + $results->getTestSuiteModels()[0], + ImplicitDefaultTestSuite\TestCaseHooksPriority\MyTestCase::class + ); + + $expected = [ + $typePrefix . 'One' => 1, + $typePrefix . 'Two' => 2, + $typePrefix . 'Three' => 3 + ]; + $hooks = $testCase->getHooks($hookType); + + $actual = []; + foreach ($hooks as $hook) { + $actual[$hook->getMethod()] = $hook->getPriority(); + } + + $this->assertEquals($expected, $actual); + } + + public static function suiteHookPriorityProvider() : array { + return array_merge( + self::hookPriorityProvider(), + [ + [HookType::BeforeEachTest, 'beforeEachTest'], + [HookType::AfterEachTest, 'afterEachTest'] + ] + ); + + } + + #[DataProvider('suiteHookPriorityProvider')] + public function testExplicitTestSuiteTestSuiteHookPriority(HookType $hookType, string $typePrefix) { + $results = $this->subject->parse($this->explicitTestSuitePath('TestSuiteHookPriority')); + + $testSuite = $this->fetchTestSuiteModel($results->getTestSuiteModels(), ExplicitTestSuite\TestSuiteHookPriority\MyTestSuite::class); + + $expected = [ + $typePrefix . 'One' => 1, + $typePrefix . 'Two' => 2, + $typePrefix . 'Three' => 3 + ]; + $hooks = $testSuite->getHooks($hookType); + $actual = []; + foreach ($hooks as $hook) { + $actual[$hook->getMethod()] = $hook->getPriority(); + } + + $this->assertEquals($expected, $actual); + } + + public function testExplicitTestSuiteTestSuiteDefinesNamespaceToAttach() : void { + /** @var ParserResult $results */ + $results = $this->subject->parse($this->explicitTestSuitePath('TestSuiteDefinesNamespaceToAttach')); + + $this->assertCount(2, $results->getTestSuiteModels()); + + $implicitSuite = $this->fetchTestSuiteModel( + $results->getTestSuiteModels(), + ImplicitTestSuite::class + ); + $explicitSuite = $this->fetchTestSuiteModel( + $results->getTestSuiteModels(), + ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\MyTestSuite::class + ); + + $this->fetchTestCaseModel($implicitSuite, ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\MyTestCase::class); + $this->fetchTestCaseModel($implicitSuite, ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\HasImplicitTestSuite\MyTestCase::class); + $this->fetchTestCaseModel($explicitSuite, ExplicitTestSuite\TestSuiteDefinesNamespaceToAttach\HasExplicitTestSuite\MyTestCase::class); + } + + /** + * @param TestSuiteModel[] $testSuites + * @param string $testSuiteClassName + * @return TestSuiteModel + */ + private function fetchTestSuiteModel(array $testSuites, string $testSuiteClassName) : TestSuiteModel { + foreach ($testSuites as $testSuite) { + if ($testSuite->getClass() === $testSuiteClassName) { + return $testSuite; + } + } + $this->fail('Expected the set of TestSuites to have a class matching . ' . $testSuiteClassName); + } + + private function fetchTestCaseModel(TestSuiteModel $testSuite, string $className) : TestCaseModel { + foreach ($testSuite->getTestCaseModels() as $testCaseModel) { + if ($testCaseModel->getClass() === $className) { + return $testCaseModel; + } + } + $this->fail('Expected ' . $testSuite->getClass() . ' to have TestCase ' . $className); + } + + private function fetchTestModel(TestCaseModel $model, string $methodName) : TestModel { + foreach ($model->getTestModels() as $testMethodModel) { + if ($testMethodModel->getMethod() === $methodName) { + return $testMethodModel; + } + } + $this->fail('Expected TestCase to have test ' . $methodName); + } + +} diff --git a/tests/Unit/Framework/Statistics/SummaryCalculatorTest.php b/tests/Unit/Framework/Statistics/SummaryCalculatorTest.php new file mode 100644 index 0000000..52e2929 --- /dev/null +++ b/tests/Unit/Framework/Statistics/SummaryCalculatorTest.php @@ -0,0 +1,337 @@ + [self::implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class + ]] + ]; + } + + #[DataProvider('aggregateSummaryTestSuiteNamesProvider')] + public function testGetAggregateSummaryGetTestSuiteNames(string $path, array $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertEqualsCanonicalizing($expected, $calculator->getAggregateSummary()->getTestSuiteNames()); + } + + public static function aggregateSummaryTotalTestSuiteCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 3] + ]; + } + + #[DataProvider('aggregateSummaryTotalTestSuiteCountProvider')] + public function testGetAggregateSummaryGetTotalTestSuiteCount(string $path, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertSame($expected, $calculator->getAggregateSummary()->getTotalTestSuiteCount()); + } + + public static function aggregateSummaryDisabledTestSuiteCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 0], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 1] + ]; + } + + #[DataProvider('aggregateSummaryDisabledTestSuiteCountProvider')] + public function testGetAggregateSummaryGetDisabledTestSuiteCount(string $path, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertSame($expected, $calculator->getAggregateSummary()->getDisabledTestSuiteCount()); + } + + public static function aggregateSummaryTotalTestCaseCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), 3], + 'MultipleTestCase' => [self::implicitDefaultTestSuitePath('MultipleTestCase'), 3] + ]; + } + + #[DataProvider('aggregateSummaryTotalTestCaseCountProvider')] + public function testGetAggregateSummaryGetTestCaseCount(string $path, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertSame($expected, $calculator->getAggregateSummary()->getTotalTestCaseCount()); + } + + public static function aggregateSummaryDisabledTestCaseCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 1], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 2] + ]; + } + + #[DataProvider('aggregateSummaryDisabledTestCaseCountProvider')] + public function testGetAggregateSummaryGetDisabledTestCaseCount(string $path, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertSame($expected, $calculator->getAggregateSummary()->getDisabledTestCaseCount()); + } + + public static function aggregateSummaryTotalTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'MultipleTest' => [self::implicitDefaultTestSuitePath('MultipleTest'), 3], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), 9] + ]; + } + + /** + * @dataProvider aggregateSummaryTotalTestCountProvider + */ + public function testGetAggregateSummaryGetTestCount(string $path, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertSame($expected, $calculator->getAggregateSummary()->getTotalTestCount()); + } + + public static function aggregateSummaryDisabledTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), 0], + [self::implicitDefaultTestSuitePath('TestDisabled'), 1], + [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 3] + ]; + } + + #[DataProvider('aggregateSummaryDisabledTestCountProvider')] + public function testGetAggregateSummaryGetDisabledTestCount(string $path, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $this->assertSame($expected, $calculator->getAggregateSummary()->getDisabledTestCount()); + } + + public function testGetAggregateSummarySameObject() : void { + $results = (new StaticAnalysisParser())->parse($this->implicitDefaultTestSuitePath('SingleTest')); + $calculator = new SummaryCalculator($results); + + $this->assertSame($calculator->getAggregateSummary(), $calculator->getAggregateSummary()); + } + + public function testGetTestSuiteSummaryGetTestSuiteName() { + $results = (new StaticAnalysisParser())->parse($this->implicitDefaultTestSuitePath('SingleTest')); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestSuiteSummary(ImplicitTestSuite::class); + $this->assertSame(ImplicitTestSuite::class, $testSuiteSummary->getTestSuiteName()); + } + + public static function suiteSummaryTestCaseNamesProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, [ImplicitDefaultTestSuite\SingleTest\MyTestCase::class]], + [self::implicitDefaultTestSuitePath('MultipleTest'), ImplicitTestSuite::class, [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class]], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, [ + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, [ + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class + ]] + ]; + } + + #[DataProvider('suiteSummaryTestCaseNamesProvider')] + public function testGetTestSuiteSummaryGetTestCaseNames(string $path, string $testSuite, array $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); + $this->assertEqualsCanonicalizing($expected, $testSuiteSummary->getTestCaseNames()); + } + + public static function suiteSummaryTestCaseCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 1], + [self::implicitDefaultTestSuitePath('MultipleTest'), ImplicitTestSuite::class, 1], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 2], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 3], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 2] + ]; + } + + #[DataProvider('suiteSummaryTestCaseCountProvider')] + public function testGetTestSuiteSummaryGetTestCaseCount(string $path, string $testSuite, int $expected) { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); + $this->assertSame($expected, $testSuiteSummary->getTestCaseCount()); + } + + public static function suiteSummaryDisabledTestCaseCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 0], + [self::implicitDefaultTestSuitePath('TestCaseDisabled'), ImplicitTestSuite::class, 1], + [self::explicitTestSuitePath('TestSuiteDisabled'), ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class, 2], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 0], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 0], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 0] + ]; + } + + #[DataProvider('suiteSummaryDisabledTestCaseCountProvider')] + public function testGetTestSuiteSummaryGetDisabledTestCaseCount(string $path, string $testSuite, int $expected) { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); + $this->assertSame($expected, $testSuiteSummary->getDisabledTestCaseCount()); + } + + public static function suiteSummaryTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 1], + [self::implicitDefaultTestSuitePath('MultipleTestCase'), ImplicitTestSuite::class, 4], + [self::implicitDefaultTestSuitePath('ExtendedTestCases'), ImplicitTestSuite::class, 9], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 5], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 3], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 2] + ]; + } + + #[DataProvider('suiteSummaryTestCountProvider')] + public function testGetTestSuiteSummaryGetTestCount(string $path, string $testSuite, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); + $this->assertSame($expected, $testSuiteSummary->getTestCount()); + } + + public static function suiteSummaryDisabledTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitTestSuite::class, 0], + [self::implicitDefaultTestSuitePath('TestCaseDisabled'), ImplicitTestSuite::class, 3], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitTestSuite::class, 0], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, 2], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, 1] + ]; + } + + #[DataProvider('suiteSummaryDisabledTestCountProvider')] + public function testGetTestSuiteSummaryGetDisabledTestCount(string $path, string $testSuite, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestSuiteSummary($testSuite); + $this->assertSame($expected, $testSuiteSummary->getDisabledTestCount()); + } + + public static function caseSummaryTestSuiteNameProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, ImplicitTestSuite::class], + [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class, ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class] + ]; + } + + #[DataProvider('caseSummaryTestSuiteNameProvider')] + public function testGetTestCaseSummaryGetTestSuiteName(string $path, string $testCase, string $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testSuiteSummary = $calculator->getTestCaseSummary($testCase); + $this->assertSame($expected, $testSuiteSummary->getTestSuiteName()); + } + + #[DataProvider('caseSummaryTestSuiteNameProvider')] + public function testGetTestCaseSummaryGetTestCaseName(string $path, string $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testCaseSummary = $calculator->getTestCaseSummary($expected); + $this->assertSame($expected, $testCaseSummary->getTestCaseName()); + } + + public static function caseSummaryTestNamesProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class . '::ensureSomethingHappens' + ]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class, [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testOne', + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testTwo', + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::disabledTest', + ]] + ]; + } + + #[DataProvider('caseSummaryTestNamesProvider')] + public function testGetTestCaseSummaryGetTestNames(string $path, string $testCase, array $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testCaseSummary = $calculator->getTestCaseSummary($testCase); + $this->assertEqualsCanonicalizing($expected, $testCaseSummary->getTestNames()); + } + + public static function caseSummaryTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, 1], + 'MultipleTestCase' => [self::implicitDefaultTestSuitePath('MultipleTestCase'), ImplicitDefaultTestSuite\MultipleTestCase\FooTestCase::class, 2], + 'MultipleTest' => [self::implicitDefaultTestSuitePath('MultipleTest'), ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class, 3], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, 1] + ]; + } + + #[DataProvider('caseSummaryTestCountProvider')] + public function testGetTestCaseSummaryGetTestCount(string $path, string $testCase, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testCaseSummary = $calculator->getTestCaseSummary($testCase); + $this->assertSame($expected, $testCaseSummary->getTestCount()); + } + + public static function caseSummaryDisabledTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, 1], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), ImplicitDefaultTestSuite\TestCaseDisabled\MyTestCase::class, 3] + ]; + } + + #[DataProvider('caseSummaryDisabledTestCountProvider')] + public function testGetTestCaseSummaryGetDisabledTestCount(string $path, string $testCase, int $expected) : void { + $results = (new StaticAnalysisParser())->parse($path); + $calculator = new SummaryCalculator($results); + + $testCaseSummary = $calculator->getTestCaseSummary($testCase); + $this->assertSame($expected, $testCaseSummary->getDisabledTestCount()); + } +} \ No newline at end of file diff --git a/tests/Unit/Framework/Stub/AssertNotTestCase.php b/tests/Unit/Framework/Stub/AssertNotTestCase.php new file mode 100644 index 0000000..7698cd5 --- /dev/null +++ b/tests/Unit/Framework/Stub/AssertNotTestCase.php @@ -0,0 +1,24 @@ +assert->not()->stringEquals('foo', 'bar'); + } + + public function doFailingNotAssertions() { + $this->assert->not()->stringEquals('foo', 'foo'); + } + + public function doBothAssertions() { + $this->assert->stringEquals('bar', 'bar'); + $this->assert->not()->stringEquals('foo', 'bar'); + $this->assert->stringEquals('foo', 'foo'); + } + +} \ No newline at end of file diff --git a/framework_test/Stub/BarAssertionPlugin.php b/tests/Unit/Framework/Stub/BarAssertionPlugin.php similarity index 71% rename from framework_test/Stub/BarAssertionPlugin.php rename to tests/Unit/Framework/Stub/BarAssertionPlugin.php index da41a33..86b945c 100644 --- a/framework_test/Stub/BarAssertionPlugin.php +++ b/tests/Unit/Framework/Stub/BarAssertionPlugin.php @@ -1,11 +1,11 @@ assert->myCustomAssertion(1, 2, 3); + } + +} \ No newline at end of file diff --git a/framework_test/Stub/FailingMockBridgeFactory.php b/tests/Unit/Framework/Stub/FailingMockBridgeFactory.php similarity index 55% rename from framework_test/Stub/FailingMockBridgeFactory.php rename to tests/Unit/Framework/Stub/FailingMockBridgeFactory.php index 411532c..7c575e4 100644 --- a/framework_test/Stub/FailingMockBridgeFactory.php +++ b/tests/Unit/Framework/Stub/FailingMockBridgeFactory.php @@ -1,9 +1,9 @@ assert->stringEquals('foo', 'bar'); + } + + public function doFailureWithCustomMessage() { + $this->assert->stringEquals('foo', 'bar', 'my custom message'); + } + +} \ No newline at end of file diff --git a/framework_test/Stub/FooAssertionPlugin.php b/tests/Unit/Framework/Stub/FooAssertionPlugin.php similarity index 71% rename from framework_test/Stub/FooAssertionPlugin.php rename to tests/Unit/Framework/Stub/FooAssertionPlugin.php index 1030cf3..281ab04 100644 --- a/framework_test/Stub/FooAssertionPlugin.php +++ b/tests/Unit/Framework/Stub/FooAssertionPlugin.php @@ -1,11 +1,11 @@ createdMock = $this->mocks()->createMock(LoggerInterface::class); - $this->assert()->not()->isNull($this->createdMock); + $this->assert->not()->isNull($this->createdMock); } public function getCreatedMock() : ?object { diff --git a/framework_test/Stub/MockBridgeStub.php b/tests/Unit/Framework/Stub/MockBridgeStub.php similarity index 67% rename from framework_test/Stub/MockBridgeStub.php rename to tests/Unit/Framework/Stub/MockBridgeStub.php index 3ad74ea..133f484 100644 --- a/framework_test/Stub/MockBridgeStub.php +++ b/tests/Unit/Framework/Stub/MockBridgeStub.php @@ -1,9 +1,9 @@ calls[] = __FUNCTION__; } - public function createMock(string $class): object { - $this->calls[] = __FUNCTION__ . ' ' . $class; + public function createMock(string $type): object { + $this->calls[] = __FUNCTION__ . ' ' . $type; $object = new stdClass(); - $object->class = $class; + $object->class = $type; return $object; } diff --git a/framework_test/Stub/TestConfiguration.php b/tests/Unit/Framework/Stub/TestConfiguration.php similarity index 87% rename from framework_test/Stub/TestConfiguration.php rename to tests/Unit/Framework/Stub/TestConfiguration.php index 64682dd..0bc62cc 100644 --- a/framework_test/Stub/TestConfiguration.php +++ b/tests/Unit/Framework/Stub/TestConfiguration.php @@ -1,9 +1,10 @@ getSubjectAndContexts(FailingTestCase::class); + $assertionException = null; + try { + $subject->doFailureWithCustomMessage(); + } catch (AssertionFailedException $exception) { + $assertionException = $exception; + } finally { + self::assertInstanceOf(AssertionFailedException::class, $assertionException); + $this->assertNotNull($assertionException); + $this->assertSame('my custom message', $assertionException->getMessage()); + } + } + + public function testRunningOnlyNotAssertionPassing() { + /** @var AssertNotTestCase $subject */ + /** @var AssertionContext $assertionContext */ + [$subject, $assertionContext] = $this->getSubjectAndContexts(AssertNotTestCase::class); + + $subject->doNotAssertion(); + $this->assertEquals(1, $assertionContext->getAssertionCount()); + } + + public function testRunningOnlyNotAssertionFailing() { + /** @var AssertNotTestCase $subject */ + [$subject] = $this->getSubjectAndContexts(AssertNotTestCase::class); + + $assertionException = null; + try{ + $subject->doFailingNotAssertions(); + } catch (AssertionFailedException $exception) { + $assertionException = $exception; + } finally { + $this->assertNotNull($assertionException); + $this->assertSame('Failed asserting type "string" does not equal type "string"', $assertionException->getMessage()); + } + } + + public function testRunningBothNotAndRegularAssertionPassing() { + /** @var AssertNotTestCase $subject */ + /** @var AssertionContext $assertionContext */ + [$subject, $assertionContext] = $this->getSubjectAndContexts(AssertNotTestCase::class); + + $subject->doBothAssertions(); + + $this->assertSame(3, $assertionContext->getAssertionCount()); + } + + public function testCreatingMockWithNoBridge() { + /** @var MockAwareTestCase $subject */ + [$subject] = $this->getSubjectAndContexts(MockAwareTestCase::class); + + $this->expectException(InvalidStateException::class); + $this->expectExceptionMessage('Attempted to create a mock but no MockBridge was defined. Please ensure you\'ve configured a mockBridge in your configuration.'); + + $subject->checkCreatingMock(); + } + + public function testCreatingMockWithBridge() { + $mockBridge = new MockBridgeStub(); + /** @var MockAwareTestCase $subject */ + [$subject] = $this->getSubjectAndContexts(MockAwareTestCase::class, $mockBridge); + + $subject->checkCreatingMock(); + + $this->assertNotNull($subject->getCreatedMock()); + $this->assertSame(LoggerInterface::class, $subject->getCreatedMock()->class); + + // We do not expect initialize or finalize to be called here because that's controlled by the TestSuiteRunner + $this->assertSame([ + 'createMock ' . LoggerInterface::class, + ], $mockBridge->getCalls()); + } + + /** + * @param class-string $testCase + * @param MockBridge|null $mockBridge + * @return array{0: TestCase, 1: AssertionContext, 2: ExpectationContext} + */ + public function getSubjectAndContexts(string $testCase, MockBridge $mockBridge = null) : array { + $testSuite = new ImplicitTestSuite(); + $assertionContext = new AssertionContext(); + $expectationContext = new ExpectationContext( + new TestModel($testCase, 'someMethod'), + $assertionContext, + $mockBridge + ); + $subject = new $testCase($testSuite, $assertionContext, $expectationContext, $mockBridge); + + return [$subject, $assertionContext, $expectationContext]; + } +} \ No newline at end of file diff --git a/tests/Unit/Framework/TestSuiteErrorsTest.php b/tests/Unit/Framework/TestSuiteErrorsTest.php new file mode 100644 index 0000000..66e192d --- /dev/null +++ b/tests/Unit/Framework/TestSuiteErrorsTest.php @@ -0,0 +1,134 @@ +buildTestSuiteRunner(); + } + + public function testImplicitDefaultTestSuiteExceptionThrowingBeforeAllHaltsTestProcessing() { + $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingBeforeAll'); + $results = $this->parser->parse($dir); + + $this->expectException(TestCaseSetUpException::class); + $class = ImplicitDefaultTestSuite\ExceptionThrowingBeforeAll\MyTestCase::class; + $this->expectExceptionMessage('Failed setting up "' . $class . '::beforeAll" #[BeforeAll] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the class beforeAll".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testImplicitDefaultTestSuiteExceptionThrowingAfterAllHaltsTestProcessing() { + $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingAfterAll'); + $results = $this->parser->parse($dir); + + $this->expectException(TestCaseTearDownException::class); + $class = ImplicitDefaultTestSuite\ExceptionThrowingAfterAll\MyTestCase::class; + $this->expectExceptionMessage('Failed tearing down "' . $class . '::afterAll" #[AfterAll] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the class afterAll".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testImplicitDefaultTestSuiteExceptionThrowingBeforeEachHaltsTestProcessing() { + $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingBeforeEach'); + $results = $this->parser->parse($dir); + + $this->expectException(TestSetUpException::class); + $class = ImplicitDefaultTestSuite\ExceptionThrowingBeforeEach\MyTestCase::class; + $this->expectExceptionMessage('Failed setting up "' . $class . '::beforeEach" #[BeforeEach] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the object beforeEach".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testImplicitDefaultTestSuiteExceptionThrowingAfterEachHaltsTestProcessing() { + $dir = $this->implicitDefaultTestSuitePath('ExceptionThrowingAfterEach'); + $results = $this->parser->parse($dir); + + $this->expectException(TestTearDownException::class); + $class = ImplicitDefaultTestSuite\ExceptionThrowingAfterEach\MyTestCase::class; + $this->expectExceptionMessage('Failed tearing down "' . $class . '::afterEach" #[AfterEach] hook with exception of type "RuntimeException" with code 0 and message "Thrown in the object afterEach".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testExplicitTestSuiteExceptionThrowingTestSuiteBeforeAllHaltsTestProcessing() { + $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteBeforeAll'); + $results = $this->parser->parse($dir); + + $this->expectException(TestSuiteSetUpException::class); + $class = ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeAll\MyTestSuite::class; + $this->expectExceptionMessage('Failed setting up "' . $class . '::throwException" #[BeforeAll] hook with exception of type "RuntimeException" with code 0 and message "Thrown in AttachToTestSuite".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testExplicitTestSuiteExceptionThrowingTestSuiteBeforeEachHaltsTestProcessing() { + $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteBeforeEach'); + $results = $this->parser->parse($dir); + + $this->expectException(TestSuiteSetUpException::class); + $class = ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEach\MyTestSuite::class; + $this->expectExceptionMessage('Failed setting up "' . $class . '::throwEachException" #[BeforeEach] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite BeforeEach".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testExplicitTestSuiteExceptionThrowingTestSuiteAfterEachHaltsTestProcessing() { + $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteAfterEach'); + $results = $this->parser->parse($dir); + + $this->expectException(TestSuiteTearDownException::class); + $class = ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEach\MyTestSuite::class; + $this->expectExceptionMessage('Failed tearing down "' . $class . '::throwEachException" #[AfterEach] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite AfterEach".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testExplicitTestSuiteExceptionThrowingTestSuiteAfterEachTestHaltsTestProcessing() { + $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteAfterEachTest'); + $results = $this->parser->parse($dir); + + $this->expectException(TestTearDownException::class); + $class = ExplicitTestSuite\ExceptionThrowingTestSuiteAfterEachTest\MyTestSuite::class; + $this->expectExceptionMessage('Failed tearing down "' . $class . '::throwEachTestException" #[AfterEachTest] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite AfterEachTest".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testExplicitTestSuiteExceptionThrowingTestSuiteBeforeEachTestHaltsTestProcessing() { + $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteBeforeEachTest'); + $results = $this->parser->parse($dir); + + $this->expectException(TestSetUpException::class); + $class = ExplicitTestSuite\ExceptionThrowingTestSuiteBeforeEachTest\MyTestSuite::class; + $this->expectExceptionMessage('Failed setting up "' . $class . '::throwEachTestException" #[BeforeEachTest] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite BeforeEachTest".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + public function testExplicitTestSuiteExceptionThrowingTestSuiteAfterAllHaltsTestProcessing() { + $dir = $this->explicitTestSuitePath('ExceptionThrowingTestSuiteAfterAll'); + $results = $this->parser->parse($dir); + + $this->expectException(TestSuiteTearDownException::class); + $class = ExplicitTestSuite\ExceptionThrowingTestSuiteAfterAll\MyTestSuite::class; + $this->expectExceptionMessage('Failed tearing down "' . $class . '::throwException" #[AfterAll] hook with exception of type "RuntimeException" with code 0 and message "AttachToTestSuite AfterAll".'); + + $this->testSuiteRunner->runTestSuites($results)->await(); + } + +} \ No newline at end of file diff --git a/tests/Unit/Framework/TestSuiteRunnerScaffolding.php b/tests/Unit/Framework/TestSuiteRunnerScaffolding.php new file mode 100644 index 0000000..000322b --- /dev/null +++ b/tests/Unit/Framework/TestSuiteRunnerScaffolding.php @@ -0,0 +1,33 @@ +parser = new StaticAnalysisParser(); + $this->emitter = new AmpEmitter(); + $this->mockBridgeFactory = new NoConstructorMockBridgeFactory(); + $this->testSuiteRunner = new TestSuiteRunner( + $this->emitter, + new NullRandomizer(), + $this->mockBridgeFactory + ); + } + +} \ No newline at end of file diff --git a/tests/Unit/Framework/TestSuiteRunnerStatisticsTest.php b/tests/Unit/Framework/TestSuiteRunnerStatisticsTest.php new file mode 100644 index 0000000..e32a10b --- /dev/null +++ b/tests/Unit/Framework/TestSuiteRunnerStatisticsTest.php @@ -0,0 +1,1099 @@ +buildTestSuiteRunner(); + } + + private function createEventRecordingListener() : Listener { + return new class() implements Listener { + + public array $actual = []; + + public function handle(Event $event) : Future|CompositeFuture|null { + $this->actual[] = $event; + return null; + } + }; + } + + public function testTestProcessingStartedHasAggregateSummary() { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('TestCaseDisabled')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_STARTED, $listener); + + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingStartedEvent $testStartedEvent */ + $testStartedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingStartedEvent::class, $testStartedEvent); + $this->assertInstanceOf(AggregateSummary::class, $testStartedEvent->payload()); + } + + public static function processedAggregateSummaryTestSuiteInfoProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitTestSuite::class, ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class + ]] + ]; + } + + #[DataProvider('processedAggregateSummaryTestSuiteInfoProvider')] + public function testTestProcessingFinishedHasProcessedAggregateSummaryWithCorrectTestSuiteNames(string $path, array $expected) { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + + $summary = $testFinishedEvent->payload(); + + $this->assertEqualsCanonicalizing( + $expected, + $summary->getTestSuiteNames() + ); + } + + public static function processedAggregateSummaryWithCorrectTotalTestSuiteCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 3] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectTotalTestSuiteCountProvider')] + public function testProcessedAggregateSummaryWithCorrectTotalTestSuiteCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getTotalTestSuiteCount()); + } + + + public static function processedAggregateSummaryWithCorrectDisabledTestSuiteCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 0], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 1] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectDisabledTestSuiteCountProvider')] + public function testProcessedAggregateSummaryWithCorrectDisabledTestSuiteCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getDisabledTestSuiteCount()); + } + + public static function processedAggregateSummaryWithCorrectTotalTestCaseCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 7], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 2] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectTotalTestCaseCountProvider')] + public function testProcessedAggregateSummaryWithCorrectTotalTestCaseCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getTotalTestCaseCount()); + } + + public static function processedAggregateSummaryWithCorrectDisabledTestCaseCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 0], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 2], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 1] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectDisabledTestCaseCountProvider')] + public function testProcessedAggregateSummaryWithCorrectDisabledTestCaseCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingFinishedEvent $testFinishedEvent */ + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getDisabledTestCaseCount()); + } + + public static function processedAggregateSummaryWithCorrectTotalTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 13], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 3], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 3], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), 1] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectTotalTestCountProvider')] + public function testProcessedAggregateSummaryWithCorrectTotalTestCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingFinishedEvent $testFinishedEvent */ + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getTotalTestCount()); + } + + public static function processedAggregateSummaryWithCorrectDisabledTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 3], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 3], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 3], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), 0] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectDisabledTestCountProvider')] + public function testProcessedAggregateSummaryWithCorrectDisabledTestCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingFinishedEvent $testFinishedEvent */ + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getDisabledTestCount()); + } + + public static function processedAggregateSummaryWithCorrectPassedTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 8], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 0], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 0], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), 0] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectPassedTestCountProvider')] + public function testProcessedAggregateSummaryWithCorrectPassedTestCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingFinishedEvent $testFinishedEvent */ + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getPassedTestCount()); + } + + public static function processedAggregateSummaryWithCorrectFailedTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 1], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 0], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 0], + 'FailedAssertion' => [self::implicitDefaultTestSuitePath('FailedAssertion'), 1], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), 0] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectFailedTestCountProvider')] + public function testProcessedAggregateSummaryWithCorrectFailedTestCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getFailedTestCount()); + } + + public static function processedAggregateSummaryWithCorrectErroredTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 0], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 1], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), 0], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), 0], + 'FailedAssertion' => [self::implicitDefaultTestSuitePath('FailedAssertion'), 0], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), 1] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectErroredTestCountProvider')] + public function testProcessedAggregateSummaryWithCorrectErroredTestCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingFinishedEvent $testFinishedEvent */ + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getErroredTestCount()); + } + + public static function processedAggregateSummaryWithCorrectAssertionCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), 1], + 'MultipleTest' => [self::implicitDefaultTestSuitePath('MultipleTest'), 3], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), 10], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), 22] + ]; + } + + #[DataProvider('processedAggregateSummaryWithCorrectAssertionCountProvider')] + public function testProcessedAggregateSummaryWithCorrectAssertionCount(string $path, int $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertCount(1, $listener->actual); + /** @var ProcessingFinishedEvent $testFinishedEvent */ + $testFinishedEvent = $listener->actual[0]; + + $this->assertInstanceOf(ProcessingFinishedEvent::class, $testFinishedEvent); + $this->assertSame($expected, $testFinishedEvent->payload()->getAssertionCount()); + } + + public static function processedTestSuiteSummaryTestSuiteNameProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryTestSuiteNameProvider')] + public function testProcessedTestSuiteSummaryHasCorrectTestSuiteName(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $this->assertEqualsCanonicalizing( + $expected, + array_map(static fn(Event $event) => $event->payload()->getTestSuiteName(), $listener->actual) + ); + } + + public static function processedTestSuiteSummaryTestCaseNamesProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitTestSuite::class => [ImplicitDefaultTestSuite\SingleTest\MyTestCase::class] + ]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class => [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class, + ], + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class => [ + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class, + ], + ImplicitTestSuite::class => [ + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class + ] + ]], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), [ + ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => [ + ExplicitTestSuite\TestSuiteDisabled\FirstTestCase::class, + ExplicitTestSuite\TestSuiteDisabled\SecondTestCase::class + ] + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryTestCaseNamesProvider')] + public function testProcessedTestSuiteSummaryHasTestCaseNames(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getTestCaseNames(); + } + + $testSuites = array_keys($actual); + + $this->assertNotEmpty($testSuites); + + foreach ($testSuites as $testSuite) { + $this->assertArrayHasKey($testSuite, $expected); + + $this->assertEqualsCanonicalizing($expected[$testSuite], $actual[$testSuite]); + } + } + + public static function processedTestSuiteSummaryTotalTestCaseCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitTestSuite::class => 1, + ]], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), [ + ImplicitTestSuite::class => 3 + ]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 + ]], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), [ + ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 2 + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryTotalTestCaseCountProvider')] + public function testProcessedTestSuiteSummaryHasTotalTestCaseCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getTestCaseCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryDisabledTestCaseCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitTestSuite::class => 0, + ]], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ + ImplicitTestSuite::class => 1 + ]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 + ]], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), [ + ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 2 + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryDisabledTestCaseCountProvider')] + public function testProcessedTestSuiteSummaryHasDisabledTestCaseCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getDisabledTestCaseCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryTotalTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitTestSuite::class => 1, + ]], + [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ + ImplicitTestSuite::class => 3 + ]], + [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 + ]], + [self::explicitTestSuitePath('TestSuiteDisabled'), [ + ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 3 + ]], + [self::implicitDefaultTestSuitePath('TestDisabled'), [ + ImplicitTestSuite::class => 2 + ]], + [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitTestSuite::class => 1 + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryTotalTestCountProvider')] + public function testProcessedTestSuiteSummaryHasTotalTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getTestCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryDisabledTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitTestSuite::class => 0, + ]], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ + ImplicitTestSuite::class => 3 + ]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 + ]], + 'TestSuiteDisabled' => [self::explicitTestSuitePath('TestSuiteDisabled'), [ + ExplicitTestSuite\TestSuiteDisabled\MyTestSuite::class => 3 + ]], + 'TestDisabled' => [self::implicitDefaultTestSuitePath('TestDisabled'), [ + ImplicitTestSuite::class => 1 + ]], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitTestSuite::class => 0 + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryDisabledTestCountProvider')] + public function testProcessedTestSuiteSummaryHasDisabledTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getDisabledTestCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryPassedTestCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ImplicitTestSuite::class => 1,]], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 + ]], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 8]], + 'TestDisabled' => [self::implicitDefaultTestSuitePath('TestDisabled'), [ + ImplicitTestSuite::class => 1 + ]], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitTestSuite::class => 0 + ]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryPassedTestCountProvider')] + public function testProcessedTestSuiteSummaryHasPassedTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getPassedTestCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryFailedTestCountProvider() : array { + return [ + 'FailedAssertion' => [self::implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 1,]], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 + ]], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 1]], + 'FailedNotAssertion' => [self::implicitDefaultTestSuitePath('FailedNotAssertion'), [ImplicitTestSuite::class => 1]], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ImplicitTestSuite::class => 0]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryFailedTestCountProvider')] + public function testProcessedTestSuiteSummaryHasFailedTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getFailedTestCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryErroredTestCountProvider() : array { + return [ + 'FailedAssertion' => [self::implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 0]], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 0, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 0 + ]], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 0]], + 'FailedNotAssertion' => [self::implicitDefaultTestSuitePath('FailedNotAssertion'), [ImplicitTestSuite::class => 0]], + 'ExceptionThrowingTest' => [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ImplicitTestSuite::class => 1]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryErroredTestCountProvider')] + public function testProcessedTestSuiteSummaryHasErroredTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getErroredTestCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestSuiteSummaryAssertionCountProvider() : array { + return [ + 'FailedAssertion' => [self::implicitDefaultTestSuitePath('FailedAssertion'), [ImplicitTestSuite::class => 1,]], + 'TestCaseDisabled' => [self::implicitDefaultTestSuitePath('TestCaseDisabled'), [ImplicitTestSuite::class => 0]], + 'TestCaseDefinesTestSuite' => [self::explicitTestSuitePath('TestCaseDefinesTestSuite'), [ + ExplicitTestSuite\TestCaseDefinesTestSuite\MyFirstTestSuite::class => 1, + ExplicitTestSuite\TestCaseDefinesTestSuite\MySecondTestSuite::class => 2 + ]], + 'ExtendedTestCases' => [self::implicitDefaultTestSuitePath('ExtendedTestCases'), [ImplicitTestSuite::class => 22]], + 'FailedNotAssertion' => [self::implicitDefaultTestSuitePath('FailedNotAssertion'), [ImplicitTestSuite::class => 1]] + ]; + } + + #[DataProvider('processedTestSuiteSummaryAssertionCountProvider')] + public function testProcessedTestSuiteSummaryHasAssertionCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestSuiteName()] = $event->payload()->getAssertionCount(); + } + + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryTestSuiteNameProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => ImplicitTestSuite::class + ]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => ImplicitDefaultTestSuite\KitchenSink\FirstTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => ImplicitDefaultTestSuite\KitchenSink\WhatAbout\PotatoTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => ImplicitTestSuite::class, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => ImplicitTestSuite::class + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryTestSuiteNameProvider')] + public function testProcessedTestCaseSummaryHasCorrectTestSuiteName(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getTestSuiteName(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryTestNamesProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class . '::ensureSomethingHappens' + ] + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testOne', + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::testTwo', + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class . '::disabledTest' + ], + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class . '::checkTwo', + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class . '::checkTwoDisabled' + ], + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class . '::isBestHobbit', + ], + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class . '::isBestHobbit' + ], + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class . '::isBestHobbit' + ], + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#0', + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#1', + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#2', + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class . '::checkFood#3' + ], + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => [ + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class . '::throwException' + ] + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryTestNamesProvider')] + public function testProcessedTestCaseSummaryHasCorrectTestNames(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getTestNames(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 1 + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 3, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 2, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 4, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 1 + ]], + [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 1 + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryTestCountProvider')] + public function testProcessedTestCaseSummaryHasCorrectTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getTestCount(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryDisabledTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 + ]], + [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 0 + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryDisabledTestCountProvider')] + public function testProcessedTestCaseSummaryHasCorrectDisabledTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getDisabledTestCount(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryPassedTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 1 + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 2, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 4, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 + ]], + [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 0 + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryPassedTestCountProvider')] + public function testProcessedTestCaseSummaryHasCorrectPassedTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getPassedTestCount(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryFailedTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 + ]], + [self::implicitDefaultTestSuitePath('FailedAssertion'), [ + ImplicitDefaultTestSuite\FailedAssertion\MyTestCase::class => 1, + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 + ]], + [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 0 + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryFailedTestCountProvider')] + public function testProcessedTestCaseSummaryHasCorrectFailedTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getFailedTestCount(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryErroredTestCountProvider() : array { + return [ + [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 0 + ]], + [self::implicitDefaultTestSuitePath('FailedAssertion'), [ + ImplicitDefaultTestSuite\FailedAssertion\MyTestCase::class => 0, + ]], + [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 1 + ]], + [self::implicitDefaultTestSuitePath('ExceptionThrowingTest'), [ + ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class => 1 + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryErroredTestCountProvider')] + public function testProcessedTestCaseSummaryHasCorrectErroredTestCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getErroredTestCount(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public static function processedTestCaseSummaryAssertionCountProvider() : array { + return [ + 'SingleTest' => [self::implicitDefaultTestSuitePath('SingleTest'), [ + ImplicitDefaultTestSuite\SingleTest\MyTestCase::class => 1 + ]], + 'FailedAssertion' => [self::implicitDefaultTestSuitePath('FailedAssertion'), [ + ImplicitDefaultTestSuite\FailedAssertion\MyTestCase::class => 1, + ]], + 'KitchenSink' => [self::implicitDefaultTestSuitePath('KitchenSink'), [ + ImplicitDefaultTestSuite\KitchenSink\FirstTestCase::class => 2, + ImplicitDefaultTestSuite\KitchenSink\SecondTestCase::class => 2, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\SamwiseTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\FrodoTestCase::class => 1, + ImplicitDefaultTestSuite\KitchenSink\WhatAbout\BilboTestCase::class => 0, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\FoodAndBeverageTestCase::class => 4, + ImplicitDefaultTestSuite\KitchenSink\SecondBreakfast\BadTestCase::class => 0 + ]] + ]; + } + + #[DataProvider('processedTestCaseSummaryAssertionCountProvider')] + public function testProcessedTestCaseSummaryHasCorrectAssertionCount(string $path, array $expected) : void { + $results = $this->parser->parse($path); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getAssertionCount(); + } + + ksort($expected); + ksort($actual); + $this->assertEquals($expected, $actual); + } + + public function testProcessedAggregateSummaryHasDuration() { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + self::assertCount(1, $listener->actual); + $event = $listener->actual[0]; + $this->assertInstanceOf(ProcessingFinishedEvent::class, $event); + $this->assertGreaterThan(600, $event->payload()->getDuration()->asMilliseconds()); + } + + public function testTestSuiteSummaryHasDuration() : void { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_SUITE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + self::assertCount(1, $listener->actual); + $event = $listener->actual[0]; + $this->assertInstanceOf(TestSuiteFinishedEvent::class, $event); + $this->assertGreaterThan(600, $event->payload()->getDuration()->asMilliseconds()); + } + + public function testTestCaseSummaryHasDuration() : void { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_CASE_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $expected = [ + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\FirstTestCase::class => 99, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\SecondTestCase::class => 199, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class => 299 + ]; + + $actual = []; + foreach ($listener->actual as $event) { + $actual[$event->payload()->getTestCaseName()] = $event->payload()->getDuration()->asMilliseconds(); + } + + foreach ($expected as $testCase => $duration) { + $this->assertGreaterThanOrEqual($duration, $actual[$testCase]); + } + } + + public function testTestResultHasDuration() : void { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('MultipleTestsKnownDuration')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_PROCESSED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $key = $event->payload()->getTestCase()::class . '::' . $event->payload()->getTestMethod(); + $actual[$key] = $event->payload()->getDuration()->asMilliseconds(); + } + + $expected = [ + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\FirstTestCase::class . '::checkOne' => 99, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\SecondTestCase::class . '::checkOne' => 99, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\SecondTestCase::class . '::checkTwo' => 99, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class . '::checkOne' => 99, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class . '::checkTwo' => 99, + ImplicitDefaultTestSuite\MultipleTestsKnownDuration\ThirdTestCase::class . '::checkThree' => 99 + ]; + + foreach ($expected as $testCase => $duration) { + $this->assertGreaterThanOrEqual($duration, $actual[$testCase], $testCase . ' did not execute long enough'); + } + } + + public function testDisabledTestHasZeroDuration() : void { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('TestDisabled')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_DISABLED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + $actual = []; + foreach ($listener->actual as $event) { + $actual[] = $event->payload()->getDuration()->asMilliseconds(); + } + + $this->assertCount(1, $actual); + $this->assertSame(0.0, $actual[0]); + } + + public function testProcessedAggregateSummaryHasMemoryUsageInBytes() { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('SingleTest')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::PROCESSING_FINISHED, $listener); + $this->testSuiteRunner->runTestSuites($results)->await(); + + self::assertCount(1, $listener->actual); + $event = $listener->actual[0]; + $this->assertInstanceOf(ProcessingFinishedEvent::class, $event); + $this->assertGreaterThan(1000, $event->payload()->getMemoryUsageInBytes()); + } + + public function testTestCaseSummaryMockBridgeAssertionCount() { + $results = $this->parser->parse($this->implicitDefaultTestSuitePath('MockeryTestNoAssertion')); + $listener = $this->createEventRecordingListener(); + $this->emitter->register(Events::TEST_PROCESSED, $listener); + $this->testSuiteRunner->setMockBridgeClass(MockeryMockBridge::class); + $this->testSuiteRunner->runTestSuites($results)->await(); + + self::assertCount(1, $listener->actual); + $event = $listener->actual[0]; + $this->assertInstanceOf(TestProcessedEvent::class, $event); + $this->assertEquals(1, $event->payload()->getTestCase()->getAssertionCount()); + } +} diff --git a/tests/Unit/Framework/TestSuiteRunnerTest.php b/tests/Unit/Framework/TestSuiteRunnerTest.php new file mode 100644 index 0000000..7846500 --- /dev/null +++ b/tests/Unit/Framework/TestSuiteRunnerTest.php @@ -0,0 +1,694 @@ +buildTestSuiteRunner(); + $this->listener = new class implements Listener { + + private array $targets = []; + + public function handle(Event $event) : Future|CompositeFuture|null { + $this->targets[] = $event->payload(); + return null; + } + + public function getTargets() : array { + return $this->targets; + } + }; + $this->emitter->register(Events::TEST_PROCESSED, $this->listener); + } + + public function tearDown(): void { + ImplicitDefaultTestSuite\TestCaseHooksPriority\MyTestCase::clearInvokedAll(); + } + + private function parseAndRun(string $path) : void { + $results = $this->parser->parse($path); + $this->testSuiteRunner->runTestSuites($results)->await(); + } + + private function createRecordingListener() : Listener { + return new class() implements Listener{ + public array $actual = []; + + public function handle(Event $event) : Future|CompositeFuture|null { + $this->actual[] = $event->name(); + return null; + } + }; + } + + public function testImplicitDefaultTestSuiteSingleTestEmitsTestProcessedEventWithProperTestCaseInstance() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertInstanceOf(ImplicitDefaultTestSuite\SingleTest\MyTestCase::class, $this->listener->getTargets()[0]->getTestCase()); + } + + public function testImplicitDefaultTestSuiteSingleTestEmitsTestProcessedEventWithProperTestMethodName() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame('ensureSomethingHappens', $this->listener->getTargets()[0]->getTestMethod()); + } + + public function testImplicitDefaultTestSuiteSingleTestEmitsTestProcessedEventWithInvokedTestCase() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertTrue($this->listener->getTargets()[0]->getTestCase()->getTestInvoked()); + } + + public function testImplicitDefaultTestSuiteMultipleTestEmitsTestProcessedEventsEachTestUniqueTestCase() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('MultipleTest')); + $this->assertCount(3, $this->listener->getTargets()); + + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getInvokedMethods(), + $this->listener->getTargets()[1]->getTestCase()->getInvokedMethods(), + $this->listener->getTargets()[2]->getTestCase()->getInvokedMethods() + ]; + $expected = [ + [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class . '::ensureSomethingHappens'], + [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class . '::ensureSomethingHappensTwice'], + [ImplicitDefaultTestSuite\MultipleTest\MyTestCase::class . '::ensureSomethingHappensThreeTimes'] + ]; + + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testImplicitDefaultTestSuiteHasSingleBeforeAllHookInvokedBeforeTest() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleBeforeAllHook')); + + $this->assertCount(2, $this->listener->getTargets()); + + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getCombinedData(), + $this->listener->getTargets()[1]->getTestCase()->getCombinedData() + ]; + $expected = [ + ['beforeAll', 'ensureSomething'], + ['beforeAll', 'ensureSomethingTwice'] + ]; + + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testImplicitDefaultTestSuiteHasSingleBeforeEachHookInvokedBeforeTest() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleBeforeEachHook')); + + $this->assertCount(2, $this->listener->getTargets()); + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getData(), + $this->listener->getTargets()[1]->getTestCase()->getData() + ]; + $expected = [ + ['beforeEach', 'ensureSomething'], + ['beforeEach', 'ensureSomethingTwice'] + ]; + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testImplicitDefaultTestSuiteHasSingleAfterAllHookInvokedAfterTest() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleAfterAllHook')); + + $this->assertCount(2, $this->listener->getTargets()); + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getCombinedData(), + $this->listener->getTargets()[1]->getTestCase()->getCombinedData(), + ]; + // We expect the afterAll _first_ here because our test case combines the class data from AfterAll and the object + // data from the TestCase with class data first. + $expected = [ + ['afterAll', 'ensureSomething'], + ['afterAll', 'ensureSomethingTwice'] + ]; + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testImplicitDefaultTestSuiteHasSingleAfterEachHookInvokedAfterTest() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('HasSingleAfterEachHook')); + + $this->assertCount(2, $this->listener->getTargets()); + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getData(), + $this->listener->getTargets()[1]->getTestCase()->getData() + ]; + $expected = [ + ['ensureSomething', 'afterEach'], + ['ensureSomethingTwice', 'afterEach'] + ]; + + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testImplicitDefaultTestSuiteExceptionThrowingTestEmitsTestProcessedEventWithErrorStateAndCorrectException() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('ExceptionThrowingTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Errored, $this->listener->getTargets()[0]->getState()); + + $this->assertNotNull($this->listener->getTargets()[0]->getException()); + $expectedMsg = 'An unexpected exception of type "Exception" with code 0 and message "Test failure" was thrown from #[Test] ' . ImplicitDefaultTestSuite\ExceptionThrowingTest\MyTestCase::class . '::throwsException'; + $this->assertSame($expectedMsg, $this->listener->getTargets()[0]->getException()->getMessage()); + $this->assertInstanceOf(Exception::class, $this->listener->getTargets()[0]->getException()->getPrevious()); + } + + public function testImplicitDefaultTestSuiteExceptionThrowingTestWithAfterEachHookInvokedAfterTest() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('ExceptionThrowingTestWithAfterEachHook')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertTrue($this->listener->getTargets()[0]->getTestCase()->getAfterHookCalled()); + } + + public function testImplicitDefaultTestSuiteTestFailedExceptionThrowingTestEmitsTestProcessedEventDoesNotMarkExceptionAsUnexpected() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestFailedExceptionThrowingTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Failed, $this->listener->getTargets()[0]->getState()); + + $this->assertNotNull($this->listener->getTargets()[0]->getException()); + $this->assertSame('Something barfed', $this->listener->getTargets()[0]->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteHasDataProviderEmitsTestProcessedEventsForEachDataSetOnUniqueTestCase() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('HasDataProvider')); + $this->assertCount(3, $this->listener->getTargets()); + + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getCounter(), + $this->listener->getTargets()[1]->getTestCase()->getCounter(), + $this->listener->getTargets()[2]->getTestCase()->getCounter(), + ]; + $expected = [1, 1, 1]; + + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testExplicitTestSuiteDefaultExplicitTestSuite() { + $this->parseAndRun($this->explicitTestSuitePath('AnnotatedDefaultTestSuite')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(ExplicitTestSuite\AnnotatedDefaultTestSuite\MyTestSuite::class, $this->listener->getTargets()[0]->getTestCase()->testSuite::class); + } + + public function testImplicitDefaultTestSuiteMultipleBeforeAllHooksAllInvokedBeforeTest() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('MultipleBeforeAllHooks')); + $this->assertCount(2, $this->listener->getTargets()); + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->getState(), + $this->listener->getTargets()[1]->getTestCase()->getState(), + ]; + $expected = [ + ImplicitDefaultTestSuite\MultipleBeforeAllHooks\FirstTestCase::class, + ImplicitDefaultTestSuite\MultipleBeforeAllHooks\SecondTestCase::class + ]; + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testExplicitTestSuiteBeforeAllTestSuiteHookTestCaseHasAccessToSameTestSuite() : void { + $this->parseAndRun($this->explicitTestSuitePath('BeforeAllTestSuiteHook')); + $this->assertCount(3, $this->listener->getTargets()); + $actual = [ + $this->listener->getTargets()[0]->getTestCase()->testSuite, + $this->listener->getTargets()[1]->getTestCase()->testSuite, + $this->listener->getTargets()[2]->getTestCase()->testSuite, + ]; + $this->assertSame($actual[0], $actual[1]); + $this->assertSame($actual[1], $actual[2]); + } + + public function testTestPassedEventsEmittedAfterTestProcessedEvent() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_PROCESSED, Events::TEST_PASSED] as $event) { + $this->emitter->register($event, $listener); + } + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertSame([Events::TEST_PROCESSED, Events::TEST_PASSED], $listener->actual); + } + + public function testTestFailedEventsEmittedAfterTestProcessedEvent() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_PROCESSED, Events::TEST_FAILED] as $event) { + $this->emitter->register($event, $listener); + } + $this->parseAndRun($this->implicitDefaultTestSuitePath('FailedAssertion')); + + $this->assertSame([Events::TEST_PROCESSED, Events::TEST_FAILED], $listener->actual); + } + + public function testTestErrorEventEmittedAfterTestProcessedEvent() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_PROCESSED, Events::TEST_ERRORED] as $event) { + $this->emitter->register($event, $listener); + } + + $this->parseAndRun($this->implicitDefaultTestSuitePath('ExceptionThrowingTest')); + + $this->assertSame([Events::TEST_PROCESSED, Events::TEST_ERRORED], $listener->actual); + } + + public function testTestDisabledEventsEmittedAfterTestProcessedEvent() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_PROCESSED, Events::TEST_DISABLED] as $event) { + $this->emitter->register($event, $listener); + } + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTestDisabled')); + + $this->assertSame([Events::TEST_PROCESSED, Events::TEST_DISABLED], $listener->actual); + } + + public function testTestSuiteStartedAndFinishedEventsEmittedInOrder() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_SUITE_STARTED, Events::TEST_PROCESSED, Events::TEST_SUITE_FINISHED] as $event) { + $this->emitter->register($event, $listener); + } + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertSame([Events::TEST_SUITE_STARTED, Events::TEST_PROCESSED, Events::TEST_SUITE_FINISHED], $listener->actual); + } + + public function testTestCaseProcessingEventEmitted() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_CASE_STARTED, Events::TEST_PROCESSED, Events::TEST_CASE_FINISHED] as $event) { + $this->emitter->register($event, $listener); + } + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertSame([Events::TEST_CASE_STARTED, Events::TEST_PROCESSED, Events::TEST_CASE_FINISHED], $listener->actual); + } + + public function testTestMethodIsNotInvokedWhenDisabled() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabled')); + + $this->assertCount(2, $this->listener->getTargets()); + $actual = [ + $this->listener->getTargets()[0]->getState(), + $this->listener->getTargets()[1]->getState() + ]; + $expected = [TestState::Passed, TestState::Disabled]; + $this->assertEqualsCanonicalizing($expected, $actual); + } + + public function testTestMethodIsNotInvokedWhenTestCaseDisabled() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseDisabled')); + + $this->assertCount(3, $this->listener->getTargets()); + $actualState = [ + $this->listener->getTargets()[0]->getState(), + $this->listener->getTargets()[1]->getState(), + $this->listener->getTargets()[2]->getState(), + ]; + $expectedState = [TestState::Disabled, TestState::Disabled, TestState::Disabled]; + $this->assertEqualsCanonicalizing($expectedState, $actualState); + + $actualData = [ + $this->listener->getTargets()[0]->getTestCase()->getData(), + $this->listener->getTargets()[1]->getTestCase()->getData(), + $this->listener->getTargets()[2]->getTestCase()->getData(), + ]; + $expectedData = [[], [], []]; + $this->assertEqualsCanonicalizing($expectedData, $actualData); + } + + public function testTestResultWhenTestDisabled() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabled')); + $disabledTestResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class, 'skippedTest'); + + $this->assertSame(TestState::Disabled, $disabledTestResult->getState()); + $this->assertInstanceOf(TestDisabledException::class, $disabledTestResult->getException()); + $expected = sprintf( + '%s::%s has been marked disabled via annotation', + ImplicitDefaultTestSuite\TestDisabled\MyTestCase::class, + 'skippedTest' + ); + $this->assertSame($expected, $disabledTestResult->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteHandleNonPhpFiles() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('HandleNonPhpFiles')); + + $this->assertCount(1, $this->listener->getTargets()); + } + + public function testImplicitDefaultTestSuiteTestDisabledHookNotInvoked() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabledHookNotInvoked')); + + $disabledTestResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledHookNotInvoked\MyTestCase::class, 'disabledTest'); + + $this->assertSame(TestState::Disabled, $disabledTestResult->getState()); + $this->assertSame([], $disabledTestResult->getTestCase()->getState()); + + $enabledTestResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledHookNotInvoked\MyTestCase::class, 'enabledTest'); + + $this->assertSame(TestState::Passed, $enabledTestResult->getState()); + $this->assertSame(['before', 'enabled', 'after'], $enabledTestResult->getTestCase()->getState()); + } + + public function testImplicitDefaultTestSuiteTestCaseDisabledHookNotInvoked() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseDisabledHookNotInvoked')); + + $testOneResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestCaseDisabledHookNotInvoked\MyTestCase::class, 'testOne'); + + $this->assertSame(TestState::Disabled, $testOneResult->getState()); + $this->assertSame([], $testOneResult->getTestCase()->getState()); + + $testTwoResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestCaseDisabledHookNotInvoked\MyTestCase::class, 'testTwo'); + + $this->assertSame(TestState::Disabled, $testTwoResult->getState()); + $this->assertSame([], $testTwoResult->getTestCase()->getState()); + } + + public function testExplicitTestSuiteTestSuiteDisabledHookNotInvoked() { + $this->parseAndRun($this->explicitTestSuitePath('TestSuiteDisabledHookNotInvoked')); + + $testSomethingResult = $this->fetchTestResultForTest(ExplicitTestSuite\TestSuiteDisabledHookNotInvoked\MyTestCase::class, 'testSomething'); + + $this->assertSame(TestState::Disabled, $testSomethingResult->getState()); + $this->assertSame([], $testSomethingResult->getTestCase()->testSuite->getState()); + } + + public function testImplicitDefaultTestSuiteTestDisabledCustomMessage() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabledCustomMessage')); + + $testOneResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledCustomMessage\MyTestCase::class, 'testOne'); + + $this->assertSame(TestState::Disabled, $testOneResult->getState()); + $this->assertInstanceOf(TestDisabledException::class, $testOneResult->getException()); + $this->assertSame('Not sure what we should do here yet', $testOneResult->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteTestCaseDisabledCustomMessage() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseDisabledCustomMessage')); + + $testOneResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestCaseDisabledCustomMessage\MyTestCase::class, 'testOne'); + + $this->assertSame(TestState::Disabled, $testOneResult->getState()); + $this->assertInstanceOf(TestDisabledException::class, $testOneResult->getException()); + $this->assertSame('The TestCase is disabled', $testOneResult->getException()->getMessage()); + } + + public function testExplicitTestSuiteTestSuiteDisabledCustomMessage() { + $this->parseAndRun($this->explicitTestSuitePath('TestSuiteDisabledCustomMessage')); + + $testOneResult = $this->fetchTestResultForTest(ExplicitTestSuite\TestSuiteDisabledCustomMessage\MyTestCase::class, 'testOne'); + + $this->assertSame(TestState::Disabled, $testOneResult->getState()); + $this->assertInstanceOf(TestDisabledException::class, $testOneResult->getException()); + $this->assertSame('The AttachToTestSuite is disabled', $testOneResult->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteTestEventsHaveCorrectState() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestDisabledEvents')); + + $failingResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledEvents\MyTestCase::class, 'testFailingFloatEquals'); + + $this->assertSame(TestState::Failed, $failingResult->getState()); + + $passingResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledEvents\MyTestCase::class, 'testIsTrue'); + + $this->assertSame(TestState::Passed, $passingResult->getState()); + + $disabledResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestDisabledEvents\MyTestCase::class, 'testIsDisabled'); + + $this->assertSame(TestState::Disabled, $disabledResult->getState()); + } + + public function testImplicitDefaultTestSuiteTestHasOutput() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestHasOutput')); + + $failingResult = $this->fetchTestResultForTest(ImplicitDefaultTestSuite\TestHasOutput\MyTestCase::class, 'testProducesOutput'); + + $this->assertInstanceOf(TestOutputException::class, $failingResult->getException()); + $this->assertSame("Test had unexpected output:\n\n\"testProducesOutput\"", $failingResult->getException()->getMessage()); + } + + public function testRandomizerIsUtilized() { + $dir = $this->implicitDefaultTestSuitePath('MultipleTest'); + $results = $this->parser->parse($dir); + $testSuites = $results->getTestSuiteModels(); + $randomizer = $this->getMockBuilder(Randomizer::class)->getMock(); + $mockBridgeFactory = $this->createMock(MockBridgeFactory::class); + + $testSuiteRunner = new TestSuiteRunner( + $this->emitter, + $randomizer, + $mockBridgeFactory + ); + + $this->assertCount(1, $testSuites); + $this->assertNotEmpty($testSuites[0]->getTestCaseModels()); + $matcher = $this->exactly(3); + $randomizer->expects($matcher) + ->method('randomize') + ->withAnyParameters() + ->willReturnArgument(0); + + $testSuiteRunner->runTestSuites($results)->await(); + } + + public function testImplicitDefaultTestSuiteTestExpectsExceptionOnly() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionOnly')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Passed, $this->listener->getTargets()[0]->getState()); + } + + public function testImplicitDefaultTestSuiteTestExpectsExceptionWrongType() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionWrongType')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertInstanceOf(TestFailedException::class, $this->listener->getTargets()[0]->getException()); + $expected = sprintf( + 'Failed asserting that thrown exception %s extends expected %s', + InvalidStateException::class, + InvalidArgumentException::class + ); + $this->assertSame($expected, $this->listener->getTargets()[0]->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteTestExpectsExceptionMessage() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionMessage')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Passed, $this->listener->getTargets()[0]->getState()); + } + + public function testImplicitDefaultTestSuiteTestExpectsExceptionWrongMessage() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionWrongMessage')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertInstanceOf(TestFailedException::class, $this->listener->getTargets()[0]->getException()); + $expected = sprintf( + 'Failed asserting that thrown exception message "%s" equals expected "%s"', + 'This is NOT the message that I expect', + 'This is the message that I expect' + ); + $this->assertSame($expected, $this->listener->getTargets()[0]->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteTestExpectsExceptionDoesNotThrow() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsExceptionDoesNotThrow')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertInstanceOf(TestFailedException::class, $this->listener->getTargets()[0]->getException()); + $expected = sprintf( + 'Failed asserting that an exception of type %s is thrown', + InvalidArgumentException::class + ); + $this->assertSame($expected, $this->listener->getTargets()[0]->getException()->getMessage()); + } + + public function testTestProcessingEventsEmittedInOrder() { + $listener = $this->createRecordingListener(); + foreach ([Events::TEST_PROCESSED, Events::PROCESSING_FINISHED, Events::PROCESSING_STARTED] as $event) { + $this->emitter->register($event, $listener); + } + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleTest')); + + $this->assertSame([Events::PROCESSING_STARTED, Events::TEST_PROCESSED, Events::PROCESSING_FINISHED], $listener->actual); + } + + public function testImplicitDefaultTestSuiteTestExpectsNoAssertionsHasPassedState() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsNoAssertions')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Passed, $this->listener->getTargets()[0]->getState()); + } + + public function testImplicitDefaultTestSuiteExpectsNoAssertionsAssertMade() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestExpectsNoAssertionsAssertMade')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Failed, $this->listener->getTargets()[0]->getState()); + $this->assertSame('Expected ' . ImplicitDefaultTestSuite\TestExpectsNoAssertionsAssertMade\MyTestCase::class . '::testNoAssertionAssertionMade to make 0 assertions but made 2', $this->listener->getTargets()[0]->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteTestHasTimeoutExceedsValueIsFailedTest() : void { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestHasTimeout')); + + $this->assertCount(1, $this->listener->getTargets()); + $this->assertSame(TestState::Failed, $this->listener->getTargets()[0]->getState()); + $msg = sprintf( + 'Expected %s::timeOutTest to complete within 100ms', + ImplicitDefaultTestSuite\TestHasTimeout\MyTestCase::class + ); + $this->assertSame($msg, $this->listener->getTargets()[0]->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteSingleMockTestWithBridgeSet() : void { + $this->testSuiteRunner->setMockBridgeClass(MockBridgeStub::class); + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleMockTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $testResult = $this->listener->getTargets()[0]; + /** @var ImplicitDefaultTestSuite\SingleMockTest\MyTestCase $testCase */ + $testCase = $testResult->getTestCase(); + + $this->assertEquals(TestState::Passed, $testResult->getState()); + $this->assertNotNull($testCase->getCreatedMock()); + $createdMock = $testCase->getCreatedMock()->class; + + $this->assertSame(Configuration::class, $createdMock); + } + + public function testImplicitDefaultTestSuiteSingleMockTestWithBridgeSetInitializeAndFinalizeCalled() : void { + $this->testSuiteRunner->setMockBridgeClass(MockBridgeStub::class); + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleMockTest')); + + $this->assertCount(1, $this->listener->getTargets()); + + $mockBridge = $this->listener->getTargets()[0]->getTestCase()->mocks(); + $expected = ['initialize', 'createMock ' . Configuration::class, 'finalize']; + $actual = $mockBridge->getCalls(); + + $this->assertSame($expected, $actual); + } + + public function testImplicitDefaultTestSuiteSingleMockTestWithFailingBridgeHasFailedTest() : void { + $this->buildTestSuiteRunner(); + $this->emitter->register(Events::TEST_PROCESSED, $this->listener); + $this->testSuiteRunner->setMockBridgeClass(FailingMockBridgeStub::class); + $this->parseAndRun($this->implicitDefaultTestSuitePath('SingleMockTest')); + + $this->assertCount(1, $this->listener->getTargets()); + $testResult = $this->listener->getTargets()[0]; + + $this->assertEquals(TestState::Failed, $testResult->getState()); + $this->assertInstanceOf(MockFailureException::class, $testResult->getException()); + $this->assertSame('Thrown from the FailingMockBridgeStub', $testResult->getException()->getMessage()); + } + + public function testImplicitDefaultTestSuiteTestCasePriorityEachHooks() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseHooksPriority')); + + $this->assertCount(1, $this->listener->getTargets()); + $testResult = $this->listener->getTargets()[0]; + + $this->assertEquals(TestState::Passed, $testResult->getState()); + + $expected = [ + 'beforeEachOne', + 'beforeEachTwo', + 'beforeEachThree', + 'afterEachOne', + 'afterEachTwo', + 'afterEachThree', + ]; + $this->assertEquals($expected, $testResult->getTestCase()->getInvokedEach()); + } + + public function testImplicitDefaultTestSuiteTestCasePriorityAllHooks() { + $this->parseAndRun($this->implicitDefaultTestSuitePath('TestCaseHooksPriority')); + + $this->assertCount(1, $this->listener->getTargets()); + $testResult = $this->listener->getTargets()[0]; + + $this->assertEquals(TestState::Passed, $testResult->getState()); + + $expected = [ + 'beforeAllOne', + 'beforeAllTwo', + 'beforeAllThree', + 'afterAllOne', + 'afterAllTwo', + 'afterAllThree', + ]; + $this->assertEquals($expected, $testResult->getTestCase()->getInvokedAll()); + } + + public function testExplicitTestSuiteTestSuiteHookPriority() { + $this->parseAndRun($this->explicitTestSuitePath('TestSuiteHookPriority')); + + $this->assertCount(1, $this->listener->getTargets()); + $testResult = $this->listener->getTargets()[0]; + + $this->assertEquals(TestState::Passed, $testResult->getState()); + + $expected = [ + 'beforeAllOne', + 'beforeAllTwo', + 'beforeAllThree', + 'beforeEachOne', + 'beforeEachTwo', + 'beforeEachThree', + 'beforeEachTestOne', + 'beforeEachTestTwo', + 'beforeEachTestThree', + 'afterEachTestOne', + 'afterEachTestTwo', + 'afterEachTestThree', + 'afterEachOne', + 'afterEachTwo', + 'afterEachThree', + 'afterAllOne', + 'afterAllTwo', + 'afterAllThree', + ]; + $this->assertEquals($expected, $testResult->getTestCase()->testSuite->getInvokedHooks()); + } + + private function fetchTestResultForTest(string $testClass, string $method) : TestResult { + foreach ($this->listener->getTargets() as $testResult) { + if ($testResult->getTestCase()::class === $testClass && $testResult->getTestMethod() === $method) { + return $testResult; + } + } + $this->fail('Expected $this->listener->getTargets() to have a TestCase and method matching ' . $testClass . '::' . $method); + } +} \ No newline at end of file diff --git a/tests/Unit/Framework/UsesAcmeSrc.php b/tests/Unit/Framework/UsesAcmeSrc.php new file mode 100644 index 0000000..4afe8d2 --- /dev/null +++ b/tests/Unit/Framework/UsesAcmeSrc.php @@ -0,0 +1,23 @@ +