Example #1
0
 public function test_before_is_not_met_if_the_spy_was_called_after_another_spy()
 {
     $spy_1 = \Spies\make_spy();
     $spy_2 = \Spies\make_spy();
     $expectation = \Spies\expect_spy($spy_1)->to_have_been_called->before($spy_2);
     $spy_2('bar');
     $spy_1('foo');
     $expectation->silent_failures = true;
     $this->assertFalse($expectation->verify());
 }
Example #2
0
 public function test_spy_was_called_times_with_returns_false_if_not_called_with_those_args_that_number_of_times()
 {
     $spy = \Spies\make_spy();
     $spy('a', 'b');
     $spy('b', 'b');
     $this->assertFalse($spy->was_called_times_with(2, 'a', 'b'));
 }
Example #3
0
 public function test_assert_spy_was_called_when_is_false_when_called_function_returns_false()
 {
     $spy = \Spies\make_spy();
     $spy();
     $spy('yo');
     $this->assertSpyWasNotCalledWhen($spy, function ($args) {
         return $args === ['hi'];
     });
 }