it("loops until the timeout is reached on failure using a sub spec", function () { $start = microtime(true); $subspec = new Specification(['closure' => function () { expect(true)->toBe(false); }]); $result = Expectation::expect($subspec, 0.1)->run(); expect($result)->toBeAnInstanceOf('Kahlan\\Expectation'); $end = microtime(true); expect($end - $start)->toBeGreaterThan(0.1); expect($end - $start)->toBeLessThan(0.2); }); }); describe("->__get()", function () { it("sets the not value using `'not'`", function () { $expectation = new Expectation(); expect($expectation->not())->toBe(false); expect($expectation->not)->toBe($expectation); expect($expectation->not())->toBe(true); }); it("throws an exception with unsupported attributes", function () { $closure = function () { $expectation = new Expectation(); $expectation->abc; }; expect($closure)->toThrow(new Exception('Unsupported attribute `abc`.')); }); }); describe("->clear()", function () { it("clears an expectation", function () { $actual = new stdClass(); $expectation = Expectation::expect($actual, 10);