コード例 #1
0
 /**
  * @covers ::load
  */
 public function testLoad()
 {
     // Make sure that the contexts are passed down (or not).
     $this->pageVariant->getContexts()->willReturn([]);
     $this->panelsDisplay->setContexts([])->shouldBeCalledTimes(1);
     $this->storage->load('id_exists')->willReturn($this->pageVariant->reveal());
     $this->storage->load('doesnt_exist')->willReturn(NULL);
     $this->storage->load('not_a_panel')->willReturn($this->pageVariantNotPanels->reveal());
     $panels_storage = new PageManagerPanelsStorage([], '', [], $this->entityTypeManager->reveal());
     // Test the success condition.
     $this->assertSame($this->panelsDisplay->reveal(), $panels_storage->load('id_exists'));
     // Should be NULL if it doesn't exist.
     $this->assertNull($panels_storage->load('doesnt_exist'));
     // Should also be NULL if it's not a PanelsDisplayVariant.
     $this->assertNull($panels_storage->load('not_a_panel'));
 }