From 2dc21369a03ab6a9eb80874d6959d293e9a1b9ba Mon Sep 17 00:00:00 2001 From: Propaganistas Date: Wed, 4 Sep 2019 20:45:21 +0200 Subject: [PATCH] Remove ambiguous getCountries method --- src/PhoneNumber.php | 10 ---------- tests/PhoneNumberTest.php | 30 ++++++++---------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/PhoneNumber.php b/src/PhoneNumber.php index 9c2b228..a6e73df 100644 --- a/src/PhoneNumber.php +++ b/src/PhoneNumber.php @@ -217,16 +217,6 @@ public function getCountry() return $this->country; } - /** - * Get the countries associated with the phone number. - * - * @return array - */ - public function getCountries() - { - return $this->countries; - } - /** * Check if the phone number is of (a) given country(ies). * diff --git a/tests/PhoneNumberTest.php b/tests/PhoneNumberTest.php index b6e79a1..c3e3970 100644 --- a/tests/PhoneNumberTest.php +++ b/tests/PhoneNumberTest.php @@ -18,35 +18,21 @@ public function it_can_construct() } /** @test */ - public function it_can_set_temporary_countries() + public function it_can_return_the_country() { $object = new PhoneNumber('012345678'); - $object = $object->ofCountry('BE'); - $this->assertEquals(['BE'], $object->getCountries()); - - $object = $object->ofCountry(['NL', 'FR']); - $this->assertEquals(['BE', 'NL', 'FR'], $object->getCountries()); + $object = $object->ofCountry('NL', 'FR', 'BE'); + $this->assertEquals('BE', $object->getCountry()); - $object = $object->ofCountry('AU', 'CH'); - $this->assertEquals(['BE', 'NL', 'FR', 'AU', 'CH'], $object->getCountries()); + $object = new PhoneNumber('+3212345678'); + $this->assertEquals('BE', $object->getCountry()); } /** @test */ - public function it_will_filter_invalid_countries() + public function it_will_ignore_invalid_countries() { $object = new PhoneNumber('012345678'); $object = $object->ofCountry('BE', 'foo', 23); - $this->assertEquals(['BE'], $object->getCountries()); - } - - /** @test */ - public function it_can_return_the_country() - { - $object = new PhoneNumber('012345678'); - $object = $object->ofCountry('NL', 'FR', 'BE'); - $this->assertEquals('BE', $object->getCountry()); - - $object = new PhoneNumber('+3212345678'); $this->assertEquals('BE', $object->getCountry()); } @@ -84,11 +70,11 @@ public function it_can_make() $object = PhoneNumber::make('012345678', 'BE'); $this->assertEquals('+3212345678', (string) $object); - $this->assertEquals(['BE'], $object->getCountries()); + $this->assertEquals('BE', $object->getCountry()); $object = PhoneNumber::make('012345678', ['BE', 'NL']); $this->assertEquals('+3212345678', (string) $object); - $this->assertEquals(['BE', 'NL'], $object->getCountries()); + $this->assertEquals('BE', $object->getCountry()); } /** @test */