$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 = Double::instance();
$expectation = expectation($actual, 10);
$matcher = $expectation->not->toReceive('helloWorld');
expect($expectation->actual())->toBe($actual);
expect($expectation->deferred())->toBe(['matcherName' => 'toReceive', 'matcher' => 'Kahlan\\Matcher\\ToReceive', 'data' => ['actual' => $actual, 'expected' => 'helloWorld'], 'instance' => $matcher, 'not' => true]);
expect($expectation->timeout())->toBe(10);
expect($expectation->not())->toBe(true);
expect($expectation->passed())->toBe(true);
expect($expectation->logs())->toHaveLength(1);
$expectation->clear();
expect($expectation->actual())->toBe(null);
expect($expectation->deferred())->toBe(null);
expect($expectation->timeout())->toBe(-1);
expect($expectation->not())->toBe(false);
expect($expectation->passed())->toBe(true);
expect($expectation->logs())->toHaveLength(0);