forked from moneyphp/money
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurrencySpec.php
42 lines (33 loc) · 898 Bytes
/
CurrencySpec.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace spec\Money;
use Money\Currency;
use PhpSpec\ObjectBehavior;
final class CurrencySpec extends ObjectBehavior
{
function let()
{
$this->beConstructedWith('EUR');
}
function it_is_initializable()
{
$this->shouldHaveType(Currency::class);
}
function it_is_json_serializable()
{
$this->shouldImplement(\JsonSerializable::class);
}
function it_throws_an_exception_when_code_is_not_string()
{
$this->beConstructedWith(123);
$this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation();
}
function it_has_a_code()
{
$this->getCode()->shouldReturn('EUR');
}
function it_equals_to_a_currency_with_the_same_code()
{
$this->equals(new Currency('EUR'))->shouldReturn(true);
$this->equals(new Currency('USD'))->shouldReturn(false);
}
}