public function test_should_be_collection_empty() { $destinations = ["Codigo" => ""]; $places = PlacesFactory::create($destinations); $this->assertInstanceOf("Ochoa\\Type\\PlacesCollection", $places); $this->assertTrue($places->count() == 0); }
/** * @return array * @throws \Ochoa\Exceptions\ResponseException */ public function getOrigins(\SoapClient $client) { $headers[] = $this->createHeaderAuth($this->config["user"], $this->config["pass"]); $client->__setSoapHeaders($headers); $placesResponse = $this->call("ObtenerLocalidadesActivas", [], $client); Validate::validOrigins($placesResponse); $placesResponseXml = simplexml_load_string($placesResponse->ObtenerLocalidadesActivasResult->any); $placeNameValues = [PlaceFactory::CODE => "idlocali", PlaceFactory::NAME => "nombre"]; $places = []; foreach ($placesResponseXml->NewDataSet->Table as $place) { $places[] = (array) $place; } return PlacesFactory::create($places, $placeNameValues); }