Verified Commit 46c6a198 authored by Dave Long's avatar Dave Long
Browse files

Issue #3547173 by mondrake: Complete test annotations to attributes conversion...

Issue #3547173 by mondrake: Complete test annotations to attributes conversion for all remaining tests
parent e9a47ab0
Loading
Loading
Loading
Loading
Loading
+1 −7
Changes for .gitlab-ci.yml: 1 added line, 7 removed lines.
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ variables:
  PARENT_PIPELINE_ID: $CI_PIPELINE_ID
  _TARGET_PHP: "8.4-ubuntu"
  PHPUNIT_CONFIGURATION_FILE_PATH: $CI_PROJECT_DIR/core
  PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: false
  PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

#############
# Stages    #
@@ -597,7 +597,6 @@ default:
    KUBERNETES_CPU_REQUEST: "4"
    CONCURRENCY: 24
    _TARGET_PHP: "8.3-ubuntu"
    PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

'⚡️ PHPUnit Unit tests on PHP 8.4':
  <<: [ *default-job-settings-lint, *default-phpunit-job-settings ]
@@ -605,7 +604,6 @@ default:
    TESTSUITE: PHPUnit-Unit
    KUBERNETES_CPU_REQUEST: "4"
    CONCURRENCY: 24
    PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

'⚡️ PHPUnit Unit tests on PHP 8.5':
  <<: [ *default-job-settings-lint, *default-phpunit-job-settings ]
@@ -615,20 +613,17 @@ default:
    KUBERNETES_CPU_REQUEST: "4"
    CONCURRENCY: 24
    _TARGET_PHP: "8.5-ubuntu"
    PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

'⚡️ Component unit tests on PHP 8.3':
  <<: [ *default-job-settings-lint, *default-component-unit-test-job-settings ]
  variables:
    KUBERNETES_CPU_REQUEST: "2"
    _TARGET_PHP: "8.3-ubuntu"
    PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

'⚡️ Component unit tests on PHP 8.4':
  <<: [ *default-job-settings-lint, *default-component-unit-test-job-settings ]
  variables:
    KUBERNETES_CPU_REQUEST: "2"
    PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

'⚡️ Component unit tests on PHP 8.5':
  <<: [ *default-job-settings-lint, *default-component-unit-test-job-settings ]
@@ -636,7 +631,6 @@ default:
  variables:
    KUBERNETES_CPU_REQUEST: "2"
    _TARGET_PHP: "8.5-ubuntu"
    PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

'✅️ PHPStan rules tests':
  <<: [ *default-job-settings-lint ]
