Exemplo n.º 1
0
 /**
  * Test the toArray method
  */
 public function testFormatToArray()
 {
     $city = new LocationData('city_id', 'Estudis de TV3', '22', 'city');
     $country = new LocationData('country_id', 'Catalunya', '23', 'country');
     $address = $this->getAddress('42', 'My home', 'Marc', 'Robirosa', 'C/ engonga', '43', '06580', '958652654', '647852365', 'Aixo en el basquetbol es veu molt clar', 'city_id');
     $expectedFullAddress = 'C/ engonga 43, Estudis de TV3, Catalunya 06580';
     $expectedResponse = ['id' => '42', 'name' => 'My home', 'recipientName' => 'Marc', 'recipientSurname' => 'Robirosa', 'address' => 'C/ engonga', 'addressMore' => '43', 'postalCode' => '06580', 'phone' => '958652654', 'mobile' => '647852365', 'comment' => 'Aixo en el basquetbol es veu molt clar', 'city' => ['city' => 'Estudis de TV3', 'country' => 'Catalunya'], 'fullAddress' => $expectedFullAddress];
     $this->locationProvider->expects($this->once())->method('getHierarchy')->with('city_id')->will($this->returnValue([$country, $city]));
     $response = $this->addressFormatter->toArray($address);
     $this->assertSame($expectedResponse, $response, 'Unexpected method response');
 }