class PrepareModulesEntityUninstallFormTest
Same name and namespace in other branches
- 10 core/modules/system/tests/src/Kernel/Module/PrepareModulesEntityUninstallFormTest.php \Drupal\Tests\system\Kernel\Module\PrepareModulesEntityUninstallFormTest
Tests PrepareModulesEntityUninstallForm.
@group Module
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\Module\PrepareModulesEntityUninstallFormTest uses \Drupal\Tests\user\Traits\UserCreationTrait extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of PrepareModulesEntityUninstallFormTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ Module/ PrepareModulesEntityUninstallFormTest.php, line 17
Namespace
Drupal\Tests\system\Kernel\ModuleView source
class PrepareModulesEntityUninstallFormTest extends KernelTestBase {
use UserCreationTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'user',
'system',
];
/**
* Tests PrepareModulesEntityUninstallForm::formTitle.
*/
public function testModuleEntityUninstallTitle() : void {
$this->setUpCurrentUser(permissions: [
'administer modules',
]);
/** @var \Drupal\Core\Controller\TitleResolverInterface $title_resolver */
$title_resolver = \Drupal::service('title_resolver');
\Drupal::service('router.builder')->rebuild();
$request = Request::create('/admin/modules/uninstall/entity/user');
// Simulate matching.
$request->attributes
->set('entity_type_id', 'user');
$route = \Drupal::service('router.route_provider')->getRouteByName('system.prepare_modules_entity_uninstall');
$title = (string) $title_resolver->getTitle($request, $route);
$this->assertEquals('Are you sure you want to delete all users?', $title);
$not_an_entity_type = $this->randomMachineName();
$request = Request::create('/admin/modules/uninstall/entity/' . $not_an_entity_type);
// Simulate matching.
$request->attributes
->set('entity_type_id', $not_an_entity_type);
$this->expectException(PluginNotFoundException::class);
(string) $title_resolver->getTitle($request, $route);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.