class ComposerDeprecationTest
Tests the deprecations in the Drupal\Core\Composer\Composer class.
@group Composer @coversDefaultClass \Drupal\Core\Composer\Composer
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait
- class \Drupal\Tests\Core\Composer\ComposerDeprecationTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of ComposerDeprecationTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Composer/ ComposerDeprecationTest.php, line 21
Namespace
Drupal\Tests\Core\ComposerView source
class ComposerDeprecationTest extends UnitTestCase {
/**
* @covers ::ensureHtaccess
* @group legacy
*/
public function testEnsureHtaccess() {
$event = $this->prophesize(Event::class);
$composer = $this->prophesize(ComposerClass::class);
$event->getComposer()
->willReturn($composer->reveal());
$config = $this->prophesize(Config::class);
$composer->getConfig()
->willReturn($config->reveal());
$this->expectDeprecation('Unsilenced deprecation: Calling Drupal\\Core\\Composer\\Composer::ensureHtaccess from composer.json is deprecated in drupal:9.5.0 and is removed from drupal:10.0.0. Any "scripts" section mentioning this in composer.json can be removed and replaced with the drupal/core-vendor-hardening Composer plugin, as needed. See https://www.drupal.org/node/3260624');
Composer::ensureHtaccess($event->reveal());
}
/**
* @covers ::vendorTestCodeCleanup
* @group legacy
*/
public function testVendorTestCodeCleanup() {
$event = $this->prophesize(PackageEvent::class);
$composer = $this->prophesize(ComposerClass::class);
$event->getComposer()
->willReturn($composer->reveal());
$config = $this->prophesize(Config::class);
$composer->getConfig()
->willReturn($config->reveal());
$operation = $this->prophesize(UpdateOperation::class);
$event->getOperation()
->willReturn($operation->reveal());
$package = $this->prophesize(Package::class);
$operation->getTargetPackage()
->willReturn($package->reveal());
$package->getName()
->willReturn('foo');
$package->getPrettyName()
->willReturn('foo');
$io = $this->prophesize(IOInterface::class);
$event->getIO()
->willReturn($io->reveal());
$this->expectDeprecation('Unsilenced deprecation: Calling Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup from composer.json is deprecated in drupal:9.5.0 and is removed from drupal:10.0.0. Any "scripts" section mentioning this in composer.json can be removed and replaced with the drupal/core-vendor-hardening Composer plugin, as needed. See https://www.drupal.org/node/3260624');
Composer::vendorTestCodeCleanup($event->reveal());
}
/**
* @covers ::removeTimeout
* @group legacy
*/
public function testRemoveTimeout() {
$this->expectDeprecation('Unsilenced deprecation: Calling Drupal\\Core\\Composer\\Composer::removeTimeout from composer.json is deprecated in drupal:9.5.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3260624');
Composer::removeTimeout();
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|---|
ComposerDeprecationTest::testEnsureHtaccess | public | function | @covers ::ensureHtaccess @group legacy |
||
ComposerDeprecationTest::testRemoveTimeout | public | function | @covers ::removeTimeout @group legacy |
||
ComposerDeprecationTest::testVendorTestCodeCleanup | public | function | @covers ::vendorTestCodeCleanup @group legacy |
||
PhpUnitWarnings::$deprecationWarnings | private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | ||
PhpUnitWarnings::addWarning | public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | ||
UnitTestCase::$randomGenerator | protected | property | The random generator. | ||
UnitTestCase::$root | protected | property | The app root. | 1 | |
UnitTestCase::assertArrayEquals | Deprecated | protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | ||
UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | ||
UnitTestCase::getConfigStorageStub | public | function | Returns a stub config storage that returns the supplied configuration. | ||
UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | ||
UnitTestCase::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | ||
UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | ||
UnitTestCase::randomMachineName | public | function | Generates a unique random string containing letters and numbers. | ||
UnitTestCase::setUp | protected | function | 338 | ||
UnitTestCase::setUpBeforeClass | public static | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.