/** * 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); }
/** * 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); }