+1 −5
Changes for .gitlab-ci/pipeline.yml: 1 added line, 5 removed lines.
Original line number Diff line number Diff line
@@ -27,10 +27,6 @@ default:
      [[ $_TARGET_DB == pgsql* ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB?module=pgsql
    - echo "SIMPLETEST_DB = $SIMPLETEST_DB"
    - export PHPUNIT_CONFIGURATION_FILE_PATH=$CI_PROJECT_DIR/core
    - |
      [[ $TESTSUITE == PHPUnit-Build ]] && export PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION=true
      [[ $TESTSUITE == PHPUnit-Functional ]] && export PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION=true
      [[ $TESTSUITE == PHPUnit-FunctionalJavascript ]] && export PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION=true
    - $CI_PROJECT_DIR/.gitlab-ci/scripts/server-setup.sh
  after_script:
    - sed -i "s#$CI_PROJECT_DIR/##" ./sites/default/files/simpletest/phpunit-*.xml || true
@@ -77,7 +73,7 @@ variables:
  MINK_DRIVER_ARGS_WEBDRIVER_CHROMEDRIVER_NON_W3C: '["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--disable-dev-shm-usage","--disable-gpu","--headless","--dns-prefetch-disable"]}}, "http://localhost:9515"]'
  CI_PARALLEL_NODE_INDEX: $CI_NODE_INDEX
  CI_PARALLEL_NODE_TOTAL: $CI_NODE_TOTAL
  PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: false
  PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: true

.with-database: &with-database
  name: $_CONFIG_DOCKERHUB_ROOT/$_TARGET_DB:production
+0 −18
Changes for core/.phpstan-baseline.php: 0 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -21363,12 +21363,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Abstract test class Drupal\\\\Tests\\\\layout_builder\\\\Kernel\\\\SectionListTestBase must not add annotation @coversDefaultClass\\.$#',
	'identifier' => 'abstractTestClass.metadataForbidden',
	'count' => 1,
	'path' => __DIR__ . '/modules/layout_builder/tests/src/Kernel/SectionListTestBase.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\layout_builder\\\\Kernel\\\\SectionListTestBase\\:\\:assertSections\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -27340,12 +27334,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Abstract test class Drupal\\\\Tests\\\\path\\\\Kernel\\\\Migrate\\\\d7\\\\MigrateUrlAliasTestBase must not add annotation @group\\.$#',
	'identifier' => 'abstractTestClass.metadataForbidden',
	'count' => 1,
	'path' => __DIR__ . '/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\path\\\\Kernel\\\\Migrate\\\\d7\\\\MigrateUrlAliasTestBase\\:\\:assertPathAliasExists\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -43734,12 +43722,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/views/tests/src/Kernel/Plugin/CacheTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Abstract test class Drupal\\\\Tests\\\\views\\\\Kernel\\\\Plugin\\\\CastedIntFieldJoinTestBase must not add annotation @group\\.$#',
	'identifier' => 'abstractTestClass.metadataForbidden',
	'count' => 1,
	'path' => __DIR__ . '/modules/views/tests/src/Kernel/Plugin/CastedIntFieldJoinTestBase.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\views\\\\Kernel\\\\Plugin\\\\CastedIntFieldJoinTestBase\\:\\:setUpFixtures\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+19 −10
Changes for core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php: 19 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -4,18 +4,23 @@

namespace Drupal\Tests\ckeditor5\Kernel\ConfigAction;

use Drupal\ckeditor5\Plugin\ConfigAction\AddItemToToolbar;
use Drupal\Core\Config\Action\ConfigActionException;
use Drupal\Core\Recipe\InvalidConfigException;
use Drupal\Core\Recipe\RecipeRunner;
use Drupal\editor\Entity\Editor;
use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait;
use Drupal\KernelTests\KernelTestBase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\TestWith;

/**
 * @covers \Drupal\ckeditor5\Plugin\ConfigAction\AddItemToToolbar
 * @group ckeditor5
 * @group Recipe
 * Tests add item to toolbar config action.
 */
#[CoversClass(AddItemToToolbar::class)]
#[Group('ckeditor5')]
#[Group('Recipe')]
class AddItemToToolbarConfigActionTest extends KernelTestBase {

  use RecipeTestTrait;
@@ -60,18 +65,22 @@ protected function setUp(): void {
  }

  /**
   * Tests add item to toolbar.
   *
   * @param string|array<string, mixed> $action
   *   The value to pass to the config action.
   * @param string[] $expected_toolbar_items
   *   The items which should be in the editor toolbar, in the expected order.
   *
   * @testWith ["sourceEditing", ["heading", "bold", "italic", "sourceEditing"]]
   *   [{"item_name": "sourceEditing"}, ["heading", "bold", "italic", "sourceEditing"]]
   *   [{"item_name": "sourceEditing", "position": 1}, ["heading", "sourceEditing", "bold", "italic"]]
   *   [{"item_name": "sourceEditing", "position": 1, "replace": true}, ["heading", "sourceEditing", "italic"]]
   *   [{"item_name": "bold"}, ["heading", "bold", "italic"]]
   *   [{"item_name": "bold", "allow_duplicate": true}, ["heading", "bold", "italic", "bold"]]
   */
  #[TestWith(["sourceEditing", ["heading", "bold", "italic", "sourceEditing"]])]
  #[TestWith([["item_name" => "sourceEditing"], ["heading", "bold", "italic", "sourceEditing"]])]
  #[TestWith([["item_name" => "sourceEditing", "position" => 1], ["heading", "sourceEditing", "bold", "italic"]])]
  #[TestWith([
    ["item_name" => "sourceEditing", "position" => 1, "replace" => TRUE],
    ["heading", "sourceEditing", "italic"],
  ])]
  #[TestWith([["item_name" => "bold"], ["heading", "bold", "italic"]])]
  #[TestWith([["item_name" => "bold", "allow_duplicate" => TRUE], ["heading", "bold", "italic", "bold"]])]
  public function testAddItemToToolbar(string|array $action, array $expected_toolbar_items): void {
    $recipe = $this->createRecipe([
      'name' => 'CKEditor 5 toolbar item test',
+39 −16
Changes for core/modules/editor/tests/src/Kernel/EditorValidationTest.php: 39 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -8,12 +8,13 @@
use Drupal\editor\Entity\Editor;
use Drupal\filter\Entity\FilterFormat;
use Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\TestWith;

/**
 * Tests validation of editor entities.
 *
 * @group editor
 */
#[Group('editor')]
class EditorValidationTest extends ConfigEntityValidationTestBase {

  /**
@@ -204,21 +205,43 @@ public function testImageUploadSettingsAreDynamicallyRequired(): void {
  }

  /**
   * @testWith [{"scheme": "public"}, {}]
   *           [{"scheme": "private"}, {"image_upload.scheme": "The file storage you selected is not a visible, readable and writable stream wrapper. Possible choices: <em class=\"placeholder\">&quot;public&quot;</em>."}]
   *           [{"directory": null}, {}]
   *           [{"directory": ""}, {"image_upload.directory": "This value should not be blank."}]
   *           [{"directory": "inline\nimages"}, {"image_upload.directory": "The image upload directory is not allowed to span multiple lines or contain control characters."}]
   *           [{"directory": "foo\b\b\binline-images"}, {"image_upload.directory": "The image upload directory is not allowed to span multiple lines or contain control characters."}]
   *           [{"max_size": null}, {}]
   *           [{"max_size": "foo"}, {"image_upload.max_size": "This value must be a number of bytes, optionally with a unit such as \"MB\" or \"megabytes\". <em class=\"placeholder\">foo</em> does not represent a number of bytes."}]
   *           [{"max_size": ""}, {"image_upload.max_size": "This value must be a number of bytes, optionally with a unit such as \"MB\" or \"megabytes\". <em class=\"placeholder\"></em> does not represent a number of bytes."}]
   *           [{"max_size": "7 exabytes"}, {}]
   *           [{"max_dimensions": {"width": null, "height": 15}}, {}]
   *           [{"max_dimensions": {"width": null, "height": null}}, {}]
   *           [{"max_dimensions": {"width": null, "height": 0}}, {"image_upload.max_dimensions.height": "This value should be between <em class=\"placeholder\">1</em> and <em class=\"placeholder\">99999</em>."}]
   *           [{"max_dimensions": {"width": 100000, "height": 1}}, {"image_upload.max_dimensions.width": "This value should be between <em class=\"placeholder\">1</em> and <em class=\"placeholder\">99999</em>."}]
   * Tests image upload settings validation.
   */
  #[TestWith([["scheme" => "public"], []])]
  #[TestWith([
    ["scheme" => "private"],
    ["image_upload.scheme" => "The file storage you selected is not a visible, readable and writable stream wrapper. Possible choices: <em class=\"placeholder\">&quot;public&quot;</em>."],
  ])]
  #[TestWith([["directory" => NULL], []])]
  #[TestWith([["directory" => ""], ["image_upload.directory" => "This value should not be blank."]])]
  #[TestWith([
    ["directory" => "inline\nimages"],
    ["image_upload.directory" => "The image upload directory is not allowed to span multiple lines or contain control characters."],
  ])]
  #[TestWith([
    ["directory" => "foo\t\t\tinline-images"],
    ["image_upload.directory" => "The image upload directory is not allowed to span multiple lines or contain control characters."],
  ])]
  #[TestWith([["max_size" => NULL], []])]
  #[TestWith([
    ["max_size" => "foo"],
    ["image_upload.max_size" => "This value must be a number of bytes, optionally with a unit such as \"MB\" or \"megabytes\". <em class=\"placeholder\">foo</em> does not represent a number of bytes."],
  ])]
  #[TestWith([
    ["max_size" => ""],
    ["image_upload.max_size" => "This value must be a number of bytes, optionally with a unit such as \"MB\" or \"megabytes\". <em class=\"placeholder\"></em> does not represent a number of bytes."],
  ])]
  #[TestWith([["max_size" => "7 exabytes"], []])]
  #[TestWith([["max_dimensions" => ["width" => NULL, "height" => 15]], []])]
  #[TestWith([["max_dimensions" => ["width" => NULL, "height" => NULL]], []])]
  #[TestWith([
    ["max_dimensions" => ["width" => NULL, "height" => 0]],
    ["image_upload.max_dimensions.height" => "This value should be between <em class=\"placeholder\">1</em> and <em class=\"placeholder\">99999</em>."],
  ])]
  #[TestWith([
    ["max_dimensions" => ["width" => 100000, "height" => 1]],
    ["image_upload.max_dimensions.width" => "This value should be between <em class=\"placeholder\">1</em> and <em class=\"placeholder\">99999</em>."],
  ])]
  public function testImageUploadSettingsValidation(array $invalid_setting, array $expected_message): void {
    $this->entity->setImageUploadSettings($invalid_setting + [
      'status' => TRUE,
Loading