Last active
December 31, 2015 08:39
-
-
Save ludofleury/7961379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function it_is_initializable() | |
{ | |
$this->beConstructedWith('FR'); | |
$this->shouldHaveType(Country::class); | |
} | |
public function its_constructor_requires_a_valid_country_isocode() | |
{ | |
// Hack due to phpspec current limitation to test the SUT constructor | |
$this->beConstructedWith('LOL'); | |
$exception = new UnknownCountryException('XX'); | |
$this->shouldThrow($exception)->during('__construct', ['XX']); | |
} | |
public function it_provides_the_country_code() | |
{ | |
$this->beConstructedWith('FR'); | |
$this->getCode()->shouldReturn('FR'); | |
} | |
public function it_provides_the_country_name_mapped_to_the_isocode() | |
{ | |
$this->beConstructedWith('FR'); | |
$this->getName()->shouldReturn('France'); | |
} | |
public function it_compares_like_a_value_object(Country $country) | |
{ | |
$this->beConstructedWith('FR'); | |
$this->equals($country)->shouldBeTrue(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment