File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Behavioral/Observer/Tests Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,20 @@ public function testNotify()
36
36
public function testAttachDetach ()
37
37
{
38
38
$ subject = new User ();
39
- $ this ->assertAttributeEmpty ('observers ' , $ subject );
39
+ $ reflection = new \ReflectionProperty ($ subject , 'observers ' );
40
+
41
+ $ reflection ->setAccessible (true );
42
+ /** @var \SplObjectStorage $observers */
43
+ $ observers = $ reflection ->getValue ($ subject );
44
+
45
+ $ this ->assertInstanceOf ('SplObjectStorage ' , $ observers );
46
+ $ this ->assertFalse ($ observers ->contains ($ this ->observer ));
47
+
40
48
$ subject ->attach ($ this ->observer );
41
- $ this ->assertAttributeNotEmpty ('observers ' , $ subject );
49
+ $ this ->assertTrue ($ observers ->contains ($ this ->observer ));
50
+
42
51
$ subject ->detach ($ this ->observer );
43
- $ this ->assertAttributeEmpty ( ' observers ' , $ subject );
52
+ $ this ->assertFalse ( $ observers-> contains ( $ this -> observer ) );
44
53
}
45
54
46
55
/**
You can’t perform that action at this time.
0 commit comments