PhpUnitBridgeTest.php

Same filename in this branch
  1. 9 core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
  2. 9 core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php
Same filename in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php
  2. 8.9.x core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
  3. 8.9.x core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php
  4. 10 core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php
  5. 10 core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
  6. 10 core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php
  7. 11.x core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php
  8. 11.x core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
  9. 11.x core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php

Namespace

Drupal\KernelTests\Core\Test

File

core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php

View source
<?php

namespace Drupal\KernelTests\Core\Test;

use Drupal\KernelTests\KernelTestBase;
use Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass;

/**
 * Test how kernel tests interact with deprecation errors.
 *
 * @group Test
 * @group legacy
 */
class PhpUnitBridgeTest extends KernelTestBase {
    protected static $modules = [
        'deprecation_test',
    ];
    public function testDeprecatedClass() {
        $this->expectDeprecation('Drupal\\deprecation_test\\Deprecation\\FixtureDeprecatedClass is deprecated.');
        $deprecated = new FixtureDeprecatedClass();
        $this->assertEquals('test', $deprecated->testFunction());
    }
    public function testDeprecatedFunction() {
        $this->expectDeprecation('This is the deprecation message for deprecation_test_function().');
        $this->assertEquals('known_return_value', \deprecation_test_function());
    }

}

Classes

Title Deprecated Summary
PhpUnitBridgeTest Test how kernel tests interact with deprecation errors.

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