public function __invoke() { $testRunner = new Runner(); $passingTest = function () { }; $expected = Result::passed(); Assert::like($testRunner($passingTest), $expected); }
public function __invoke() { $testRunner = new Runner(); $error = new \Exception(); $failingTest = function () use($error) { throw $error; }; $expected = Result::failed($error); Assert::like($testRunner($failingTest), $expected); }
public function __invoke() { $suite = new Suite(); $exception = new \Exception(); $suite->addTest(function () { }, 'passing test 1'); $suite->addTest(function () { }, 'passing test 2'); $result = $suite(new Runner()); $expected = Result::passed(); Assert::like($result, $expected); }
public function __invoke() { $passingTest = function () { }; $passingTestName = 'passing test'; $afterTestCallback = function ($testNumber, $testName, $testResult) use(&$spy) { $spy = (object) ['testNumber' => $testNumber, 'testName' => $testName, 'testResult' => $testResult]; }; $runner = new Runner(); $suite = new Suite(); $suite->setAfterTestCallback($afterTestCallback); $suite->addTest($passingTest, $passingTestName); $suite($runner); $expected = new \stdClass(); $expected->testNumber = 1; $expected->testName = $passingTestName; $expected->testResult = Result::passed($passingTestName); Assert::like($spy, $expected); }