class ExpectDeprecationTest in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
 
@coversDefaultClass \Drupal\Tests\Traits\ExpectDeprecationTrait
@group Test @group legacy
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\ExpectDeprecationTest uses ExpectDeprecationTrait
 
 
Expanded class hierarchy of ExpectDeprecationTest
File
- core/
tests/ Drupal/ Tests/ ExpectDeprecationTest.php, line 13  
Namespace
Drupal\TestsView source
class ExpectDeprecationTest extends UnitTestCase {
  use ExpectDeprecationTrait;
  /**
   * @covers ::addExpectedDeprecationMessage
   */
  public function testExpectDeprecation() {
    $this
      ->addExpectedDeprecationMessage('Test deprecation');
    @trigger_error('Test deprecation', E_USER_DEPRECATED);
  }
  /**
   * @covers ::addExpectedDeprecationMessage
   * @runInSeparateProcess
   * @preserveGlobalState disabled
   */
  public function testExpectDeprecationInIsolation() {
    $this
      ->addExpectedDeprecationMessage('Test isolated deprecation');
    $this
      ->addExpectedDeprecationMessage('Test isolated deprecation2');
    @trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
    @trigger_error('Test isolated deprecation2', E_USER_DEPRECATED);
  }
  /**
   * @covers ::expectDeprecation
   *
   * @todo the expectedDeprecation annotation does not work if tests are marked
   *   skipped.
   * @see https://github.com/symfony/symfony/pull/25757
   */
  public function testDeprecatedExpectDeprecation() {
    $this
      ->addExpectedDeprecationMessage('ExpectDeprecationTrait::expectDeprecation is deprecated in drupal:8.8.5 and is removed from drupal:9.0.0. Use ::addExpectedDeprecationMessage() instead. See https://www.drupal.org/node/3106024');
    $this
      ->expectDeprecation('Test deprecated expectDeprecation');
    @trigger_error('Test deprecated expectDeprecation', E_USER_DEPRECATED);
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            ExpectDeprecationTest:: | 
                  public | function | @covers ::expectDeprecation | |
| 
            ExpectDeprecationTest:: | 
                  public | function | @covers ::addExpectedDeprecationMessage | |
| 
            ExpectDeprecationTest:: | 
                  public | function | @covers ::addExpectedDeprecationMessage @runInSeparateProcess @preserveGlobalState disabled | |
| 
            ExpectDeprecationTrait:: | 
                  protected | function | Sets an expected deprecation message. | |
| 
            ExpectDeprecationTrait:: | 
                  protected | function | Sets an expected deprecation message. | |
| 
            ExpectDeprecationTrait:: | 
                  public | function | Sets expected deprecation messages. | |
| 
            ExpectDeprecationTrait:: | 
                  private | function | Gets the SymfonyTestsListenerTrait. | |
| 
            PhpunitCompatibilityTrait:: | 
                  public | function | Returns a mock object for the specified class using the available method. | |
| 
            PhpunitCompatibilityTrait:: | 
                  public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
| 
            UnitTestCase:: | 
                  protected | property | The random generator. | |
| 
            UnitTestCase:: | 
                  protected | property | The app root. | 1 | 
| 
            UnitTestCase:: | 
                  protected | function | Asserts if two arrays are equal by sorting them first. | |
| 
            UnitTestCase:: | 
                  protected | function | Mocks a block with a block plugin. | 1 | 
| 
            UnitTestCase:: | 
                  protected | function | Returns a stub class resolver. | |
| 
            UnitTestCase:: | 
                  public | function | Returns a stub config factory that behaves according to the passed array. | |
| 
            UnitTestCase:: | 
                  public | function | Returns a stub config storage that returns the supplied configuration. | |
| 
            UnitTestCase:: | 
                  protected | function | Sets up a container with a cache tags invalidator. | |
| 
            UnitTestCase:: | 
                  protected | function | Gets the random generator for the utility methods. | |
| 
            UnitTestCase:: | 
                  public | function | Returns a stub translation manager that just returns the passed string. | |
| 
            UnitTestCase:: | 
                  public | function | Generates a unique random string containing letters and numbers. | |
| 
            UnitTestCase:: | 
                  protected | function | 340 |