public function FeaturesAssignTest::testAssignCore in Features 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/FeaturesAssignTest.php \Drupal\Tests\features\Kernel\FeaturesAssignTest::testAssignCore()
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentCoreType
File
- tests/
src/ Kernel/ FeaturesAssignTest.php, line 234
Class
- FeaturesAssignTest
- The Feature Assign test.
Namespace
Drupal\Tests\features\KernelCode
public function testAssignCore() {
$method_id = 'core';
// Enable the method.
$this
->enableAssignmentMethod($method_id);
// Test the default options for the core assignment method.
// Add a piece of configuration of a core type.
$this
->addConfigurationItem('field.storage.node.body', [], [
'shortName' => 'node.body',
'label' => 'node.body',
'type' => 'field_storage_config',
'dependents' => [
'field.field.node.article.body',
],
]);
// Add a piece of configuration of a non-core type.
$this
->addConfigurationItem('field.field.node.article.body', [], [
'shortName' => 'node.article.body',
'label' => 'Body',
'type' => 'field_config',
'dependents' => [],
]);
$this->assigner
->applyAssignmentMethod($method_id);
$packages = $this->featuresManager
->getPackages();
$expected_package_names = [
'core',
];
$this
->assertEquals($expected_package_names, array_keys($packages), 'Expected packages not created.');
$this
->assertTrue(in_array('field.storage.node.body', $packages['core']
->getConfig(), 'Expected configuration item not present in core package.'));
$this
->assertFalse(in_array('field.field.node.article.body', $packages['core']
->getConfig(), 'Unexpected configuration item present in core package.'));
}