function LegacyFileTest::testFileUsageBaseConstruct

Tests passing legacy arguments to FileUsageBase::__construct().

@expectedDeprecation Not passing the $config_factory parameter to Drupal\file\FileUsage\FileUsageBase::__construct is deprecated in drupal:8.4.0 and will trigger a fatal error in drupal:9.0.0. See https://www.drupal.org/project/drupal/issues/2801777

Throws

\ReflectionException

File

core/modules/file/tests/src/Unit/LegacyFileTest.php, line 46

Class

LegacyFileTest
Provides unit tests for file module deprecation errors.

Namespace

Drupal\Tests\file\Unit

Code

public function testFileUsageBaseConstruct() {
    $test_file_usage = new TestFileUsage();
    $reflection = new \ReflectionObject($test_file_usage);
    $config = $reflection->getProperty('configFactory');
    $config->setAccessible(TRUE);
    $this->assertSame($this->configFactory, $config->getValue($test_file_usage));
}

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