function DrupalComponentTest::testNoCoreInComponent

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/DrupalComponentTest.php \Drupal\Tests\Component\DrupalComponentTest::testNoCoreInComponent()
  2. 8.9.x core/tests/Drupal/Tests/Component/DrupalComponentTest.php \Drupal\Tests\Component\DrupalComponentTest::testNoCoreInComponent()
  3. 10 core/tests/Drupal/Tests/Component/DrupalComponentTest.php \Drupal\Tests\Component\DrupalComponentTest::testNoCoreInComponent()

Tests that classes in Component do not use any Core class.

File

core/tests/Drupal/Tests/Component/DrupalComponentTest.php, line 21

Class

DrupalComponentTest
General tests for \Drupal\Component that can't go anywhere else.

Namespace

Drupal\Tests\Component

Code

public function testNoCoreInComponent() : void {
    $component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/lib/Drupal/Component';
    foreach ($this->findPhpClasses($component_path) as $class) {
        $this->assertNoCoreUsage($class);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.