public function MigrationConfigEntityTest::testCacheInvalidation in Migrate Plus 8.3
Same name and namespace in other branches
- 8.5 tests/src/Kernel/MigrationConfigEntityTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationConfigEntityTest::testCacheInvalidation()
- 8.2 tests/src/Kernel/MigrationConfigEntityTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationConfigEntityTest::testCacheInvalidation()
- 8.4 tests/src/Kernel/MigrationConfigEntityTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationConfigEntityTest::testCacheInvalidation()
File
- tests/
src/ Kernel/ MigrationConfigEntityTest.php, line 28
Class
- MigrationConfigEntityTest
- Test migration config entity discovery.
Namespace
Drupal\Tests\migrate_plus\KernelCode
public function testCacheInvalidation() {
$config = Migration::create([
'id' => 'test',
'label' => 'Label A',
'migration_tags' => [],
'source' => [],
'destination' => [],
'migration_dependencies' => [],
]);
$config
->save();
$this
->assertTrue($this->pluginMananger
->getDefinition('test'));
$this
->assertSame('Label A', $this->pluginMananger
->getDefinition('test')['label']);
// Clear static cache in the plugin manager, the cache tag take care of the
// persistent cache.
$this->pluginMananger
->useCaches(FALSE);
$this->pluginMananger
->useCaches(TRUE);
$config
->set('label', 'Label B');
$config
->save();
$this
->assertSame('Label B', $this->pluginMananger
->getDefinition('test')['label']);
$this
->assertSame('Label B', \Drupal::service('plugin.manager.migration')
->getDefinition('test')['label']);
}