public function FeaturesAssignTest::testAssignExisting in Features 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/FeaturesAssignTest.php \Drupal\Tests\features\Kernel\FeaturesAssignTest::testAssignExisting()
@covers Drupal\features\Plugin\FeaturesAssignment\FeaturesAssignmentExclude
File
- tests/
src/ Kernel/ FeaturesAssignTest.php, line 444
Class
- FeaturesAssignTest
- The Feature Assign test.
Namespace
Drupal\Tests\features\KernelCode
public function testAssignExisting() {
$method_id = 'existing';
// Enable the method.
$this
->enableAssignmentMethod($method_id);
// Also enable Packages plugin.
$this
->enableAssignmentMethod('packages', FALSE);
// First create the existing packages.
$this->assigner
->applyAssignmentMethod('packages');
// Now move config into those existing packages.
$this->assigner
->applyAssignmentMethod($method_id);
$packages = $this->featuresManager
->getPackages();
$this
->assertNotEmpty($packages[self::TEST_INSTALLED_PACKAGE], 'Expected package not created.');
$this
->assertNotEmpty($packages[self::TEST_UNINSTALLED_PACKAGE], 'Expected package not created.');
// Turn off any "required" option in package to let config get reassigned.
$package = $packages[self::TEST_INSTALLED_PACKAGE];
$package
->setRequired(TRUE);
$expected_config_items = [
'core.date_format.long',
];
$this
->assertEquals($expected_config_items, $packages[self::TEST_INSTALLED_PACKAGE]
->getConfig(), 'Expected configuration items not present in existing package.');
$expected_config_items = [
'core.date_format.short',
'system.cron',
];
$this
->assertEquals($expected_config_items, $packages[self::TEST_UNINSTALLED_PACKAGE]
->getConfig(), 'Expected configuration items not present in existing package.');
}