Returns the total DPU of the stream. If the DPU has not yet been
obtained it validates the definition first.
public getTotalDPU ( ) : integer | ||
return | integer | The total DPU. |
public function testGetTotalDPU() { $response = array('response_code' => 200, 'data' => array('created_at' => date('Y-m-d H:i:s', time()), 'dpu' => 10), 'rate_limit' => 200, 'rate_limit_remaining' => 150); DataSift_MockApiClient::setResponse($response); $def = new DataSift_Definition($this->user, testdata('definition')); $this->assertEquals($def->get(), testdata('definition'), 'Definition string not set correctly'); $this->assertEquals($response['data']['dpu'], $def->getTotalDPU(), 'The total DPU is incorrect'); }
public function testGetDPUBreakdown() { $def = new DataSift_Definition($this->user, testdata('definition')); $response = array('response_code' => 200, 'data' => array('hash' => testdata('definition_hash'), 'created_at' => date('Y-m-d H:i:s', time()), 'dpu' => 10, 'detail' => array('detail 1')), 'rate_limit' => 200, 'rate_limit_remaining' => 150); DataSift_MockApiClient::setResponse($response); $this->assertEquals($def->get(), testdata('definition'), 'Definition string not set correctly'); $dpu = $def->getDPUBreakdown(); $this->assertEquals(count($dpu['detail']), 1, 'The DPU breakdown is not what was expected'); $this->assertTrue($dpu['dpu'] > 0, 'The total DPU is not positive'); $this->assertEquals($dpu['dpu'], $def->getTotalDPU(), 'The total DPU returned by the definition is not correct'); }