function DrupalComponentTest::testAssertNoCoreUsage
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/DrupalComponentTest.php \Drupal\Tests\Component\DrupalComponentTest::testAssertNoCoreUsage()
- 10 core/tests/Drupal/Tests/Component/DrupalComponentTest.php \Drupal\Tests\Component\DrupalComponentTest::testAssertNoCoreUsage()
@covers \Drupal\Tests\Component\DrupalComponentTest::assertNoCoreUsage @dataProvider providerAssertNoCoreUsage
File
-
core/
tests/ Drupal/ Tests/ Component/ DrupalComponentTest.php, line 143
Class
- DrupalComponentTest
- General tests for \Drupal\Component that can't go anywhere else.
Namespace
Drupal\Tests\ComponentCode
public function testAssertNoCoreUsage($expected_pass, $file_data) : void {
// Set up a virtual file to read.
$vfs_root = vfsStream::setup('root');
vfsStream::newFile('Test.php')->at($vfs_root)
->setContent($file_data);
$file_uri = vfsStream::url('root/Test.php');
try {
$pass = TRUE;
$this->assertNoCoreUsage($file_uri);
} catch (AssertionFailedError) {
$pass = FALSE;
}
$this->assertEquals($expected_pass, $pass, $expected_pass ? 'Test caused a false positive' : 'Test failed to detect Core usage');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.