class ConfigTest
Same name in this branch
- 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 11.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 11.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 11.x core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 11.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 11.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
Same name in other branches
- 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 9 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 9 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 9 core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 9 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 9 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
- 8.9.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 8.9.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 8.9.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 8.9.x core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 8.9.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 8.9.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
- 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8\ConfigTest
- 10 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest
- 10 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php \Drupal\Tests\migrate\Unit\destination\ConfigTest
- 10 core/modules/system/tests/src/Functional/File/ConfigTest.php \Drupal\Tests\system\Functional\File\ConfigTest
- 10 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php \Drupal\Tests\Composer\Plugin\ProjectMessage\ConfigTest
- 10 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest
- 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest
@coversDefaultClass Drupal\Composer\Plugin\VendorHardening\Config @group VendorHardening
Hierarchy
- class \Drupal\Tests\Composer\Plugin\VendorHardening\ConfigTest extends \PHPUnit\Framework\TestCase
Expanded class hierarchy of ConfigTest
File
-
core/
tests/ Drupal/ Tests/ Composer/ Plugin/ VendorHardening/ ConfigTest.php, line 15
Namespace
Drupal\Tests\Composer\Plugin\VendorHardeningView source
class ConfigTest extends TestCase {
/**
* @covers ::getPathsForPackage
*/
public function testGetPathsForPackageMixedCase() : void {
$config = $this->getMockBuilder(Config::class)
->onlyMethods([
'getAllCleanupPaths',
])
->disableOriginalConstructor()
->getMock();
$config->expects($this->once())
->method('getAllCleanupPaths')
->willReturn([
'package' => [
'path',
],
]);
$this->assertSame([
'path',
], $config->getPathsForPackage('pACKage'));
}
/**
* @covers ::getAllCleanupPaths
*/
public function testNoRootMergeConfig() : void {
// Root package has no extra field.
$root = $this->createMock(RootPackageInterface::class);
$root->expects($this->once())
->method('getExtra')
->willReturn([]);
$config = new Config($root);
$ref_default = new \ReflectionProperty($config, 'defaultConfig');
$ref_plugin_config = new \ReflectionMethod($config, 'getAllCleanupPaths');
$this->assertEquals($ref_default->getValue($config), $ref_plugin_config->invoke($config));
}
/**
* @covers ::getAllCleanupPaths
*/
public function testRootMergeConfig() : void {
// Root package has configuration in extra.
$root = $this->createMock(RootPackageInterface::class);
$root->expects($this->once())
->method('getExtra')
->willReturn([
'drupal-core-vendor-hardening' => [
'isa/string' => 'test_dir',
'an/array' => [
'test_dir',
'doc_dir',
],
],
]);
$config = new Config($root);
$ref_plugin_config = new \ReflectionMethod($config, 'getAllCleanupPaths');
$plugin_config = $ref_plugin_config->invoke($config);
$this->assertSame([
'test_dir',
], $plugin_config['isa/string']);
$this->assertSame([
'test_dir',
'doc_dir',
], $plugin_config['an/array']);
}
/**
* @covers ::getAllCleanupPaths
*
* @runInSeparateProcess
*/
public function testMixedCaseConfigCleanupPackages() : void {
// Root package has configuration in extra.
$root = $this->createMock(RootPackageInterface::class);
$root->expects($this->once())
->method('getExtra')
->willReturn([
'drupal-core-vendor-hardening' => [
'NotMikey179/vfsStream' => [
'src/test',
],
],
]);
$config = new Config($root);
$ref_plugin_config = new \ReflectionMethod($config, 'getAllCleanupPaths');
// Put some mixed-case in the defaults.
$ref_default = new \ReflectionProperty($config, 'defaultConfig');
$ref_default->setValue($config, [
'BeHatted/Monk' => [
'tests',
],
'SymPhony/HTTPFoundational' => [
'src',
],
]);
$plugin_config = $ref_plugin_config->invoke($config);
foreach (array_keys($plugin_config) as $package_name) {
$this->assertDoesNotMatchRegularExpression('/[A-Z]/', $package_name);
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ConfigTest::testGetPathsForPackageMixedCase | public | function | @covers ::getPathsForPackage |
ConfigTest::testMixedCaseConfigCleanupPackages | public | function | @covers ::getAllCleanupPaths |
ConfigTest::testNoRootMergeConfig | public | function | @covers ::getAllCleanupPaths |
ConfigTest::testRootMergeConfig | public | function | @covers ::getAllCleanupPaths |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.