Lines Matching refs:this

30         self::assertFalse($this->dispatcher->hasListeners('foo', 'Foo', 'json'));
31 $this->dispatcher->addListener('foo', static function () {
33 self::assertTrue($this->dispatcher->hasListeners('foo', 'Foo', 'json'));
35 self::assertFalse($this->dispatcher->hasListeners('bar', 'Bar', 'json'));
36 $this->dispatcher->addListener('bar', static function () {
38 self::assertFalse($this->dispatcher->hasListeners('bar', 'Bar', 'json'));
39 $this->dispatcher->addListener('bar', static function () {
41 self::assertFalse($this->dispatcher->hasListeners('bar', 'Bar', 'json'));
42 $this->dispatcher->addListener('bar', static function () {
44 self::assertTrue($this->dispatcher->hasListeners('bar', 'Baz', 'json'));
45 self::assertTrue($this->dispatcher->hasListeners('bar', 'Bar', 'json'));
47 self::assertFalse($this->dispatcher->hasListeners('baz', 'Bar', 'xml'));
48 $this->dispatcher->addListener('baz', static function () {
50 self::assertTrue($this->dispatcher->hasListeners('baz', 'Bar', 'xml'));
57 $this->dispatcher->addListener('foo', [$a, 'Foo']);
58 $this->dispatch('bar');
62 $this->dispatcher->addListener('pre', [$b, 'bar'], 'Bar');
63 $this->dispatcher->addListener('pre', [$b, 'foo'], 'Foo');
64 $this->dispatcher->addListener('pre', [$b, 'all']);
66 $b->bar($this->event, 'pre', 'Bar', 'json', $this->dispatcher);
67 $b->all($this->event, 'pre', 'Bar', 'json', $this->dispatcher);
68 $b->foo($this->event, 'pre', 'Foo', 'json', $this->dispatcher);
69 $b->all($this->event, 'pre', 'Foo', 'json', $this->dispatcher);
72 $this->dispatch('pre', 'Bar');
73 $this->dispatch('pre', 'Foo');
81 $this->dispatcher->addListener('pre', [$a, 'onlyProxy'], 'Bar', 'json', Proxy::class);
82 $this->dispatcher->addListener('pre', [$a, 'all'], 'Bar', 'json');
85 $event = new ObjectEvent($this->context, $object, ['name' => 'foo', 'params' => []]);
88 $a->onlyProxy($event, 'pre', 'Bar', 'json', $this->dispatcher);
89 $a->all($event, 'pre', 'Bar', 'json', $this->dispatcher);
92 $this->dispatch('pre', 'Bar', 'json', $event);
100 $this->dispatcher->addListener('pre', [$a, 'onlyProxy'], 'Bar', 'json', Proxy::class);
101 $this->dispatcher->addListener('pre', [$a, 'all'], 'Bar', 'json');
104 $event = new ObjectEvent($this->context, $object, ['name' => 'foo', 'params' => []]);
107 $a->all($event, 'pre', 'Bar', 'json', $this->dispatcher);
110 $this->dispatch('pre', 'Bar', 'json', $event);
119 $this->dispatcher->addListener('pre', static function (Event $event) use (&$listener1) {
124 $this->dispatcher->addListener('pre', static function () use (&$listener2) {
128 $this->dispatch('pre');
140 …$this->dispatcher->addListener('pre', static function (Event $event, $eventName, $loweredClass, $f…
152 $this->dispatcher->addListener('pre', static function () use (&$listener2) {
156 …$this->dispatcher->addListener('post', static function (Event $event, $eventName, $loweredClass, $…
164 $this->dispatch('pre');
179 $this->dispatcher->addSubscriber($subscriber);
187 ], 'listeners', $this->dispatcher);
192 $this->context = $this->getMockBuilder(Context::class)->getMock();
194 $this->dispatcher = $this->createEventDispatcher();
195 …$this->event = new ObjectEvent($this->context, new \stdClass(), ['name' => 'foo', 'params' => []]);
205 $this->dispatcher->dispatch($eventName, $class, $format, $event ?: $this->event);
227 if (!$this->wasReplayed) {
228 $this->expected[] = [$method, $args];
233 $this->actual[] = [$method, $args];
238 $this->wasReplayed = true;
243 Assert::assertSame($this->expected, $this->actual, $message);