PhpUnitBridgeTest.php

Same filename in this branch
  1. 11.x core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php
  2. 11.x core/tests/Drupal/Tests/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\FunctionalTests\Core\Test

File

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

View source
<?php

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

use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;

/**
 * Tests Drupal's extension to manage code deprecation.
 *
 * @group Test
 * @group legacy
 */
class PhpUnitBridgeTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'deprecation_test',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests deprecation message from deprecation_test_function().
     */
    public function testSilencedError() : void {
        $this->expectDeprecation('This is the deprecation message for deprecation_test_function().');
        $this->assertEquals('known_return_value', deprecation_test_function());
    }
    
    /**
     * Tests deprecation message from deprecated route.
     */
    public function testErrorOnSiteUnderTest() : void {
        $this->expectDeprecation('This is the deprecation message for deprecation_test_function().');
        $this->drupalGet(Url::fromRoute('deprecation_test.route'));
    }

}

Classes

Title Deprecated Summary
PhpUnitBridgeTest Tests Drupal's extension to manage code deprecation.

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