| @@ 9-26 (lines=18) @@ | ||
| 6 | use GeoBase\Countries\CountryRepository; |
|
| 7 | use PHPUnit\Framework\TestCase; |
|
| 8 | ||
| 9 | class CountryRepositoryTest extends TestCase |
|
| 10 | { |
|
| 11 | public function testFindAll() |
|
| 12 | { |
|
| 13 | $collection = CountryRepository::findAll(); |
|
| 14 | $this->assertGreaterThan(1, count($collection)); |
|
| 15 | $countryExample = $collection->get(0); |
|
| 16 | $this->assertInstanceOf(CountryEntity::class, $countryExample); |
|
| 17 | $this->assertEquals(3, strlen($countryExample->getCode())); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function testFindByShortCode() |
|
| 21 | { |
|
| 22 | $country = CountryRepository::findByShortCode('DE'); |
|
| 23 | $this->assertInstanceOf(CountryEntity::class, $country); |
|
| 24 | $this->assertEquals(3, strlen($country->getCode())); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 9-26 (lines=18) @@ | ||
| 6 | use GeoBase\Regions\RegionRepository; |
|
| 7 | use PHPUnit\Framework\TestCase; |
|
| 8 | ||
| 9 | class RegionRepositoryTest extends TestCase |
|
| 10 | { |
|
| 11 | public function testFindAll() |
|
| 12 | { |
|
| 13 | $collection = RegionRepository::findAll(); |
|
| 14 | $this->assertGreaterThan(1, count($collection)); |
|
| 15 | $regionExample = $collection->get(0); |
|
| 16 | $this->assertInstanceOf(RegionEntity::class, $regionExample); |
|
| 17 | $this->assertEquals(2, strlen($regionExample->getCode())); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function testFindByCode() |
|
| 21 | { |
|
| 22 | $region = RegionRepository::findByCode('BC'); |
|
| 23 | $this->assertInstanceOf(RegionEntity::class, $region); |
|
| 24 | $this->assertEquals(2, strlen($region->getCode())); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||