You are here

public function WorkspaceManagerTest::testLoad in Multiversion 8

Tests the load() method.

File

tests/src/Unit/WorkspaceManagerTest.php, line 158

Class

WorkspaceManagerTest
@coversDefaultClass \Drupal\multiversion\Workspace\WorkspaceManager @group multiversion

Namespace

Drupal\Tests\multiversion\Unit

Code

public function testLoad() {
  $storage = $this
    ->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
  $storage
    ->expects($this
    ->once())
    ->method('load')
    ->with(1)
    ->will($this
    ->returnValue($this->entities[0]));
  $this->entityTypeManager
    ->expects($this
    ->once())
    ->method('getStorage')
    ->with($this->entityTypeId)
    ->will($this
    ->returnValue($storage));
  $workspace_manager = new WorkspaceManager($this->requestStack, $this->entityTypeManager, $this->currentUser, $this->logger);
  $entity = $workspace_manager
    ->load(1);
  $this
    ->assertSame($this->entities[0], $entity);
}