public function test_calling_global_function_after_finish_spying_throws_an_exception() { $this->expectException(\Spies\UndefinedFunctionException::class); \Spies\get_spy_for('my_undefined_global'); \Spies\finish_spying(); my_undefined_global(); }
public function test_global_expectation_is_cleared_by_finish_spying() { $spy = \Spies\get_spy_for('test_func'); \Spies\expect_spy($spy)->to_have_been_called->with('first call'); test_func('first call'); \Spies\finish_spying(); $spy = \Spies\get_spy_for('test_func'); \Spies\expect_spy($spy)->not->to_have_been_called->with('first call'); }