Issue #3162008 by catch, mikelutz, Hardik_Patel_12, longwave: Prepare for EventDispatcherInterface::dispatch() return type hint

merge-requests/25/head
Alex Pott 2020-10-01 13:25:41 +01:00
parent 1e5b9c7698
commit 75acedefef
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
2 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,7 @@ use Drupal\layout_builder\LayoutBuilderEvents;
use Drupal\layout_builder\SectionComponent;
use Drupal\Tests\UnitTestCase;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @coversDefaultClass \Drupal\layout_builder\SectionComponent
@ -39,7 +39,7 @@ class SectionComponentTest extends UnitTestCase {
/** @var \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent $event */
$event = $args[0];
$event->setBuild(['#markup' => $event->getPlugin()->getPluginId()]);
return;
return $event;
});
$layout_plugin = $this->prophesize(LayoutInterface::class);

View File

@ -5,6 +5,8 @@ namespace Drupal\Tests\Core\Session;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Session\AccountProxy;
use Drupal\Tests\UnitTestCase;
use Prophecy\Argument;
use Symfony\Contracts\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
@ -19,6 +21,7 @@ class AccountProxyTest extends UnitTestCase {
*/
public function testId() {
$dispatcher = $this->prophesize(EventDispatcherInterface::class);
$dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event());
$account_proxy = new AccountProxy($dispatcher->reveal());
$this->assertSame(0, $account_proxy->id());
$account_proxy->setInitialAccountId(1);
@ -39,6 +42,7 @@ class AccountProxyTest extends UnitTestCase {
public function testSetInitialAccountIdException() {
$this->expectException(\LogicException::class);
$dispatcher = $this->prophesize(EventDispatcherInterface::class);
$dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event());
$account_proxy = new AccountProxy($dispatcher->reveal());
$current_user = $this->prophesize(AccountInterface::class);
$account_proxy->setAccount($current_user->reveal());