コード例 #1
0
 /**
  * @covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentProfile
  */
 public function testAssignProfile()
 {
     $method_id = 'profile';
     // Enable the method.
     $this->enableAssignmentMethod($method_id);
     // Add some configuration.
     $this->addConfigurationItem('shortcut.myshortcut', [], ['type' => 'shortcut_set']);
     $this->addConfigurationItem('node.type.article', [], ['type' => 'node_type']);
     $this->addConfigurationItem('image.style.test', [], ['type' => 'image_style']);
     $this->addConfigurationItem('system.cron', [], ['type' => 'simple']);
     $this->bundle = $this->assigner->createBundleFromDefault('myprofile');
     $this->bundle->setProfileName('myprofile');
     $this->bundle->setIsProfile(TRUE);
     $this->assigner->applyAssignmentMethod($method_id);
     $packages = $this->featuresManager->getPackages();
     $this->assertNotEmpty($packages['myprofile'], 'Expected package not created.');
     $expected_config_items = ['shortcut.myshortcut', 'system.cron', 'system.theme'];
     $this->assertEquals($expected_config_items, $packages['myprofile']->getConfig(), 'Expected configuration items not present in package.');
 }