Esempio n. 1
0
 /**
  * Tests ConfigEntityMapper::setEntity().
  */
 public function testSetEntity()
 {
     $this->entity->expects($this->once())->method('id')->with()->will($this->returnValue('entity_id'));
     $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));
     $result = $this->configEntityMapper->setEntity($this->entity);
     $this->assertTrue($result);
     // 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']));
     // Make sure setEntity() returns FALSE when called a second time.
     $result = $this->configEntityMapper->setEntity($this->entity);
     $this->assertFalse($result);
 }