ExpectDeprecationTest.php 961 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php

namespace Drupal\Tests;

use Drupal\Tests\Traits\ExpectDeprecationTrait;

/**
 * @coversDefaultClass \Drupal\Tests\Traits\ExpectDeprecationTrait
 *
 * @group Test
 * @group legacy
 */
class ExpectDeprecationTest extends UnitTestCase {
  use ExpectDeprecationTrait;

  /**
17
   * @covers ::addExpectedDeprecationMessage
18 19
   */
  public function testExpectDeprecation() {
20
    $this->addExpectedDeprecationMessage('Test deprecation');
21 22 23
    @trigger_error('Test deprecation', E_USER_DEPRECATED);
  }

24
  /**
25
   * @covers ::addExpectedDeprecationMessage
26 27 28 29
   * @runInSeparateProcess
   * @preserveGlobalState disabled
   */
  public function testExpectDeprecationInIsolation() {
30 31
    $this->addExpectedDeprecationMessage('Test isolated deprecation');
    $this->addExpectedDeprecationMessage('Test isolated deprecation2');
32 33 34 35
    @trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
    @trigger_error('Test isolated deprecation2', E_USER_DEPRECATED);
  }

36
}