コード例 #1
0
 /**
  * Tests the hasController() method.
  *
  * @covers ::hasController()
  *
  * @dataProvider providerTestHasController
  */
 public function testHasController($entity_type_id, $expected)
 {
     $apple = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
     $apple->expects($this->any())->method('hasControllerClass')->with('storage')->will($this->returnValue(TRUE));
     $banana = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
     $banana->expects($this->any())->method('hasControllerClass')->with('storage')->will($this->returnValue(FALSE));
     $this->setUpEntityManager(array('apple' => $apple, 'banana' => $banana));
     $entity_type = $this->entityManager->hasController($entity_type_id, 'storage');
     $this->assertSame($expected, $entity_type);
 }