Mercurial > hg > isophonics-drupal-site
view modules/contrib/migrate_plus/src/Tests/MigrationConfigEntityTest.php @ 1:1a348b17ec81
Logo and header background
author | Chris Cannam |
---|---|
date | Thu, 30 Nov 2017 14:56:35 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\migrate_plus\Tests; use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\KernelTests\KernelTestBase; use Drupal\migrate_plus\Entity\Migration; use Drupal\migrate_plus\Plugin\MigrationConfigEntityPluginManager; /** * Test migration config entity discovery. * * @group migrate_plus */ class MigrationConfigEntityTest extends KernelTestBase { public static $modules = ['migrate', 'migrate_plus']; /** * @var MigrationConfigEntityPluginManager */ protected $pluginMananger; protected function setUp() { parent::setUp(); $this->pluginMananger = \Drupal::service('plugin.manager.config_entity_migration'); } 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']); } }