}); }); context("with chain of methods and arguments requirements", function () { it("expects stubbed chain called with matching arguments are called", function () { $foo = new Foo(); allow('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->toReceive('::getQuery', '::newQuery', '::from'); expect('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->toReceive('::getQuery', '::newQuery', '::from')->where(['::getQuery' => [1], '::newQuery' => [2], '::from' => [3]]); $query = Foo::getQuery(1); $select = $query::newQuery(2); $select::from(3); }); it("expects stubbed chain not called with matching arguments are uncalled", function () { $foo = new Foo(); allow('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->toReceive('::getQuery', '::newQuery', '::from'); expect('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->not->toReceive('::getQuery', '::newQuery', '::from')->where(['::getQuery' => [1], '::newQuery' => [2], '::from' => [3]]); $query = Foo::getQuery(1); $select = $query::newQuery(2); $select::from(0); }); }); }); context("with ordered enabled", function () { describe("::match()", function () { it("expects called methods to be called in a defined order", function () { $foo = new Foo(); expect($foo)->toReceive('message')->ordered; expect($foo)->toReceive('::version')->ordered; expect($foo)->toReceive('bar')->ordered; $foo->message(); $foo::version(); $foo->bar();