Verified Commit 94bbf469 authored by Dave Long's avatar Dave Long
Browse files

test: #3554872 Remove test framework code related to no longer used symfony/phpunit-bridge

By: mondrake
By: dcam
By: andypost
(cherry picked from commit bd810962)
parent f1b477d7
Loading
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -46,8 +46,7 @@ public function __invoke() {
                  if (count($parameters) === 3) {
                    if ($parameters[1] === 'User deprecated function') {
                      // Fire the same deprecation message to allow it to be
                      // collected by
                      // \Drupal\TestTools\Extension\DeprecationBridge\DeprecationHandler::collectActualDeprecation().
                      // collected by PHPUnit.
                      // phpcs:ignore Drupal.Semantics.FunctionTriggerError
                      @trigger_error((string) $parameters[0], E_USER_DEPRECATED);
                    }
+0 −31
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\deprecation_test\Deprecation;

// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error(__NAMESPACE__ . '\DrupalStandardsListenerDeprecatedClass is deprecated.', E_USER_DEPRECATED);

/**
 * Fixture class for use by DrupalStandardsListenerDeprecationTest.
 *
 * This class is arbitrarily deprecated in order to test the deprecation error
 * handling properties of DrupalStandardsListener.
 *
 * @see \Drupal\Tests\Core\Listeners\DrupalStandardsListenerDeprecationTest
 * @see \Drupal\Tests\Listeners\DrupalStandardsListener::endTest()
 */
class DrupalStandardsListenerDeprecatedClass {

  /**
   * Returns a known value.
   *
   * @return string
   *   A known return value.
   */
  public function testFunction() {
    return 'test';
  }

}
+3 −6
Original line number Diff line number Diff line
@@ -8,13 +8,10 @@
@trigger_error(__NAMESPACE__ . '\FixtureDeprecatedClass is deprecated.', E_USER_DEPRECATED);

/**
 * Fixture class for use by DrupalStandardsListenerDeprecationTest.
 * Fixture for Drupal\FunctionalTests\Core\Container\ServiceDeprecationTest.
 *
 * This class is arbitrarily deprecated in order to test the deprecation error
 * handling properties of DrupalStandardsListener.
 *
 * @see \Drupal\Tests\Core\Listeners\DrupalStandardsListenerDeprecationTest
 * @see \Drupal\Tests\Listeners\DrupalStandardsListener::endTest()
 * This class is arbitrarily deprecated in order to test container service
 * deprecations.
 */
class FixtureDeprecatedClass {

+21 −0
Original line number Diff line number Diff line
@@ -18,12 +18,16 @@
use PHPUnit\Framework\ExpectationFailedException;

// cspell:ignore htkey

/**
 * Tests BrowserTestBase functionality.
 *
 * @final
 */
#[Group('browsertestbase')]
#[RunTestsInSeparateProcesses]
class BrowserTestBaseTest extends BrowserTestBase {

  use PathAliasTestTrait;
  use CronRunTrait;

@@ -35,6 +39,7 @@ class BrowserTestBaseTest extends BrowserTestBase {
    'form_test',
    'system_test',
    'node',
    'deprecation_test',
  ];

  /**
@@ -603,6 +608,22 @@ public function testDeprecationHeaders(): void {
    $this->assertCount(1, $test_deprecation_messages);
  }

  /**
   * Tests deprecation message from deprecated route.
   *
   * This test verifies that TestHttpClientMiddleware is properly re-throwing
   * deprecations occurred in the SUT and collected in the response header.
   *
   * @see \Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware
   * @see _drupal_error_handler
   * @see _drupal_error_handler_real
   */
  #[IgnoreDeprecations]
  public function testDeprecationTriggeredInSystemUnderTest(): void {
    $this->expectUserDeprecationMessage('This is the deprecation message for deprecation_test_function().');
    $this->drupalGet(Url::fromRoute('deprecation_test.route'));
  }

  /**
   * Tests the dump() function provided by the var-dumper Symfony component.
   */
+0 −47
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\FunctionalTests\Core\Test;

use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests Drupal's extension to manage code deprecation.
 */
#[Group('Test')]
#[IgnoreDeprecations]
#[RunTestsInSeparateProcesses]
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'));
  }

}
Loading