Ejemplo n.º 1
0
 public function testListInternationalLetterWeights()
 {
     $this->setMockResponse($this->client, array('postage/list_international_letter_weights'));
     $response = $this->client->listInternationalLetterWeights();
     $this->assertArrayHasKey('weights', $response);
     $this->assertArrayHasKey('weight', $response['weights']);
     $this->assertCount(4, $response['weights']['weight']);
     $weights = $response['weights']['weight'];
     $codes = array();
     foreach ($weights as $weight) {
         if ($weight['code'] == EnvelopeType::INTL_ENVELOPE_TYPE_POSTCARD) {
             $this->assertArrayNotHasKey('value', $weight);
         } else {
             $this->assertArrayHasKey('value', $weight);
         }
         $codes[$weight['code']] = $weight['name'];
     }
     $this->assertArrayHasKey(EnvelopeType::INTL_ENVELOPE_TYPE_POSTCARD, $codes);
     $this->assertArrayHasKey(EnvelopeType::INTL_ENVELOPE_TYPE_UP_TO_50G, $codes);
     $this->assertArrayHasKey(EnvelopeType::INTL_ENVELOPE_TYPE_50G_250G, $codes);
     $this->assertArrayHasKey(EnvelopeType::INTL_ENVELOPE_TYPE_250G_500G, $codes);
     $this->assertEquals('Postcard/Greeting card', $codes[EnvelopeType::INTL_ENVELOPE_TYPE_POSTCARD]);
     $this->assertEquals('Up to 50g', $codes[EnvelopeType::INTL_ENVELOPE_TYPE_UP_TO_50G]);
     $this->assertEquals('>50g - 250g', $codes[EnvelopeType::INTL_ENVELOPE_TYPE_50G_250G]);
     $this->assertEquals('>250g - 500g', $codes[EnvelopeType::INTL_ENVELOPE_TYPE_250G_500G]);
 }