/** * @dataProvider calculateDomesticLetterPostageProvider */ public function testCalculateDomesticLetterPostage($mock, $args) { $this->setMockResponse($this->client, $mock); $response = $this->client->listDomesticLetterServices($args); $this->assertArrayHasKey('services', $response); $this->assertArrayHasKey('service', $response['services']); $services = $response['services']['service']; foreach ($services as $service) { $response = $this->client->calculateDomesticLetterPostage(array('service_code' => $service['code'], 'weight' => $args['weight'])); $this->assertArrayHasKey('postage_result', $response); $this->assertArrayHasKey('total_cost', $response['postage_result']); $cost = $response['postage_result']['total_cost']; $this->assertEquals($service['price'], $cost); } }