diff --git a/src/BusProNet/Model/Country.php b/src/BusProNet/Model/Country.php index 8d61651..bee581e 100644 --- a/src/BusProNet/Model/Country.php +++ b/src/BusProNet/Model/Country.php @@ -4,23 +4,10 @@ namespace App\BusProNet\Model; class Country { - private ?int $id = null; private ?string $name = null; private ?string $token = null; private ?string $nationality = null; - public function getId(): ?int - { - return $this->id; - } - - public function setId(?int $id): static - { - $this->id = $id; - - return $this; - } - public function getName(): ?string { return $this->name; diff --git a/src/BusProNet/Model/Hotel.php b/src/BusProNet/Model/Hotel.php index 7457ab0..9b396b4 100644 --- a/src/BusProNet/Model/Hotel.php +++ b/src/BusProNet/Model/Hotel.php @@ -4,14 +4,9 @@ namespace App\BusProNet\Model; class Hotel { - private ?int $id = null; private ?int $busProId = null; private ?string $code = null; private ?string $name = null; - private ?string $city = null; - private ?string $street = null; - private ?string $phone = null; - private ?string $type = null; /** * The raw BusProNet abbreviation, which is not a standard: the same country turns * up as D, DEU, A, AT or AUT. It joins against the country base data by token. @@ -25,18 +20,6 @@ class Hotel private ?string $countryCode = null; private ?string $costUnit = null; - public function getId(): ?int - { - return $this->id; - } - - public function setId(?int $id): static - { - $this->id = $id; - - return $this; - } - public function getBusProId(): ?int { return $this->busProId; @@ -73,54 +56,6 @@ class Hotel return $this; } - public function getCity(): ?string - { - return $this->city; - } - - public function setCity(?string $city): static - { - $this->city = $city; - - return $this; - } - - public function getStreet(): ?string - { - return $this->street; - } - - public function setStreet(?string $street): static - { - $this->street = $street; - - return $this; - } - - public function getPhone(): ?string - { - return $this->phone; - } - - public function setPhone(?string $phone): static - { - $this->phone = $phone; - - return $this; - } - - public function getType(): ?string - { - return $this->type; - } - - public function setType(?string $type): static - { - $this->type = $type; - - return $this; - } - public function getCountry(): ?string { return $this->country; diff --git a/src/MyEp/Api/ResponseMapper.php b/src/MyEp/Api/ResponseMapper.php index f98bf9f..2b0eb71 100644 --- a/src/MyEp/Api/ResponseMapper.php +++ b/src/MyEp/Api/ResponseMapper.php @@ -34,13 +34,9 @@ class ResponseMapper $hotel = new Hotel(); $hotel - ->setId($busProId) ->setBusProId($busProId) ->setCode($this->readString($row, 'code')) ->setName($this->readString($row, 'name')) - ->setCity($this->readString($row, 'city')) - ->setStreet($this->readString($row, 'street')) - ->setPhone($this->readString($row, 'phone')) ->setCountry($this->readString($row, 'country')) ->setCountryCode($this->readCountryCode($row)) ->setCostUnit($this->readString($row, 'costUnit')) @@ -97,7 +93,6 @@ class ResponseMapper $country = new Country(); $country - ->setId(isset($row['id']) ? (int) $row['id'] : null) ->setName($this->readString($row, 'name')) ->setToken($token) ->setNationality($this->readString($row, 'nationality')) diff --git a/tests/BusProNet/DataProvider/HotelDataProviderTest.php b/tests/BusProNet/DataProvider/HotelDataProviderTest.php index 49e200b..7246f80 100644 --- a/tests/BusProNet/DataProvider/HotelDataProviderTest.php +++ b/tests/BusProNet/DataProvider/HotelDataProviderTest.php @@ -23,8 +23,8 @@ class HotelDataProviderTest extends TestCase $this->assertEquals([163959, 11223], array_keys($hotels)); $this->assertEquals('Sportclub Jenatsch', $hotels[163959]->getName()); - // MyE&P reports the BusProNet idbuspro as the id, so both properties carry it - $this->assertEquals(163959, $hotels[163959]->getId()); + // MyE&P reports the BusProNet idbuspro as its id, and busProId is the only property + // that holds it now - the model used to carry the same number twice $this->assertEquals(163959, $hotels[163959]->getBusProId()); $this->assertEquals('4711', $hotels[163959]->getCostUnit()); $this->assertEquals('CH', $hotels[163959]->getCountry()); diff --git a/tests/MyEp/Api/ResponseMapperTest.php b/tests/MyEp/Api/ResponseMapperTest.php index bae5270..4f1d3db 100644 --- a/tests/MyEp/Api/ResponseMapperTest.php +++ b/tests/MyEp/Api/ResponseMapperTest.php @@ -41,9 +41,6 @@ class ResponseMapperTest extends TestCase $hotel = $hotels[163959]; - $this->assertEquals('Lenzerheide', $hotel->getCity()); - $this->assertEquals('Voa Principala 1', $hotel->getStreet()); - $this->assertEquals('+41 81 000000', $hotel->getPhone()); $this->assertEquals('4711', $hotel->getCostUnit()); } @@ -82,8 +79,7 @@ class ResponseMapperTest extends TestCase $this->assertNull($hotels[1]->getCountryCode()); $this->assertNull($hotels[1]->getCostUnit()); - $this->assertNull($hotels[1]->getType()); - $this->assertNull($hotels[1]->getPhone()); + $this->assertNull($hotels[1]->getName()); } public function testHotelsWithoutAnIdAreSkipped(): void @@ -135,7 +131,6 @@ class ResponseMapperTest extends TestCase $this->assertEquals(['CH'], array_keys($countries)); $this->assertInstanceOf(Country::class, $countries['CH']); - $this->assertEquals(1, $countries['CH']->getId()); $this->assertEquals('Schweiz', $countries['CH']->getName()); $this->assertEquals('CH', $countries['CH']->getToken()); $this->assertEquals('schweizerisch', $countries['CH']->getNationality());