Skip to content

Instantly share code, notes, and snippets.

@ludofleury

ludofleury/CountrySpec.php

Last active Dec 31, 2015
Embed
What would you like to do?
<?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
You can’t perform that action at this time.