Mercurial > hg > isophonics-drupal-site
comparison modules/contrib/migrate_plus/src/Tests/MigrationConfigEntityTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\migrate_plus\Tests; | |
4 | |
5 use Drupal\Component\Plugin\Exception\PluginNotFoundException; | |
6 use Drupal\KernelTests\KernelTestBase; | |
7 use Drupal\migrate_plus\Entity\Migration; | |
8 use Drupal\migrate_plus\Plugin\MigrationConfigEntityPluginManager; | |
9 | |
10 /** | |
11 * Test migration config entity discovery. | |
12 * | |
13 * @group migrate_plus | |
14 */ | |
15 class MigrationConfigEntityTest extends KernelTestBase { | |
16 | |
17 public static $modules = ['migrate', 'migrate_plus']; | |
18 | |
19 /** | |
20 * @var MigrationConfigEntityPluginManager | |
21 */ | |
22 protected $pluginMananger; | |
23 | |
24 protected function setUp() { | |
25 parent::setUp(); | |
26 $this->pluginMananger = \Drupal::service('plugin.manager.config_entity_migration'); | |
27 } | |
28 | |
29 public function testCacheInvalidation() { | |
30 $config = Migration::create([ | |
31 'id' => 'test', | |
32 'label' => 'Label A', | |
33 'migration_tags' => [], | |
34 'source' => [], | |
35 'destination' => [], | |
36 'migration_dependencies' => [], | |
37 ]); | |
38 $config->save(); | |
39 | |
40 $this->assertTrue($this->pluginMananger->getDefinition('test')); | |
41 $this->assertSame('Label A', $this->pluginMananger->getDefinition('test')['label']); | |
42 | |
43 // Clear static cache in the plugin manager, the cache tag take care of the | |
44 // persistent cache. | |
45 $this->pluginMananger->useCaches(FALSE); | |
46 $this->pluginMananger->useCaches(TRUE); | |
47 | |
48 $config->set('label', 'Label B'); | |
49 $config->save(); | |
50 | |
51 $this->assertSame('Label B', $this->pluginMananger->getDefinition('test')['label']); | |
52 $this->assertSame('Label B', \Drupal::service('plugin.manager.migration')->getDefinition('test')['label']); | |
53 } | |
54 | |
55 } |