/** * @covers ::getEntityTypeFromClass * * @expectedException \Drupal\Core\Entity\Exception\AmbiguousEntityClassException * @expectedExceptionMessage Multiple entity types found for \Drupal\apple\Entity\Apple. */ public function testGetEntityTypeFromClassAmbiguous() { $boskoop = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface'); $boskoop->expects($this->once())->method('getOriginalClass')->will($this->returnValue('\\Drupal\\apple\\Entity\\Apple')); $boskoop->expects($this->once())->method('id')->will($this->returnValue('boskop')); $gala = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface'); $gala->expects($this->once())->method('getOriginalClass')->will($this->returnValue('\\Drupal\\apple\\Entity\\Apple')); $gala->expects($this->once())->method('id')->will($this->returnValue('gala')); $this->setUpEntityManager(array('boskoop' => $boskoop, 'gala' => $gala)); $this->entityManager->getEntityTypeFromClass('\\Drupal\\apple\\Entity\\Apple'); }
/** * @covers ::getEntityTypeFromClass * * @expectedException \Drupal\Core\Entity\Exception\AmbiguousEntityClassException * @expectedExceptionMessage Multiple entity types found for \Drupal\apple\Entity\Apple. */ public function testGetEntityTypeFromClassAmbiguous() { $boskoop = $this->prophesize(EntityTypeInterface::class); $boskoop->getOriginalClass()->willReturn('\\Drupal\\apple\\Entity\\Apple'); $boskoop->id()->willReturn('boskop'); $gala = $this->prophesize(EntityTypeInterface::class); $gala->getOriginalClass()->willReturn('\\Drupal\\apple\\Entity\\Apple'); $gala->id()->willReturn('gala'); $this->setUpEntityManager(array('boskoop' => $boskoop, 'gala' => $gala)); $this->entityManager->getEntityTypeFromClass('\\Drupal\\apple\\Entity\\Apple'); }