Exemplo n.º 1
0
 /**
  * @covers ::render
  */
 public function testRenderWithoutDestination()
 {
     $entity_type_id = $this->randomMachineName();
     $entity = $this->getMockBuilder('\\Drupal\\user\\Entity\\Role')->disableOriginalConstructor()->getMock();
     $entity->expects($this->any())->method('getEntityTypeId')->will($this->returnValue($entity_type_id));
     $operations = array('foo' => array('title' => $this->randomMachineName()));
     $list_builder = $this->getMock('\\Drupal\\Core\\Entity\\EntityListBuilderInterface');
     $list_builder->expects($this->once())->method('getOperations')->with($entity)->will($this->returnValue($operations));
     $this->entityManager->expects($this->once())->method('getListBuilder')->with($entity_type_id)->will($this->returnValue($list_builder));
     $this->plugin->options['destination'] = FALSE;
     $result = new ResultRow();
     $result->_entity = $entity;
     $expected_build = array('#type' => 'operations', '#links' => $operations);
     $build = $this->plugin->render($result);
     $this->assertSame($expected_build, $build);
 }