예제 #1
0
 /**
  * Tests the hasHandler() method.
  *
  * @covers ::hasHandler
  *
  * @dataProvider providerTestHasHandler
  */
 public function testHasHandler($entity_type_id, $expected)
 {
     $apple = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
     $apple->expects($this->any())->method('hasHandlerClass')->with('storage')->will($this->returnValue(TRUE));
     $banana = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
     $banana->expects($this->any())->method('hasHandlerClass')->with('storage')->will($this->returnValue(FALSE));
     $this->setUpEntityManager(array('apple' => $apple, 'banana' => $banana));
     $entity_type = $this->entityManager->hasHandler($entity_type_id, 'storage');
     $this->assertSame($expected, $entity_type);
 }
예제 #2
0
 /**
  * Tests the hasHandler() method.
  *
  * @covers ::hasHandler
  *
  * @dataProvider providerTestHasHandler
  */
 public function testHasHandler($entity_type_id, $expected)
 {
     $apple = $this->prophesize(EntityTypeInterface::class);
     $apple->hasHandlerClass('storage')->willReturn(TRUE);
     $banana = $this->prophesize(EntityTypeInterface::class);
     $banana->hasHandlerClass('storage')->willReturn(FALSE);
     $this->setUpEntityManager(array('apple' => $apple, 'banana' => $banana));
     $entity_type = $this->entityManager->hasHandler($entity_type_id, 'storage');
     $this->assertSame($expected, $entity_type);
 }