MissingProjectInfoTest.php in Automatic Updates 8
File
tests/src/Kernel/ReadinessChecker/MissingProjectInfoTest.php
View source
<?php
namespace Drupal\Tests\automatic_updates\Kernel\ReadinessChecker;
use Drupal\automatic_updates\ReadinessChecker\MissingProjectInfo;
use Drupal\Core\Extension\ExtensionList;
use Drupal\KernelTests\KernelTestBase;
class MissingProjectInfoTest extends KernelTestBase {
public static $modules = [
'automatic_updates',
];
public function setUp() {
parent::setUp();
$this
->installConfig([
'automatic_updates',
]);
}
public function testMissingProjectInfo() {
$ignore_paths = "modules/custom/*\nthemes/custom/*\nprofiles/custom/*";
$this
->config('automatic_updates.settings')
->set('ignored_paths', $ignore_paths)
->save();
$messages = $this->container
->get('automatic_updates.missing_project_info')
->run();
$this
->assertNotEmpty($messages);
$extension_list = $this
->createMock(ExtensionList::class);
$messages = (new TestMissingProjectInfo($extension_list, $extension_list, $extension_list))
->run();
$this
->assertEmpty($messages);
}
}
class TestMissingProjectInfo extends MissingProjectInfo {
protected function getInfos($extension_type) {
$infos = [];
if ($extension_type === 'modules') {
$infos['system'] = [
'name' => 'System',
'type' => 'module',
'description' => 'Handles general site configuration for administrators.',
'package' => 'Core',
'version' => 'VERSION',
'packaged' => FALSE,
'project' => $this
->getProjectName('system', [
'install path' => 'core',
]),
'install path' => drupal_get_path('module', 'system'),
'core' => '8.x',
'required' => 'true',
'configure' => 'system.admin_config_system',
'dependencies' => [],
];
}
return $infos;
}
}