ServiceDeprecationTest.php in Drupal 9
File
core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php
View source
<?php
namespace Drupal\FunctionalTests\Core\Container;
use Drupal\Tests\BrowserTestBase;
class ServiceDeprecationTest extends BrowserTestBase {
protected static $modules = [
'deprecation_test',
];
protected $defaultTheme = 'stark';
public function testGetDeprecated() {
$this
->expectDeprecation('The "deprecation_test.service" service is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test.');
$this
->expectDeprecation('The "deprecation_test.alias" alias is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test.');
\Drupal::service('deprecation_test.service');
\Drupal::service('deprecation_test.alias');
}
}