77use App \Model \ModelInterface ;
88use App \Model \Pet ;
99use App \Model \Vaccination ;
10- use App \Tests \Helper \AssertHelper ;
1110use PHPUnit \Framework \TestCase ;
1211
1312/**
@@ -37,12 +36,24 @@ public function testGetSet(): void
3736 $ vaccination2 = new Vaccination ();
3837 $ vaccination2 ->setName ('Feline Acquired Immune Deficiency Syndrome ' );
3938
39+ $ vaccination3 = new Vaccination ();
40+ $ vaccination3 ->setName ('Panleukopenia ' );
41+
4042 $ pet ->setUpdatedAt ($ now );
4143 $ pet ->setName ('Lucas ' );
4244 $ pet ->setTag ('2018 OHIO DOG 87123 LUCAS ' );
43- $ pet ->setVaccinations ([$ vaccination2 ]);
45+ $ pet ->setVaccinations ([$ vaccination2 , $ vaccination3 ]);
46+
47+ self ::assertNull ($ vaccination1 ->getPet ());
48+ self ::assertSame ($ pet , $ vaccination2 ->getPet ());
49+ self ::assertSame ($ pet , $ vaccination3 ->getPet ());
50+
4451 $ pet ->setVaccinations ([$ vaccination1 , $ vaccination2 ]);
4552
53+ self ::assertSame ($ pet , $ vaccination1 ->getPet ());
54+ self ::assertSame ($ pet , $ vaccination2 ->getPet ());
55+ self ::assertNull ($ vaccination3 ->getPet ());
56+
4657 self ::assertSame ($ now , $ pet ->getUpdatedAt ());
4758 self ::assertSame ('Lucas ' , $ pet ->getName ());
4859 self ::assertSame ('2018 OHIO DOG 87123 LUCAS ' , $ pet ->getTag ());
@@ -54,14 +65,11 @@ public function testGetSet(): void
5465 self ::assertSame ($ vaccination1 , array_shift ($ vaccinations ));
5566 self ::assertSame ($ vaccination2 , array_shift ($ vaccinations ));
5667
57- self ::assertSame ('Rabies ' , AssertHelper:: readProperty ( ' name ' , $ vaccination1 ));
58- self ::assertSame ($ pet , AssertHelper:: readProperty ( ' pet ' , $ vaccination1 ));
68+ self ::assertSame ('Rabies ' , $ vaccination1-> getName ( ));
69+ self ::assertSame ($ pet , $ vaccination1-> getPet ( ));
5970
60- self ::assertSame (
61- 'Feline Acquired Immune Deficiency Syndrome ' ,
62- AssertHelper::readProperty ('name ' , $ vaccination2 )
63- );
64- self ::assertSame ($ pet , AssertHelper::readProperty ('pet ' , $ vaccination2 ));
71+ self ::assertSame ('Feline Acquired Immune Deficiency Syndrome ' , $ vaccination2 ->getName ());
72+ self ::assertSame ($ pet , $ vaccination2 ->getPet ());
6573
6674 self ::assertSame ([
6775 'id ' => $ pet ->getId (),
0 commit comments