PhpUnitBridgeTest.php

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

Namespace

Drupal\Tests\Core\Test

File

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

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Test;

use Drupal\Tests\UnitTestCase;
use Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass;

/**
 * Test how unit tests interact with deprecation errors.
 *
 * @group Test
 * @group legacy
 */
class PhpUnitBridgeTest extends UnitTestCase {
    
    /**
     * Tests class-level deprecation.
     */
    public function testDeprecatedClass() : void {
        $this->expectDeprecation('Drupal\\deprecation_test\\Deprecation\\FixtureDeprecatedClass is deprecated.');
        $deprecated = new FixtureDeprecatedClass();
        $this->assertEquals('test', $deprecated->testFunction());
    }
    public function testDeprecatedFunction() : void {
        $this->markTestIncomplete('Modules are not loaded for unit tests, so deprecated_test_function() will not be available.');
        $this->assertEquals('known_return_value', \deprecation_test_function());
    }

}

Classes

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

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