sdkMock = Mockery::mock(sdtClass::class); $this->sdk = new QuickbookSDK($this->sdkMock); } function testIsInstanceOf() { $this->assertInstanceOf(SdkInterface::class, $this->sdk); } function testMethodFetchRecords() { $data = json_decode( file_get_contents(base_path('tests/Mock/Quickbooks/Data/customers.json')),true ); $count = count($data); $this->sdkMock->shouldReceive('Query')->andReturnUsing(function($val) use ($count, $data) { if(stristr($val, 'count')) { return $count; } return Arr::take($data,4); }); $this->assertEquals($count, $this->sdk->totalRecords('Customer')); $this->assertEquals(4, count($this->sdk->fetchRecords('Customer', 4))); } }