InstallerDependenciesResolutionTest.php in Drupal 10
File
core/modules/system/tests/src/Kernel/Installer/InstallerDependenciesResolutionTest.php
View source
<?php
namespace Drupal\Tests\system\Kernel\Installer;
use Drupal\Core\Extension\ProfileExtensionList;
use Drupal\KernelTests\KernelTestBase;
class InstallerDependenciesResolutionTest extends KernelTestBase {
protected static $modules = [
'system',
];
public function testDependenciesResolution() {
$profile_list = \Drupal::service('extension.list.profile');
assert($profile_list instanceof ProfileExtensionList);
$profile_list
->setPathname('testing_missing_dependencies', 'core/profiles/testing_missing_dependencies/testing_missing_dependencies.info.yml');
require_once dirname(__FILE__, 7) . '/includes/install.inc';
$info = drupal_verify_profile([
'parameters' => [
'profile' => 'testing_missing_dependencies',
],
'profile_info' => install_profile_info('testing_missing_dependencies'),
]);
$message = $info['required_modules']['description']
->render();
$this
->assertStringContainsString('Fictional', $message);
$this
->assertStringContainsString('Missing_module1', $message);
$this
->assertStringContainsString('Missing_module2', $message);
$this
->assertStringNotContainsString('Block', $message);
$this
->assertStringNotContainsString('Node', $message);
}
}