Skip to content

Commit 87a1ae7

Browse files
Fix tests
1 parent e3c88c4 commit 87a1ae7

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Tests/EventDispatcherTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,12 @@ public function testLegacySignatureWithEvent()
431431
$this->dispatcher->dispatch('foo', new Event());
432432
}
433433

434+
/**
435+
* @group legacy
436+
* @expectedDeprecation Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.
437+
*/
434438
public function testLegacySignatureWithNewEventObject()
435439
{
436-
$this->expectException('TypeError');
437-
$this->expectExceptionMessage('Argument 1 passed to "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" must be an object, string given.');
438440
$this->dispatcher->dispatch('foo', new ContractsEvent());
439441
}
440442
}

Tests/LegacyEventDispatcherProxyTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ public function testLegacySignatureWithEvent()
4141
$this->createEventDispatcher()->dispatch('foo', new Event());
4242
}
4343

44+
/**
45+
* @group legacy
46+
* @expectedDeprecation The signature of the "Symfony\Component\EventDispatcher\Tests\TestLegacyEventDispatcher::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3.
47+
* @expectedDeprecation The signature of the "Symfony\Component\EventDispatcher\Tests\TestLegacyEventDispatcher::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3.
48+
* @expectedDeprecation Calling the "Symfony\Contracts\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.
49+
*/
4450
public function testLegacySignatureWithNewEventObject()
4551
{
46-
$this->expectException('TypeError');
47-
$this->expectExceptionMessage('Argument 1 passed to "Symfony\Contracts\EventDispatcher\EventDispatcherInterface::dispatch()" must be an object, string given.');
4852
$this->createEventDispatcher()->dispatch('foo', new ContractsEvent());
4953
}
5054

0 commit comments

Comments
 (0)