-
Notifications
You must be signed in to change notification settings - Fork 0
/
PersonWithGenderSpec.php
51 lines (41 loc) · 1.03 KB
/
PersonWithGenderSpec.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
51
<?php
declare(strict_types=1);
namespace spec\App;
use App\Gender;
use App\PersonWithGender;
use PhpSpec\ObjectBehavior;
class PersonWithGenderSpec extends ObjectBehavior
{
private const NAME = 'Foo';
private const AGE = 30;
public function let(): void
{
$this->beConstructedWith(
self::NAME,
self::AGE,
new Gender(Gender::FEMALE),
);
}
public function it_is_initializable()
{
$this->shouldHaveType(PersonWithGender::class);
}
public function it_is_not_equal_by_value(): void
{
$newPerson = new PersonWithGender(
self::NAME,
self::AGE,
new Gender(Gender::FEMALE),
);
$this->isEqual($newPerson)->shouldBe(false);
}
public function it_is_equal_by_reference(): void
{
$newPerson = new PersonWithGender(
self::NAME,
self::AGE,
$this->gender->getWrappedObject(),
);
$this->isEqual($newPerson)->shouldBe(true);
}
}