You are here

public function MigrationConfigEntityTest::testCacheInvalidation in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/MigrationConfigEntityTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationConfigEntityTest::testCacheInvalidation()
  2. 8.2 tests/src/Kernel/MigrationConfigEntityTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationConfigEntityTest::testCacheInvalidation()
  3. 8.3 tests/src/Kernel/MigrationConfigEntityTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationConfigEntityTest::testCacheInvalidation()

Tests cache invalidation.

File

tests/src/Kernel/MigrationConfigEntityTest.php, line 51

Class

MigrationConfigEntityTest
Test migration config entity discovery.

Namespace

Drupal\Tests\migrate_plus\Kernel

Code

public function testCacheInvalidation() {
  $config = Migration::create([
    'id' => 'test',
    'status' => TRUE,
    'label' => 'Label A',
    'migration_tags' => [],
    'source' => [],
    'destination' => [],
    'migration_dependencies' => [],
  ]);
  $config
    ->save();
  $this
    ->assertTrue($this->pluginManager
    ->getDefinition('test'));
  $this
    ->assertSame('Label A', $this->pluginManager
    ->getDefinition('test')['label']);

  // Clear static cache in the plugin manager, the cache tag take care of the
  // persistent cache.
  $this->pluginManager
    ->useCaches(FALSE);
  $this->pluginManager
    ->useCaches(TRUE);
  $config
    ->set('label', 'Label B');
  $config
    ->save();
  $this
    ->assertSame('Label B', $this->pluginManager
    ->getDefinition('test')['label']);
}