@@ -33,6 +33,8 @@ public function test()
3333 $ spy = $ mapper ->getPlugin (Spy::class);
3434 $ this ->assertInstanceOf (Spy::class, $ spy );
3535
36+ $ this ->assertTrue ($ spy ->hasChanges ());
37+
3638 $ changes = $ spy ->getChanges ();
3739 $ this ->assertCount (1 , $ changes ->create );
3840 $ this ->assertCount (1 , $ changes ->update );
@@ -46,16 +48,20 @@ public function test()
4648 $ this ->assertCount (0 , $ changes ->update );
4749 $ this ->assertCount (1 , $ changes ->remove );
4850 $ this ->assertSame (array_values ($ changes ->remove )[0 ]->id , $ nekufa ->id );
51+ $ this ->assertTrue ($ spy ->hasChanges ());
4952
5053 $ spy ->reset ();
54+
5155 $ changes = $ spy ->getChanges ();
56+ $ this ->assertFalse ($ spy ->hasChanges ());
5257 $ this ->assertCount (0 , $ changes ->create );
5358 $ this ->assertCount (0 , $ changes ->update );
5459 $ this ->assertCount (0 , $ changes ->remove );
5560
5661 $ vasya =
$ mapper->
create (
'person ' , [
'email ' =>
'[email protected] ' ]);
5762
5863 $ changes = $ spy ->getChanges ();
64+ $ this ->assertTrue ($ spy ->hasChanges ());
5965 $ this ->assertCount (1 , $ changes ->create );
6066 $ this ->assertCount (0 , $ changes ->update );
6167 $ this ->assertCount (0 , $ changes ->remove );
@@ -66,13 +72,15 @@ public function test()
6672 $ mapper ->save ($ vasya );
6773
6874 $ changes = $ spy ->getChanges ();
75+ $ this ->assertTrue ($ spy ->hasChanges ());
6976 $ this ->assertCount (1 , $ changes ->create );
7077 $ this ->assertCount (0 , $ changes ->update );
7178 $ this ->assertCount (0 , $ changes ->remove );
7279 $ this ->assertSame ([$ vasya ], array_values ($ changes ->create ));
7380
7481 $ mapper ->remove ($ vasya );
7582 $ changes = $ spy ->getChanges ();
83+ $ this ->assertFalse ($ spy ->hasChanges ());
7684 $ this ->assertCount (0 , $ changes ->create );
7785 $ this ->assertCount (0 , $ changes ->update );
7886 $ this ->assertCount (0 , $ changes ->remove );
@@ -84,14 +92,15 @@ public function test()
8492 $ mapper ->save ($ vasya );
8593
8694 $ changes = $ spy ->getChanges ();
87-
95+ $ this -> assertTrue ( $ spy -> hasChanges ());
8896 $ this ->assertCount (0 , $ changes ->create );
8997 $ this ->assertCount (1 , $ changes ->update );
9098 $ this ->assertCount (0 , $ changes ->remove );
9199
92100 $ mapper ->remove ($ vasya );
93101
94102 $ changes = $ spy ->getChanges ();
103+ $ this ->assertTrue ($ spy ->hasChanges ());
95104 $ this ->assertCount (0 , $ changes ->create );
96105 $ this ->assertCount (0 , $ changes ->update );
97106 $ this ->assertCount (1 , $ changes ->remove );
0 commit comments