Problem/Motivation

The trait \Drupal\config\Tests\SchemaCheckTestTrait doesn't belong into the config namespace, but rather into core/tests/Drupal/Tests

Proposed resolution

Let's move it there, but keep the old one as alias.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Issue tags: +Novice
legovaer’s picture

@dawehner,

I've been looking into this issue. But we're using this Trait in about 73 different places. What do you exactly mean with "let's keep the old one as an alias"? Should we copy the existing trait to the new location and keep the old file in the place where it now is? This will introduce code duplication, right?

tim.plunkett’s picture

<?php
namespace Drupal\Core\Config\Schema {
    trait OldTrait {
        public function thing() {
        }
    }
}

namespace Drupal\Tests {
    trait NewTrait {
        use \Drupal\Core\Config\Schema\OldTrait;
    }
}

namespace {
    class Foo {
        use \Drupal\Tests\NewTrait;
    }
}
legovaer’s picture

Status: Active » Needs review
FileSize
5.02 KB

Thanks for the help #5!

Status: Needs review » Needs work

The last submitted patch, 6: move-trait-2795045-6.patch, failed testing.

legovaer’s picture

Used the example of #5 a bit too literally.

dawehner’s picture

Status: Needs work » Needs review
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice, so this is really just a move!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: move-trait-2795045-8.patch, failed testing.

legovaer’s picture

What? How & why?

dawehner’s picture

Status: Needs work » Reviewed & tested by the community

Sometimes there is some hidden reason. Its certainly not your fault :)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/config/src/Tests/SchemaCheckTestTrait.php
@@ -2,58 +2,11 @@
 /**
  * Provides a class for checking configuration schema.
  */

The original trait needs a deprecation notice and we should update core usages here too.

kmoll’s picture

Assigned: Unassigned » kmoll
kmoll’s picture

I have added the deprecated message and updated all core usages to use the new namespace.

kmoll’s picture

Status: Needs work » Needs review
kmoll’s picture

Assigned: kmoll » Unassigned
Robin Monks’s picture

Status: Needs review » Reviewed & tested by the community

Applied this match and ran all PHPUnit tests locally (which technically is just doing my human hands what testbot already did), and can confirm it works.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x, thanks!

  • catch committed 235bfca on 8.3.x
    Issue #2795045 by legovaer, kmoll: Make SchemaCheckTestTrait available...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.