PhpUnitBridgeTest.php in Drupal 10        
                          
                  
                        
  
  
  
  
File
  core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
  
    View source  
  <?php
namespace Drupal\FunctionalTests\Core\Test;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class PhpUnitBridgeTest extends BrowserTestBase {
  protected static $modules = [
    'deprecation_test',
  ];
  
  protected $defaultTheme = 'stark';
  
  public function testSilencedError() {
    $this
      ->expectDeprecation('This is the deprecation message for deprecation_test_function().');
    $this
      ->assertEquals('known_return_value', deprecation_test_function());
  }
  
  public function testErrorOnSiteUnderTest() {
    $this
      ->expectDeprecation('This is the deprecation message for deprecation_test_function().');
    $this
      ->drupalGet(Url::fromRoute('deprecation_test.route'));
  }
}