public function ConfigEntityStorageTest::testSaveNoMismatch in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveNoMismatch()
@covers ::save @covers ::doSave
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 562 - Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest.
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testSaveNoMismatch() {
$config_object = $this
->getMockBuilder('Drupal\\Core\\Config\\Config')
->disableOriginalConstructor()
->getMock();
$config_object
->expects($this
->atLeastOnce())
->method('isNew')
->will($this
->returnValue(TRUE));
$config_object
->expects($this
->once())
->method('save');
$config_object
->expects($this
->atLeastOnce())
->method('get')
->willReturn([]);
$this->cacheTagsInvalidator
->expects($this
->once())
->method('invalidateTags')
->with(array(
$this->entityTypeId . '_list',
));
$this->configFactory
->expects($this
->once())
->method('get')
->with('the_config_prefix.baz')
->will($this
->returnValue($config_object));
$this->configFactory
->expects($this
->once())
->method('rename')
->willReturn($this->configFactory);
$this->configFactory
->expects($this
->exactly(1))
->method('getEditable')
->with('the_config_prefix.foo')
->will($this
->returnValue($config_object));
$this->entityQuery
->expects($this
->once())
->method('condition')
->will($this
->returnSelf());
$this->entityQuery
->expects($this
->once())
->method('execute')
->will($this
->returnValue(array(
'baz',
)));
$entity = $this
->getMockEntity(array(
'id' => 'foo',
));
$entity
->setOriginalId('baz');
$entity
->enforceIsNew();
$this->entityStorage
->save($entity);
}