Issue #3162008 by catch, mikelutz, Hardik_Patel_12, longwave: Prepare for EventDispatcherInterface::dispatch() return type hint
parent
1e5b9c7698
commit
75acedefef
|
@ -12,7 +12,7 @@ use Drupal\layout_builder\LayoutBuilderEvents;
|
||||||
use Drupal\layout_builder\SectionComponent;
|
use Drupal\layout_builder\SectionComponent;
|
||||||
use Drupal\Tests\UnitTestCase;
|
use Drupal\Tests\UnitTestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @coversDefaultClass \Drupal\layout_builder\SectionComponent
|
* @coversDefaultClass \Drupal\layout_builder\SectionComponent
|
||||||
|
@ -39,7 +39,7 @@ class SectionComponentTest extends UnitTestCase {
|
||||||
/** @var \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent $event */
|
/** @var \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent $event */
|
||||||
$event = $args[0];
|
$event = $args[0];
|
||||||
$event->setBuild(['#markup' => $event->getPlugin()->getPluginId()]);
|
$event->setBuild(['#markup' => $event->getPlugin()->getPluginId()]);
|
||||||
return;
|
return $event;
|
||||||
});
|
});
|
||||||
|
|
||||||
$layout_plugin = $this->prophesize(LayoutInterface::class);
|
$layout_plugin = $this->prophesize(LayoutInterface::class);
|
||||||
|
|
|
@ -5,6 +5,8 @@ namespace Drupal\Tests\Core\Session;
|
||||||
use Drupal\Core\Session\AccountInterface;
|
use Drupal\Core\Session\AccountInterface;
|
||||||
use Drupal\Core\Session\AccountProxy;
|
use Drupal\Core\Session\AccountProxy;
|
||||||
use Drupal\Tests\UnitTestCase;
|
use Drupal\Tests\UnitTestCase;
|
||||||
|
use Prophecy\Argument;
|
||||||
|
use Symfony\Contracts\EventDispatcher\Event;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +21,7 @@ class AccountProxyTest extends UnitTestCase {
|
||||||
*/
|
*/
|
||||||
public function testId() {
|
public function testId() {
|
||||||
$dispatcher = $this->prophesize(EventDispatcherInterface::class);
|
$dispatcher = $this->prophesize(EventDispatcherInterface::class);
|
||||||
|
$dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event());
|
||||||
$account_proxy = new AccountProxy($dispatcher->reveal());
|
$account_proxy = new AccountProxy($dispatcher->reveal());
|
||||||
$this->assertSame(0, $account_proxy->id());
|
$this->assertSame(0, $account_proxy->id());
|
||||||
$account_proxy->setInitialAccountId(1);
|
$account_proxy->setInitialAccountId(1);
|
||||||
|
@ -39,6 +42,7 @@ class AccountProxyTest extends UnitTestCase {
|
||||||
public function testSetInitialAccountIdException() {
|
public function testSetInitialAccountIdException() {
|
||||||
$this->expectException(\LogicException::class);
|
$this->expectException(\LogicException::class);
|
||||||
$dispatcher = $this->prophesize(EventDispatcherInterface::class);
|
$dispatcher = $this->prophesize(EventDispatcherInterface::class);
|
||||||
|
$dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event());
|
||||||
$account_proxy = new AccountProxy($dispatcher->reveal());
|
$account_proxy = new AccountProxy($dispatcher->reveal());
|
||||||
$current_user = $this->prophesize(AccountInterface::class);
|
$current_user = $this->prophesize(AccountInterface::class);
|
||||||
$account_proxy->setAccount($current_user->reveal());
|
$account_proxy->setAccount($current_user->reveal());
|
||||||
|
|
Loading…
Reference in New Issue