/** * try to get all calls */ public function testGetCalls() { // search calls without phone_id filter -> at least one call will be returned $result = $this->_json->searchCalls($this->_objects['filter1'], $this->_objects['paging']); $this->assertGreaterThanOrEqual(1, $result['totalcount']); $this->assertLessThanOrEqual(2, $result['totalcount']); // search query -> '05036' -> the user has made 2 calls each with another phone, another made one call, 1 is correct then $result = $this->_json->searchCalls($this->_objects['filter2'], $this->_objects['paging']); $this->assertEquals(1, $result['totalcount'], 'query filter not working'); $result = $this->_json->searchCalls($this->_objects['filter2b'], $this->_objects['paging']); $this->assertEquals(1, $result['totalcount'], 'destination filter not working'); // search for phone_id $result = $this->_json->searchCalls($this->_objects['filter3'], $this->_objects['paging']); $this->assertGreaterThan(1, $result['totalcount'], 'phone_id filter not working'); $result = $this->_json->searchCalls($this->_objects['filter4'], $this->_objects['paging']); // the user searches for a phone not belonging to him, so no results will be returned $this->assertEquals(0, $result['totalcount'], 'calls of another user must not be found!'); $result = $this->_json->searchCalls($this->_objects['filter2a'], $this->_objects['paging']); $this->assertEquals($this->_objects['phone1']->getId(), $result['results'][0]['phone_id']['id']); $this->assertEquals(1, $result['totalcount'], 'the user made one call with this phone!'); $this->assertEquals($this->_objects['phone1']->getId(), $result['results'][0]['phone_id']['id']); $result = $this->_json->searchCalls($this->_objects['filter5'], $this->_objects['paging']); $this->assertEquals(0, $result['totalcount'], 'calls of another user must not be found!'); $this->assertEquals('998877', $result['filter'][0]['value'], 'the filter should stay!'); }
/** * try to get all calls * */ public function testGetCalls() { // search calls $result = $this->_json->searchCalls($this->_objects['filter1'], $this->_objects['paging']); $this->assertGreaterThan(1, $result['totalcount']); // search query -> '050' $result = $this->_json->searchCalls($this->_objects['filter2'], $this->_objects['paging']); $this->assertEquals(1, $result['totalcount'], 'query filter not working'); $call2 = $result['results'][0]; $this->assertEquals($this->_objects['call2']->destination, $call2['destination']); $this->assertEquals($this->_objects['call2']->getId(), $call2['id']); // search for phone_id $result = $this->_json->searchCalls($this->_objects['filter3'], $this->_objects['paging']); $this->assertGreaterThan(1, $result['totalcount'], 'phone_id filter not working'); }
/** * @see 0011934: show contacts in phone call grid */ public function testContactRelations() { // search phone 2 calls (on should be linked to sclever) $result = $this->_json->searchCalls($this->_objects['filter3'], $this->_objects['paging']); $scleverCall = null; foreach ($result['results'] as $call) { if ($call['id'] == 'phpunitcallhistoryid4') { $scleverCall = $call; } } $this->assertTrue($scleverCall !== null); $this->assertTrue(isset($scleverCall['relations'])); $this->assertEquals(1, count($scleverCall['relations']), print_r($scleverCall, true)); $this->assertEquals('Susan', $scleverCall['relations'][0]['related_record']['n_given'], print_r($scleverCall, true)); }