-
Notifications
You must be signed in to change notification settings - Fork 0
/
PersonWithCitySpec.php
50 lines (41 loc) · 1.05 KB
/
PersonWithCitySpec.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
43
44
45
46
47
48
49
50
<?php
namespace spec\App;
use App\City;
use App\PersonWithCity;
use PhpSpec\ObjectBehavior;
class PersonWithCitySpec extends ObjectBehavior
{
private const NAME = 'Foo';
private const AGE = 30;
private const CITY_NAME = 'CityA';
public function let(): void
{
$this->beConstructedWith(
self::NAME,
self::AGE,
new City(self::CITY_NAME),
);
}
public function it_is_initializable(): void
{
$this->shouldHaveType(PersonWithCity::class);
}
public function it_is_equal_by_value(): void
{
$newPersonWithCity = new PersonWithCity(
self::NAME,
self::AGE,
new City(self::CITY_NAME)
);
$this->isEqual($newPersonWithCity)->shouldBe(true);
}
public function it_is_equal_by_value_negative_test(): void
{
$newPersonWithCity = new PersonWithCity(
self::NAME,
self::AGE,
new City('Bar')
);
$this->isEqual($newPersonWithCity)->shouldBe(false);
}
}