Rename "Ignore CI Configs" to "Ignored CI Config"

This commit is contained in:
Maxime Rainville 2021-11-22 11:02:27 +13:00
parent 7c3fddfc8a
commit e0197191b8
8 changed files with 21 additions and 20 deletions

View File

@ -516,7 +516,7 @@ class CoreKernel implements Kernel
*
* @return string[] List of CI types to ignore as defined by `Module`.
*/
protected function getIgnoreCIConfigs(): array
protected function getIgnoredCIConfigs(): array
{
return [];
}
@ -532,14 +532,14 @@ class CoreKernel implements Kernel
$this->getClassLoader()->init(
$this->getIncludeTests(),
$flush,
$this->getIgnoreCIConfigs()
$this->getIgnoredCIConfigs()
);
// Find modules
$this->getModuleLoader()->init(
$this->getIncludeTests(),
$flush,
$this->getIgnoreCIConfigs()
$this->getIgnoredCIConfigs()
);
// Flush config
@ -561,7 +561,7 @@ class CoreKernel implements Kernel
$defaultSet->init(
$this->getIncludeTests(),
$flush,
$this->getIgnoreCIConfigs()
$this->getIgnoredCIConfigs()
);
}
}

View File

@ -515,7 +515,7 @@ class ClassManifest
'name_regex' => '/^[^_].*\\.php$/',
'ignore_files' => ['index.php', 'cli-script.php'],
'ignore_tests' => !$includeTests,
'ignore_ci_configs' => $ignoredCIConfigs,
'ignored_ci_configs' => $ignoredCIConfigs,
'file_callback' => function ($basename, $pathname, $depth) use ($includeTests, $finder) {
$this->handleFile($basename, $pathname, $includeTests);
},

View File

@ -6,13 +6,14 @@ use RuntimeException;
use SilverStripe\Assets\FileFinder;
/**
* An extension to the default file finder with some extra filters to faciliate
* An extension to the default file finder with some extra filters to facilitate
* autoload and template manifest generation:
* - Only modules with _config.php files are scanned.
* - If a _manifest_exclude file is present inside a directory it is ignored.
* - Assets and module language directories are ignored.
* - Module tests directories are skipped if the ignore_tests option is not
* set to false.
* - Module tests directories are skipped if either of these conditions is meant:
* - the `ignore_tests` option is not set to false.
* - the module PHP CI configuration matches one of the `ignored_ci_configs`
*/
class ManifestFileFinder extends FileFinder
{
@ -34,7 +35,7 @@ class ManifestFileFinder extends FileFinder
'ignore_tests' => true,
'min_depth' => 1,
'ignore_dirs' => ['node_modules'],
'ignore_ci_configs' => []
'ignored_ci_configs' => []
];
public function acceptDir($basename, $pathname, $depth)
@ -76,9 +77,9 @@ class ManifestFileFinder extends FileFinder
}
// Skip if test dir inside vendor module with unexpected CI Configuration
if ($depth > 3 && $basename === self::TESTS_DIR && $ignoreCIConfig = $this->getOption('ignore_ci_configs')) {
if ($depth > 3 && $basename === self::TESTS_DIR && $ignoredCIConfig = $this->getOption('ignored_ci_configs')) {
$ciLib = $this->findModuleCIPhpConfiguration($basename, $pathname, $depth);
if (in_array($ciLib, $ignoreCIConfig)) {
if (in_array($ciLib, $ignoredCIConfig)) {
return false;
}
}

View File

@ -173,7 +173,7 @@ class ModuleManifest
$finder->setOptions([
'min_depth' => 0,
'ignore_tests' => !$includeTests,
'ignore_ci_configs' => $ignoredCIConfigs,
'ignored_ci_configs' => $ignoredCIConfigs,
'dir_callback' => function ($basename, $pathname, $depth) use ($finder) {
if ($finder->isDirectoryModule($basename, $pathname, $depth)) {
$this->addModule($pathname);

View File

@ -1012,7 +1012,7 @@ if (class_exists(IsEqualCanonicalizing::class)) {
$kernel = new TestKernel(BASE_PATH);
// PHPUnit 9 only logic to exclude old test still targeting PHPUNit 5.7
$kernel->setIgnoreCIConfigs([Module::CI_PHPUNIT_FIVE, Module::CI_UNKNOWN]);
$kernel->setIgnoredCIConfigs([Module::CI_PHPUNIT_FIVE, Module::CI_UNKNOWN]);
if (class_exists(HTTPApplication::class)) {
// Mock request

View File

@ -51,15 +51,15 @@ class TestKernel extends CoreKernel
* Set a list of CI configurations that should cause a module's test not to be added to a manifest
* @param string[] $ciConfigs
*/
public function setIgnoreCIConfigs(array $ciLibs): self
public function setIgnoredCIConfigs(array $ciConfigs): self
{
$this->ciLibs = $ciLibs;
$this->ciConfigs = $ciConfigs;
return $this;
}
protected function getIgnoreCIConfigs(): array
protected function getIgnoredCIConfigs(): array
{
return $this->ciLibs;
return $this->ciConfigs;
}
protected function bootErrorHandling()

View File

@ -139,7 +139,7 @@ class ThemeManifest implements ThemeList
'include_themes' => false,
'ignore_dirs' => ['node_modules', THEMES_DIR],
'ignore_tests' => !$includeTests,
'ignore_ci_configs' => $ignoredCIConfigs,
'ignored_ci_configs' => $ignoredCIConfigs,
'dir_callback' => [$this, 'handleDirectory']
]);

View File

@ -91,7 +91,7 @@ class ManifestFileFinderTest extends SapphireTest
$finder = new ManifestFileFinder();
$finder->setOption('name_regex', '/\.txt$/');
$finder->setOption('ignore_tests', false);
$finder->setOption('ignore_ci_configs', [Module::CI_PHPUNIT_FIVE]);
$finder->setOption('ignored_ci_configs', [Module::CI_PHPUNIT_FIVE]);
$this->assertFinderFinds(
$finder,
@ -115,7 +115,7 @@ class ManifestFileFinderTest extends SapphireTest
$finder = new ManifestFileFinder();
$finder->setOption('name_regex', '/\.txt$/');
$finder->setOption('ignore_tests', false);
$finder->setOption('ignore_ci_configs', [Module::CI_PHPUNIT_FIVE, Module::CI_UNKNOWN]);
$finder->setOption('ignored_ci_configs', [Module::CI_PHPUNIT_FIVE, Module::CI_UNKNOWN]);
$this->assertFinderFinds(
$finder,