diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feba0f6..055d1aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,9 @@ jobs: with: dependency-versions: ${{ matrix.dependencies }} - name: PHPUnit - run: vendor/bin/phpunit --coverage-clover=coverage.clover + run: php blackbox.php + env: + ENABLE_COVERAGE: 'true' - uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 7330583..987e2a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ composer.lock vendor -.phpunit.result.cache -.phpunit.cache diff --git a/blackbox.php b/blackbox.php new file mode 100644 index 0000000..5c3ddce --- /dev/null +++ b/blackbox.php @@ -0,0 +1,28 @@ +disableMemoryLimit() + ->when( + \getenv('ENABLE_COVERAGE') !== false, + static fn(Application $app) => $app + ->codeCoverage( + CodeCoverage::of( + __DIR__.'/src/', + __DIR__.'/tests/', + ) + ->dumpTo('coverage.clover') + ->enableWhen(true), + ) + ->scenariiPerProof(1), + ) + ->tryToProve(Load::directory(__DIR__.'/tests/')) + ->exit(); diff --git a/composer.json b/composer.json index da4edd9..6edc564 100644 --- a/composer.json +++ b/composer.json @@ -31,9 +31,8 @@ } }, "require-dev": { - "phpunit/phpunit": "~10.2", "innmind/static-analysis": "~1.2.1", - "innmind/black-box": "~5.5", + "innmind/black-box": "^6.4.1", "innmind/coding-standard": "~2.0" } } diff --git a/graph.dot b/graph.dot index 318536a..af54f6a 100644 --- a/graph.dot +++ b/graph.dot @@ -1,49 +1,42 @@ digraph stack_trace { subgraph cluster_throwables { label="Thrown" - exception_0000000000000afb0000000000000000 -> exception_00000000000005a80000000000000000 [label="Caused by"]; - exception_00000000000005a80000000000000000 [shape="doubleoctagon", style="filled", fillcolor="#ff0000", label="TypeError[42](foo)", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; - exception_0000000000000afb0000000000000000 [shape="doubleoctagon", style="filled", fillcolor="#ff0000", label="Innmind\\StackTrace\\Exception\\DomainException[0]()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/RenderTest.php"]; + exception_00000000000000880000000000000000 -> exception_00000000000005cb0000000000000000 [label="Caused by"]; + exception_00000000000005cb0000000000000000 [shape="doubleoctagon", style="filled", fillcolor="#ff0000", label="TypeError[42](foo)", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; + exception_00000000000000880000000000000000 [shape="doubleoctagon", style="filled", fillcolor="#ff0000", label="Innmind\\StackTrace\\Exception\\DomainException[0]()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/RenderTest.php"]; } subgraph cluster_call_frames { label="Stack Trace" - call_frame_4f9ea46a7375c109da69901c633013a9 -> call_frame_53aaccb6492409f5e3f3865fc706111e [label="tests/CallFramesTest.php:70", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; + call_frame_4f9ea46a7375c109da69901c633013a9 -> call_frame_0c8ca819225bbabc6f0533ccef07666b [label="tests/CallFramesTest.php:70", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_78899d4635295534cfc817b37dee2513 -> call_frame_4f9ea46a7375c109da69901c633013a9; call_frame_7945ef788bc897e87fc2d31edd4537b5 -> call_frame_78899d4635295534cfc817b37dee2513 [label="tests/CallFramesTest.php:82", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_9914fdd0b965fa974e826064877ece14 -> call_frame_7945ef788bc897e87fc2d31edd4537b5 [label="tests/CallFramesTest.php:62", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_a3479fc68cbbda8c8966caf2abecb4ec -> call_frame_9914fdd0b965fa974e826064877ece14; call_frame_4bebae301b668efb03e7bc24f79606a6 -> call_frame_a3479fc68cbbda8c8966caf2abecb4ec [label="tests/RenderTest.php:24", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/RenderTest.php"]; - call_frame_47c0407195947f117d1878ddc407c0a3 -> call_frame_4bebae301b668efb03e7bc24f79606a6 [label="vendor/phpunit/phpunit/src/Framework/TestCase.php:1545", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestCase.php"]; - call_frame_07f591f613086fa0eafe956f80ef31fa -> call_frame_47c0407195947f117d1878ddc407c0a3 [label="vendor/phpunit/phpunit/src/Framework/TestCase.php:1151", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestCase.php"]; - call_frame_5627b6f9e8560c938320b94b612d2fc0 -> call_frame_07f591f613086fa0eafe956f80ef31fa [label="vendor/phpunit/phpunit/src/Framework/TestResult.php:726", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestResult.php"]; - call_frame_9e85687edeee0a8f8bd7f473ec92cc89 -> call_frame_5627b6f9e8560c938320b94b612d2fc0 [label="vendor/phpunit/phpunit/src/Framework/TestCase.php:903", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestCase.php"]; - call_frame_862259868e8b30c44157d4fa168fc13a -> call_frame_9e85687edeee0a8f8bd7f473ec92cc89 [label="vendor/phpunit/phpunit/src/Framework/TestSuite.php:677", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestSuite.php"]; - call_frame_cc4026df087e27e93e934267183b41f4 -> call_frame_862259868e8b30c44157d4fa168fc13a [label="vendor/phpunit/phpunit/src/Framework/TestSuite.php:677", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestSuite.php"]; - call_frame_cc4026df087e27e93e934267183b41f4 -> call_frame_cc4026df087e27e93e934267183b41f4 [label="vendor/phpunit/phpunit/src/Framework/TestSuite.php:677", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestSuite.php"]; - call_frame_c8d6907ef39a015179586fa3b8c89d1a -> call_frame_cc4026df087e27e93e934267183b41f4 [label="vendor/phpunit/phpunit/src/TextUI/TestRunner.php:673", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/TextUI/TestRunner.php"]; - call_frame_95bacb9103a97886bc59bc9084f8765c -> call_frame_c8d6907ef39a015179586fa3b8c89d1a [label="vendor/phpunit/phpunit/src/TextUI/Command.php:143", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/TextUI/Command.php"]; - call_frame_ea22ce8c2ce2b0f720bfdcc70fb908c5 -> call_frame_95bacb9103a97886bc59bc9084f8765c [label="vendor/phpunit/phpunit/src/TextUI/Command.php:96", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/TextUI/Command.php"]; - call_frame_06e435cf2f8ff07c446385801e950ee7 -> call_frame_ea22ce8c2ce2b0f720bfdcc70fb908c5 [label="vendor/phpunit/phpunit/phpunit:98", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/phpunit"]; - call_frame_d8b76d2929d9dd7cd5896c117a761475 -> call_frame_06e435cf2f8ff07c446385801e950ee7 [label="vendor/bin/phpunit:120", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/bin/phpunit"]; - call_frame_53aaccb6492409f5e3f3865fc706111e [shape="box", style="filled", fillcolor="#ffa500", label="class@anonymous/Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php:74$1e->__invoke()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; + call_frame_977883ee6b9d8d61d49a8923590c9d3d -> call_frame_4bebae301b668efb03e7bc24f79606a6 [label="vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php:86", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php"]; + call_frame_4b21509278f2fb535c4686987deaeec0 -> call_frame_977883ee6b9d8d61d49a8923590c9d3d [label="vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php:45", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php"]; + call_frame_11bcadcf71c13b34cb8495c5dea2fc27 -> call_frame_4b21509278f2fb535c4686987deaeec0 [label="vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php:84", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php"]; + call_frame_1c2e2b4e79d46af214de1b3ba4c61dbf -> call_frame_11bcadcf71c13b34cb8495c5dea2fc27 [label="vendor/innmind/black-box/src/PHPUnit/Proof/Scenario.php:42", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Proof/Scenario.php"]; + call_frame_a111af271f7cbec84d773aa454fa4563 -> call_frame_1c2e2b4e79d46af214de1b3ba4c61dbf [label="vendor/innmind/black-box/src/Runner/Runner/WithShrinking.php:32", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/Runner/Runner/WithShrinking.php"]; + call_frame_a61921d89631465573bff6d224342807 -> call_frame_a111af271f7cbec84d773aa454fa4563 [label="vendor/innmind/black-box/src/Runner/Runner.php:96", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/Runner/Runner.php"]; + call_frame_798ce749ff53e1197fa23634b0e7aeb8 -> call_frame_a61921d89631465573bff6d224342807 [label="vendor/innmind/black-box/src/Application.php:416", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/Application.php"]; + call_frame_20f3ae3c3ed2af761933fe1537c4992b -> call_frame_798ce749ff53e1197fa23634b0e7aeb8 [label="blackbox.php:27", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/blackbox.php"]; + call_frame_0c8ca819225bbabc6f0533ccef07666b [shape="box", style="filled", fillcolor="#ffa500", label="class@anonymous/Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php:74$8->__invoke()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_4f9ea46a7375c109da69901c633013a9 [shape="box", style="filled", fillcolor="#ffa500", label="Tests\\Innmind\\StackTrace\\{closure}()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_78899d4635295534cfc817b37dee2513 [shape="box", style="filled", fillcolor="#ffa500", label="Tests\\Innmind\\StackTrace\\foo()"]; call_frame_7945ef788bc897e87fc2d31edd4537b5 [shape="box", style="filled", fillcolor="#ffa500", label="array_walk()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_9914fdd0b965fa974e826064877ece14 [shape="box", style="filled", fillcolor="#ffa500", label="Tests\\Innmind\\StackTrace\\CallFramesTest::staticCall()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; call_frame_a3479fc68cbbda8c8966caf2abecb4ec [shape="box", style="filled", fillcolor="#ffa500", label="Tests\\Innmind\\StackTrace\\CallFramesTest::refl()"]; call_frame_4bebae301b668efb03e7bc24f79606a6 [shape="box", style="filled", fillcolor="#ffa500", label="ReflectionMethod->invoke()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/RenderTest.php"]; - call_frame_47c0407195947f117d1878ddc407c0a3 [shape="box", style="filled", fillcolor="#ffa500", label="Tests\\Innmind\\StackTrace\\RenderTest->testInvokation()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestCase.php"]; - call_frame_07f591f613086fa0eafe956f80ef31fa [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\Framework\\TestCase->runTest()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestCase.php"]; - call_frame_5627b6f9e8560c938320b94b612d2fc0 [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\Framework\\TestCase->runBare()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestResult.php"]; - call_frame_9e85687edeee0a8f8bd7f473ec92cc89 [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\Framework\\TestResult->run()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestCase.php"]; - call_frame_862259868e8b30c44157d4fa168fc13a [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\Framework\\TestCase->run()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestSuite.php"]; - call_frame_cc4026df087e27e93e934267183b41f4 [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\Framework\\TestSuite->run()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/Framework/TestSuite.php"]; - call_frame_c8d6907ef39a015179586fa3b8c89d1a [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\Framework\\TestSuite->run()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/TextUI/TestRunner.php"]; - call_frame_95bacb9103a97886bc59bc9084f8765c [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\TextUI\\TestRunner->run()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/TextUI/Command.php"]; - call_frame_ea22ce8c2ce2b0f720bfdcc70fb908c5 [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\TextUI\\Command->run()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/src/TextUI/Command.php"]; - call_frame_06e435cf2f8ff07c446385801e950ee7 [shape="box", style="filled", fillcolor="#ffa500", label="PHPUnit\\TextUI\\Command::main()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/phpunit/phpunit/phpunit"]; - call_frame_d8b76d2929d9dd7cd5896c117a761475 [shape="box", style="filled", fillcolor="#ffa500", label="include()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/bin/phpunit"]; + call_frame_977883ee6b9d8d61d49a8923590c9d3d [shape="box", style="filled", fillcolor="#ffa500", label="Tests\\Innmind\\StackTrace\\RenderTest->testInvokation()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php"]; + call_frame_4b21509278f2fb535c4686987deaeec0 [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\PHPUnit\\Framework\\TestCase->Innmind\\BlackBox\\PHPUnit\\Framework\\{closure}()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php"]; + call_frame_11bcadcf71c13b34cb8495c5dea2fc27 [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\PHPUnit\\Framework\\TestCase->executeClosure()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Framework/TestCase.php"]; + call_frame_1c2e2b4e79d46af214de1b3ba4c61dbf [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\PHPUnit\\Framework\\TestCase->executeTest()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/PHPUnit/Proof/Scenario.php"]; + call_frame_a111af271f7cbec84d773aa454fa4563 [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\PHPUnit\\Proof\\Scenario->__invoke()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/Runner/Runner/WithShrinking.php"]; + call_frame_a61921d89631465573bff6d224342807 [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\Runner\\Runner\\WithShrinking->__invoke()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/Runner/Runner.php"]; + call_frame_798ce749ff53e1197fa23634b0e7aeb8 [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\Runner\\Runner->__invoke()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/vendor/innmind/black-box/src/Application.php"]; + call_frame_20f3ae3c3ed2af761933fe1537c4992b [shape="box", style="filled", fillcolor="#ffa500", label="Innmind\\BlackBox\\Application->tryToProve()", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/blackbox.php"]; } - exception_00000000000005a80000000000000000 -> call_frame_53aaccb6492409f5e3f3865fc706111e [label="tests/CallFramesTest.php:77", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; - exception_0000000000000afb0000000000000000 -> call_frame_47c0407195947f117d1878ddc407c0a3 [label="tests/RenderTest.php:29", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/RenderTest.php"]; + exception_00000000000005cb0000000000000000 -> call_frame_0c8ca819225bbabc6f0533ccef07666b [label="tests/CallFramesTest.php:77", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/CallFramesTest.php"]; + exception_00000000000000880000000000000000 -> call_frame_977883ee6b9d8d61d49a8923590c9d3d [label="tests/RenderTest.php:29", URL="file:///Users/baptouuuu/Sites/innmind/stack-trace/tests/RenderTest.php"]; } \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 076d27b..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - ./tests - - - - - . - - - ./tests - ./vendor - ./render.php - - - diff --git a/tests/CallFrame/FunctionCallTest.php b/tests/CallFrame/FunctionCallTest.php index c4a1541..efe102a 100644 --- a/tests/CallFrame/FunctionCallTest.php +++ b/tests/CallFrame/FunctionCallTest.php @@ -12,7 +12,7 @@ }; use Innmind\Url\Url; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class FunctionCallTest extends TestCase { diff --git a/tests/CallFrame/InternalFunctionCallTest.php b/tests/CallFrame/InternalFunctionCallTest.php index 43d6d23..da1eab4 100644 --- a/tests/CallFrame/InternalFunctionCallTest.php +++ b/tests/CallFrame/InternalFunctionCallTest.php @@ -9,7 +9,7 @@ FunctionName, }; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class InternalFunctionCallTest extends TestCase { diff --git a/tests/CallFrame/InternalMethodCallTest.php b/tests/CallFrame/InternalMethodCallTest.php index ea2bd28..9ce5de2 100644 --- a/tests/CallFrame/InternalMethodCallTest.php +++ b/tests/CallFrame/InternalMethodCallTest.php @@ -10,7 +10,7 @@ Method, }; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class InternalMethodCallTest extends TestCase { diff --git a/tests/CallFrame/InternalStaticMethodCallTest.php b/tests/CallFrame/InternalStaticMethodCallTest.php index cd9697b..4d02156 100644 --- a/tests/CallFrame/InternalStaticMethodCallTest.php +++ b/tests/CallFrame/InternalStaticMethodCallTest.php @@ -10,7 +10,7 @@ Method, }; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class InternalStaticMethodCallTest extends TestCase { diff --git a/tests/CallFrame/MethodCallTest.php b/tests/CallFrame/MethodCallTest.php index 463e14c..173174e 100644 --- a/tests/CallFrame/MethodCallTest.php +++ b/tests/CallFrame/MethodCallTest.php @@ -13,7 +13,7 @@ }; use Innmind\Url\Url; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class MethodCallTest extends TestCase { diff --git a/tests/CallFrame/StaticMethodCallTest.php b/tests/CallFrame/StaticMethodCallTest.php index 23fed20..e324be1 100644 --- a/tests/CallFrame/StaticMethodCallTest.php +++ b/tests/CallFrame/StaticMethodCallTest.php @@ -13,7 +13,7 @@ }; use Innmind\Url\Url; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class StaticMethodCallTest extends TestCase { diff --git a/tests/CallFramesTest.php b/tests/CallFramesTest.php index 7052811..dd59c79 100644 --- a/tests/CallFramesTest.php +++ b/tests/CallFramesTest.php @@ -8,7 +8,7 @@ CallFrame, }; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class CallFramesTest extends TestCase { @@ -22,7 +22,7 @@ public function testOf() } $this->assertInstanceOf(Sequence::class, $frames); - $this->assertCount(18, $frames); + $this->assertCount(15, $frames); $this->assertInstanceOf(CallFrame\MethodCall::class, $frames->get(0)->match( static fn($frame) => $frame, static fn() => null, diff --git a/tests/ClassNameTest.php b/tests/ClassNameTest.php index 238090f..dd3e8a1 100644 --- a/tests/ClassNameTest.php +++ b/tests/ClassNameTest.php @@ -7,9 +7,9 @@ ClassName, Exception\DomainException, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ PHPUnit\BlackBox, + PHPUnit\Framework\TestCase, Set, }; @@ -17,11 +17,11 @@ class ClassNameTest extends TestCase { use BlackBox; - public function testInterface() + public function testInterface(): BlackBox\Proof { - $this - ->forAll(Set\Strings::any()->filter(static fn($string) => $string !== '')) - ->then(function(string $string): void { + return $this + ->forAll(Set::strings()->filter(static fn($string) => $string !== '')) + ->prove(function(string $string): void { $this->assertSame($string, ClassName::of($string)->toString()); }); } diff --git a/tests/FunctionNameTest.php b/tests/FunctionNameTest.php index b7c1d96..49c135c 100644 --- a/tests/FunctionNameTest.php +++ b/tests/FunctionNameTest.php @@ -7,9 +7,9 @@ FunctionName, Exception\DomainException, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ PHPUnit\BlackBox, + PHPUnit\Framework\TestCase, Set, }; @@ -17,11 +17,11 @@ class FunctionNameTest extends TestCase { use BlackBox; - public function testInterface() + public function testInterface(): BlackBox\Proof { - $this - ->forAll(Set\Strings::any()->filter(static fn($string) => $string !== '')) - ->then(function(string $string): void { + return $this + ->forAll(Set::strings()->filter(static fn($string) => $string !== '')) + ->prove(function(string $string): void { $this->assertSame($string, FunctionName::of($string)->toString()); }); } diff --git a/tests/LineTest.php b/tests/LineTest.php index 8bbfef7..d97ddf2 100644 --- a/tests/LineTest.php +++ b/tests/LineTest.php @@ -7,9 +7,9 @@ Line, Exception\DomainException, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ PHPUnit\BlackBox, + PHPUnit\Framework\TestCase, Set, }; @@ -17,11 +17,11 @@ class LineTest extends TestCase { use BlackBox; - public function testInterface() + public function testInterface(): BlackBox\Proof { - $this - ->forAll(Set\Integers::above(0)) - ->then(function(int $int): void { + return $this + ->forAll(Set::integers()->above(0)) + ->prove(function(int $int): void { $this->assertSame($int, Line::of($int)->toInt()); $this->assertSame((string) $int, Line::of($int)->toString()); }); @@ -34,11 +34,11 @@ public function testThrowWhenZero() Line::of(0); } - public function testThrowWhenNegativeValue() + public function testThrowWhenNegativeValue(): BlackBox\Proof { - $this - ->forAll(Set\Integers::below(1)) - ->then(function(int $int): void { + return $this + ->forAll(Set::integers()->below(1)) + ->prove(function(int $int): void { $this->expectException(DomainException::class); Line::of($int); diff --git a/tests/Link/SublimeHandlerTest.php b/tests/Link/SublimeHandlerTest.php index 74b2f39..0a6db10 100644 --- a/tests/Link/SublimeHandlerTest.php +++ b/tests/Link/SublimeHandlerTest.php @@ -9,7 +9,7 @@ Line, }; use Innmind\Url\Url; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class SublimeHandlerTest extends TestCase { diff --git a/tests/Link/ToFileTest.php b/tests/Link/ToFileTest.php index 693c505..7ce7b64 100644 --- a/tests/Link/ToFileTest.php +++ b/tests/Link/ToFileTest.php @@ -9,7 +9,7 @@ Line, }; use Innmind\Url\Url; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class ToFileTest extends TestCase { diff --git a/tests/MethodTest.php b/tests/MethodTest.php index 329ce97..9f3a546 100644 --- a/tests/MethodTest.php +++ b/tests/MethodTest.php @@ -7,9 +7,9 @@ Method, Exception\DomainException, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ PHPUnit\BlackBox, + PHPUnit\Framework\TestCase, Set, }; @@ -17,11 +17,11 @@ class MethodTest extends TestCase { use BlackBox; - public function testInterface() + public function testInterface(): BlackBox\Proof { - $this - ->forAll(Set\Strings::any()->filter(static fn($string) => $string !== '')) - ->then(function(string $string): void { + return $this + ->forAll(Set::strings()->filter(static fn($string) => $string !== '')) + ->prove(function(string $string): void { $this->assertSame($string, Method::of($string)->toString()); }); } diff --git a/tests/RenderTest.php b/tests/RenderTest.php index 7010d22..974dbff 100644 --- a/tests/RenderTest.php +++ b/tests/RenderTest.php @@ -11,7 +11,7 @@ }; use Innmind\Filesystem\File\Content; use Innmind\Url\Url; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class RenderTest extends TestCase { @@ -29,7 +29,11 @@ public function testInvokation() $graph = $render(StackTrace::of(new DomainException('', 0, $e))); $this->assertInstanceOf(Content::class, $graph); - $this->assertNotEmpty($graph->toString()); + $this + ->assert() + ->expected('') + ->not() + ->same($graph->toString()); \file_put_contents('graph.dot', $graph->toString()); } } diff --git a/tests/StackTraceTest.php b/tests/StackTraceTest.php index 0bba60c..67979e3 100644 --- a/tests/StackTraceTest.php +++ b/tests/StackTraceTest.php @@ -8,7 +8,7 @@ Throwable, }; use Innmind\Immutable\Sequence; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class StackTraceTest extends TestCase { diff --git a/tests/ThrowableTest.php b/tests/ThrowableTest.php index 0d34d43..9acde84 100644 --- a/tests/ThrowableTest.php +++ b/tests/ThrowableTest.php @@ -13,7 +13,7 @@ Sequence, Str, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class ThrowableTest extends TestCase { @@ -31,7 +31,7 @@ public function testInterface() $this->assertInstanceOf(Line::class, $throwable->line()); $this->assertSame(22, $throwable->line()->toInt()); $this->assertInstanceOf(Sequence::class, $throwable->trace()); - $this->assertCount(12, $throwable->trace()); + $this->assertCount(9, $throwable->trace()); $this->assertSame( $e->getTraceAsString(), Str::of("\n")->join($throwable->trace()->map( @@ -39,6 +39,6 @@ public function testInterface() ))->toString(), ); $this->assertInstanceOf(Sequence::class, $throwable->callFrames()); - $this->assertCount(11, $throwable->callFrames()); + $this->assertCount(8, $throwable->callFrames()); } }