public function ConfigUpdaterTest::testRevert in Commerce Core 8.2
Tests reverting configuration.
File
- tests/
src/ Kernel/ ConfigUpdaterTest.php, line 99
Class
- ConfigUpdaterTest
- Tests the ConfigUpdater class.
Namespace
Drupal\Tests\commerce\KernelCode
public function testRevert() {
$config_name = 'commerce_store.commerce_store_type.testing';
/** @var \Drupal\commerce_store\Entity\StoreTypeInterface $store_type */
$store_type = \Drupal::entityTypeManager()
->getStorage('commerce_store_type')
->load('testing');
$store_type
->setDescription('The default store');
$store_type
->save();
$result = $this->configUpdater
->revert([
$config_name,
]);
$failed = $result
->getFailed();
$succeeded = $result
->getSucceeded();
$this
->assertEmpty($failed);
$this
->assertEquals($succeeded[$config_name], "Skipped: {$config_name} was not reverted because it was modified by the user");
$result = $this->configUpdater
->revert([
$config_name,
], FALSE);
$succeeded = $result
->getSucceeded();
$this
->assertNotEmpty($succeeded);
$this
->assertEquals($succeeded[$config_name], "{$config_name} was successfully reverted");
/** @var \Drupal\commerce_store\Entity\StoreTypeInterface $store_type */
$store_type = \Drupal::entityTypeManager()
->getStorage('commerce_store_type')
->load('testing');
$this
->assertEmpty($store_type
->getDescription());
}