public function testFetchGotData() { $payload = ['items' => ['data' => ['id' => 1], 'meta' => ['type' => 'user', 'sync' => ['event_type' => 'created', 'ack_key' => 'User-1234-1', 'revision' => 1]]], 'meta' => ['type' => 'collection']]; $httpResponse = [200, $payload]; $http = $this->getMockBuilder('\\BaseCRM\\HttpClient')->disableOriginalConstructor()->getMock(); $http->expects($this->once())->method('get')->with("/sync/{$this->sessionId}/queues/main", null, ['headers' => ['X-Basecrm-Device-UUID' => $this->deviceUUID], 'raw' => true])->will($this->returnValue($httpResponse)); $sync = new SyncService($http); $this->assertEquals($sync->fetch($this->deviceUUID, $this->sessionId), $payload['items']); }