You are here

public function ConfigEntityStorageTest::testSaveMismatch in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveMismatch()

@covers ::save @covers ::doSave

@expectedException \Drupal\Core\Config\ConfigDuplicateUUIDException @expectedExceptionMessage when this UUID is already used for

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php, line 529
Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest.

Class

ConfigEntityStorageTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testSaveMismatch() {
  $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
    ->never())
    ->method('save');
  $this->cacheTagsInvalidator
    ->expects($this
    ->never())
    ->method('invalidateTags');
  $this->configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->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',
  ));
  $this->entityStorage
    ->save($entity);
}