Exemple #1
0
 context("when using with() and matchers", function () {
     it("expects params match the toContain argument matcher", function () {
         $foo = new Foo();
         expect($foo)->toReceive('message')->with(Arg::toContain('My Message'));
         $foo->message(['My Message', 'My Other Message']);
     });
     it("expects params match the argument matchers", function () {
         $foo = new Foo();
         expect($foo)->toReceive('message')->with(Arg::toBeA('boolean'));
         expect($foo)->toReceiveNext('message')->with(Arg::toBeA('string'));
         $foo->message(true);
         $foo->message('Hello World');
     });
     it("expects params to not match the toContain argument matcher", function () {
         $foo = new Foo();
         expect($foo)->not->toReceive('message')->with(Arg::toContain('Message'));
         $foo->message(['My Message', 'My Other Message']);
     });
 });
 context("when using classname", function () {
     it("expects called method to be called", function () {
         $foo = new Foo();
         expect('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->toReceive('message');
         $foo->message();
     });
     it("expects uncalled method to be uncalled", function () {
         $foo = new Foo();
         expect('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->not->toReceive('message');
     });
     it("expects called method to be uncalled using a wrong classname", function () {
         $foo = new Foo();