public function FeaturesAssignTest::testAssignProfile in Features 8.4
Same name and namespace in other branches
- 8.3 tests/src/Kernel/FeaturesAssignTest.php \Drupal\Tests\features\Kernel\FeaturesAssignTest::testAssignProfile()
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentProfile
File
- tests/
src/ Kernel/ FeaturesAssignTest.php, line 745
Class
- FeaturesAssignTest
- The Feature Assign test.
Namespace
Drupal\Tests\features\KernelCode
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' => FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG,
]);
$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.');
}