/** * Tests the getEntityTypeLabels() method. * * @covers ::getEntityTypeLabels */ public function testGetEntityTypeLabels() { $apple = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface'); $apple->expects($this->once())->method('getLabel')->will($this->returnValue('Apple')); $banana = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface'); $banana->expects($this->once())->method('getLabel')->will($this->returnValue('Banana')); $this->setUpEntityManager(array('apple' => $apple, 'banana' => $banana)); $expected = array('apple' => 'Apple', 'banana' => 'Banana'); $this->assertSame($expected, $this->entityManager->getEntityTypeLabels()); }
/** * Tests the getEntityTypeLabels() method. * * @covers ::getEntityTypeLabels */ public function testGetEntityTypeLabels() { $apple = $this->prophesize(EntityTypeInterface::class); $apple->getLabel()->willReturn('Apple'); $apple->getBundleOf()->willReturn(NULL); $banana = $this->prophesize(EntityTypeInterface::class); $banana->getLabel()->willReturn('Banana'); $banana->getBundleOf()->willReturn(NULL); $this->setUpEntityManager(array('apple' => $apple, 'banana' => $banana)); $expected = array('apple' => 'Apple', 'banana' => 'Banana'); $this->assertSame($expected, $this->entityManager->getEntityTypeLabels()); }