|
1 | 1 | <?php |
2 | 2 |
|
3 | | -use Symfony\Component\EventDispatcher\Event; |
4 | 3 |
|
5 | 4 | /** |
6 | 5 | * @author William Durand <william.durand1@gmail.com> |
7 | 6 | */ |
8 | | -class EventDispatcherBehaviorTest extends \PHPUnit_Framework_TestCase |
| 7 | +class EventDispatcherBehaviorTest extends PHPUnit\Framework\TestCase |
9 | 8 | { |
10 | | - public function setUp() |
| 9 | + public function setUp(): void |
11 | 10 | { |
12 | 11 | $tables = array( |
13 | 12 | 'Post' => <<<EOF |
@@ -82,39 +81,39 @@ public function testFireEvent() |
82 | 81 |
|
83 | 82 | $that = $this; |
84 | 83 |
|
85 | | - Post::getEventDispatcher()->addListener(Post::EVENT_POST_HYDRATE, function (Event $event) use (& $postHydrateFired, $that) { |
| 84 | + Post::getEventDispatcher()->addListener(Post::EVENT_POST_HYDRATE, function (object $event) use (& $postHydrateFired, $that) { |
86 | 85 | $postHydrateFired = true; |
87 | 86 |
|
88 | 87 | $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); |
89 | 88 | $that->assertInstanceOf('Post', $event->getSubject()); |
90 | 89 | $that->assertFalse($event->hasArgument('connection')); |
91 | 90 | }); |
92 | 91 |
|
93 | | - Post::getEventDispatcher()->addListener(Post::EVENT_CONSTRUCT, function (Event $event) use (& $postConstructFired, $that) { |
| 92 | + Post::getEventDispatcher()->addListener(Post::EVENT_CONSTRUCT, function (object $event) use (& $postConstructFired, $that) { |
94 | 93 | $postConstructFired = true; |
95 | 94 |
|
96 | 95 | $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); |
97 | 96 | $that->assertInstanceOf('Post', $event->getSubject()); |
98 | 97 | $that->assertFalse($event->hasArgument('connection')); |
99 | 98 | }); |
100 | 99 |
|
101 | | - Thread::getEventDispatcher()->addListener(Thread::EVENT_CONSTRUCT, function (Event $event) use (& $threadConstructFired, $that) { |
| 100 | + Thread::getEventDispatcher()->addListener(Thread::EVENT_CONSTRUCT, function (object $event) use (& $threadConstructFired, $that) { |
102 | 101 | $threadConstructFired = true; |
103 | 102 |
|
104 | 103 | $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); |
105 | 104 | $that->assertInstanceOf('Thread', $event->getSubject()); |
106 | 105 | $that->assertFalse($event->hasArgument('connection')); |
107 | 106 | }); |
108 | 107 |
|
109 | | - Post::getEventDispatcher()->addListener(Post::EVENT_PRE_SAVE, function (Event $event) use (& $preSaveFired, $that) { |
| 108 | + Post::getEventDispatcher()->addListener(Post::EVENT_PRE_SAVE, function (object $event) use (& $preSaveFired, $that) { |
110 | 109 | $preSaveFired = true; |
111 | 110 |
|
112 | 111 | $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); |
113 | 112 | $that->assertInstanceOf('Post', $event->getSubject()); |
114 | 113 | $that->assertInstanceOf('PropelPDO', $event->getArgument('connection')); |
115 | 114 | }); |
116 | 115 |
|
117 | | - Post::getEventDispatcher()->addListener(Post::EVENT_POST_SAVE, function (Event $event) use (& $postSaveFired, $that) { |
| 116 | + Post::getEventDispatcher()->addListener(Post::EVENT_POST_SAVE, function (object $event) use (& $postSaveFired, $that) { |
118 | 117 | $postSaveFired = true; |
119 | 118 |
|
120 | 119 | $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); |
|
0 commit comments