diff --git a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php index e473cd2..443587c 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php @@ -99,34 +99,9 @@ protected function setUp() { } /** - * Tests ConfigEntityMapper::getOperations(). - */ - public function testGetEntity() { - $result = $this->configEntityMapper->getEntity(); - $this->assertEquals(NULL, $result); - - $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface'); - $entity_type - ->expects($this->any()) - ->method('getConfigPrefix') - ->will($this->returnValue('config_prefix')); - - $this->entityManager - ->expects($this->once()) - ->method('getDefinition') - ->with('configurable_language') - ->will($this->returnValue($entity_type)); - - $this->configEntityMapper->setEntity($this->entity); - $result = $this->configEntityMapper->getEntity(); - $expected = $this->entity; - $this->assertEquals($expected, $result); - } - - /** - * Tests ConfigEntityMapper::setEntity(). + * Tests ConfigEntityMapper::setEntity() and ConfigEntityMapper::getEntity(). */ - public function testSetEntity() { + public function testEntityGetterAndSetter() { $this->entity ->expects($this->once()) ->method('id') @@ -144,9 +119,15 @@ public function testSetEntity() { ->with('configurable_language') ->will($this->returnValue($entity_type)); + // No entity is set. + $this->assertNull($this->configEntityMapper->getEntity()); + $result = $this->configEntityMapper->setEntity($this->entity); $this->assertTrue($result); + // Ensure that the getter provides the entity. + $this->assertEquals($this->entity, $this->configEntityMapper->getEntity()); + // Ensure that the configuration name was added to the mapper. $plugin_definition = $this->configEntityMapper->getPluginDefinition(); $this->assertTrue(in_array('config_prefix.entity_id', $plugin_definition['names']));