
| Current Path : /var/www/html/rocksensor1/web/core/modules/system/tests/src/Kernel/Entity/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/system/tests/src/Kernel/Entity/ActionValidationTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\system\Kernel\Entity;
use Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase;
use Drupal\system\Entity\Action;
/**
* Tests validation of action entities.
*
* @group system
* @group #slow
*/
class ActionValidationTest extends ConfigEntityValidationTestBase {
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->entity = Action::create([
'id' => 'test',
'label' => 'Test',
'type' => 'test',
'plugin' => 'action_goto_action',
]);
$this->entity->save();
}
/**
* Action IDs are atypical in that they allow periods in the machine name.
*/
public static function providerInvalidMachineNameCharacters(): array {
$cases = parent::providerInvalidMachineNameCharacters();
// Remove the existing test case that verifies a machine name containing
// periods is invalid.
self::assertSame(['period.separated', FALSE], $cases['INVALID: period separated']);
unset($cases['INVALID: period separated']);
// And instead add a test case that verifies it is allowed for blocks.
$cases['VALID: period separated'] = ['period.separated', TRUE];
return $cases;
}
/**
* Tests that the action plugin ID is validated.
*/
public function testInvalidPluginId(): void {
$this->entity->set('plugin', 'non_existent');
$this->assertValidationErrors([
'plugin' => "The 'non_existent' plugin does not exist.",
]);
}
}