Skip to content
Snippets Groups Projects
Verified Commit df177314 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3508581 by annmarysruthy, borisson_: Fix...

Issue #3508581 by annmarysruthy, borisson_: Fix Drupal.Commenting.FunctionComment.Missing in Kernel tests
parent 6d097f18
No related branches found
No related tags found
4 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #445512 canceled
Showing
with 84 additions and 0 deletions
......@@ -49,6 +49,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of entity method actions on a block.
*/
public function testEntityMethodActions(): void {
$block = $this->placeBlock('system_messages_block', ['theme' => 'olivero']);
$this->assertSame('content', $block->getRegion());
......@@ -80,6 +83,9 @@ public function testPlaceBlockActionOnlyWorksOnBlocks(string $action): void {
$this->configActionManager->applyAction($action, 'user.role.anonymous', []);
}
/**
* Verifies placeBlockInDefaultTheme action doesn't alter an existing block.
*/
public function testPlaceBlockActionDoesNotChangeExistingBlock(): void {
$extant_region = Block::load('olivero_powered')->getRegion();
$this->assertNotSame('content', $extant_region);
......@@ -139,11 +145,17 @@ public function testPlaceBlockInStaticRegion(string $action, string $expected_th
$this->assertSame('content', $block->getRegion());
}
/**
* Tests placing a block in the default theme's region.
*/
public function testPlaceBlockInDefaultRegion(): void {
$this->config('system.theme')->set('default', 'umami')->save();
$this->testPlaceBlockInDynamicRegion('placeBlockInDefaultTheme', 'umami', 'content');
}
/**
* Tests placing a block at the first and last position in a region.
*/
public function testPlaceBlockAtPosition(): void {
// Ensure there's at least one block already in the region.
$block = Block::create([
......
......@@ -95,6 +95,9 @@ public function testAddItemToToolbar(string|array $action, array $expected_toolb
}
}
/**
* Tests that adding non-existent toolbar item to CKEditor triggers an error.
*/
public function testAddNonExistentItem(): void {
$recipe = $this->createRecipe([
'name' => 'Add an invalid toolbar item',
......@@ -112,6 +115,9 @@ public function testAddNonExistentItem(): void {
RecipeRunner::processRecipe($recipe);
}
/**
* Tests that the `addItemToToolbar` config action requires CKEditor 5.
*/
public function testActionRequiresCKEditor5(): void {
$this->enableModules(['editor_test']);
Editor::load('filter_test')?->setEditor('unicorn')->setSettings([])->save();
......
......@@ -101,6 +101,9 @@ function (ConstraintViolationInterface $v) {
$this->assertEquals($expected_ghs_configuration, $ghs_configuration);
}
/**
* Provides test cases for CKEditor 5 General HTML Support (GHS) configuration.
*/
public static function providerGhsConfiguration(): array {
return [
'empty source editing' => [
......
......@@ -34,6 +34,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of configuration actions on a contact form.
*/
public function testConfigActions(): void {
$form = ContactForm::load('personal');
$this->assertSame('Your message has been sent.', $form->getMessage());
......
......@@ -40,6 +40,9 @@ class AddModerationConfigActionTest extends KernelTestBase {
'user',
];
/**
* Tests adding entity types and bundles to a workflow.
*/
public function testAddEntityTypeAndBundle(): void {
$this->installEntitySchema('node');
$this->installConfig('node');
......@@ -58,6 +61,9 @@ public function testAddEntityTypeAndBundle(): void {
$this->assertSame(['tags'], $plugin->getBundlesForEntityType('taxonomy_term'));
}
/**
* Tests that the workflow must be of type Content Moderation.
*/
public function testWorkflowMustBeContentModeration(): void {
$this->enableModules(['workflows', 'workflow_type_test']);
......@@ -74,6 +80,9 @@ public function testWorkflowMustBeContentModeration(): void {
RecipeRunner::processRecipe($recipe);
}
/**
* Tests that the action only targets workflows.
*/
public function testActionOnlyTargetsWorkflows(): void {
$recipe = $this->createRecipe('user.role.anonymous');
$this->expectException(PluginNotFoundException::class);
......@@ -81,6 +90,9 @@ public function testActionOnlyTargetsWorkflows(): void {
RecipeRunner::processRecipe($recipe);
}
/**
* Tests that the derived config action definitions have correct admin labels.
*/
public function testDeriverAdminLabel(): void {
$this->enableModules(['workflows', 'content_moderation']);
......@@ -92,6 +104,9 @@ public function testDeriverAdminLabel(): void {
$this->assertSame('Add moderation to all vocabularies', (string) $definitions['add_moderation:addTaxonomyVocabularies']['admin_label']);
}
/**
* Creates a recipe configuration for adding entity types and bundles to a workflow.
*/
private function createRecipe(string $config_name): Recipe {
$recipe = <<<YAML
name: 'Add entity types and bundles to workflow'
......
......@@ -41,6 +41,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of configuration actions on field settings.
*/
public function testConfigActions(): void {
$field_storage = FieldStorageConfig::create([
'field_name' => 'test',
......
......@@ -372,6 +372,9 @@ public function testDeleteNoData(): void {
}
}
/**
* Tests that updating a field storage type is not allowed.
*/
public function testUpdateFieldType(): void {
$field_storage = FieldStorageConfig::create([
'field_name' => 'field_type',
......
......@@ -17,6 +17,9 @@ class SaveTest extends FileManagedUnitTestBase {
use UserCreationTrait;
/**
* Tests the saving process of file entities.
*/
public function testFileSave(): void {
$account = $this->createUser();
// Create a new file entity.
......
......@@ -32,6 +32,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests adding an image effect using the configuration action manager.
*/
public function testConfigActions(): void {
$style = ImageStyle::load('large');
$this->assertCount(2, $style->getEffects());
......
......@@ -909,6 +909,9 @@ public function testConfigEntityResourceObjectSchema(): void {
$this->assertSame([], $validator->getErrors(), 'Validation errors on object ' . print_r($normalized, TRUE) . ' with schema ' . print_r($schema, TRUE));
}
/**
* Tests the serialization of a top-level JSON:API document with a single resource.
*/
public function testTopLevelResourceWithSingleResource(): void {
[, $resource_object] = $this->getTestContentEntityResource();
$serializer = $this->container->get('jsonapi.serializer');
......
......@@ -32,6 +32,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of configuration actions on a language.
*/
public function testConfigActions(): void {
$language = ConfigurableLanguage::load('en');
$this->assertSame('English', $language->getName());
......
......@@ -44,6 +44,9 @@ class InlineBlockUsageTest extends KernelTestBase {
*/
protected EntityTest $entity;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->database = $this->container->get('database');
......
......@@ -22,6 +22,9 @@ class LocaleConfigurableLanguageManagerTest extends KernelTestBase {
*/
protected static $modules = ['language', 'locale'];
/**
* Tests retrieving languages from the language manager.
*/
public function testGetLanguages(): void {
$this->installSchema('locale', ['locales_source', 'locales_target', 'locales_location']);
$default_language = ConfigurableLanguage::create(['label' => $this->randomMachineName(), 'id' => 'default', 'weight' => 0]);
......
......@@ -23,6 +23,9 @@ class LocaleDefaultConfigStorageTest extends KernelTestBase {
'locale_test_translate',
];
/**
* Tests retrieval of component names from locale default config storage.
*/
public function testGetComponentNames(): void {
$storage = new LocaleDefaultConfigStorage(
new NullStorage(),
......
......@@ -35,6 +35,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of configuration actions on a media type.
*/
public function testConfigActions(): void {
$media_type = MediaType::load('test');
$this->assertSame('Test type.', $media_type->getDescription());
......
......@@ -118,6 +118,9 @@ public function __construct($entity) {
$this->entity = $entity;
}
/**
* Returns the test entity.
*/
public function getEntity(): Media {
return $this->entity;
}
......
......@@ -27,6 +27,9 @@ protected function setUp(): void {
$this->executeMigration('menu_settings');
}
/**
* Tests migration of menu_ui settings.
*/
public function testMigration(): void {
$this->assertTrue(\Drupal::config('menu_ui.settings')->get('override_parent_selector'));
}
......
......@@ -37,6 +37,9 @@ protected function setUp(): void {
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of configuration actions on a node type.
*/
public function testConfigActions(): void {
$node_type = $this->createContentType();
......
......@@ -42,6 +42,9 @@ protected function setUp($import_test_views = TRUE): void {
}
}
/**
* Tests the revision create timestamp view.
*/
public function testRevisionCreateTimestampView(): void {
$node_type = NodeType::create([
'type' => 'article',
......
......@@ -228,6 +228,9 @@ public function testExcluderCanBeDisabled(): void {
$this->assertFileDoesNotExist($stage->getStageDirectory() . '/unknown/file.txt');
}
/**
* Tests that path repositories are included.
*/
public function testPathRepositoriesAreIncluded(): void {
$this->createTestProjectForTemplate(TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment