Verified Commit 29531e26 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3054072 by voleger, neclimdul, BR0kEN, arunkumark, Ratan Priya, Spokje,...

Issue #3054072 by voleger, neclimdul, BR0kEN, arunkumark, Ratan Priya, Spokje, yogeshmpawar, neeravbm, ravi.shankar, longwave, alexpott, catch, Krzysztof Domański: Deprecate \Drupal\Component\Assertion\Handle::register()
parent 2a9221d5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2,12 +2,17 @@

namespace Drupal\Component\Assertion;

trigger_error(__NAMESPACE__ . '\Handle is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use assert_options(ASSERT_EXCEPTION, TRUE). See https://drupal.org/node/3105918', E_USER_DEPRECATED);

/**
 * Handler for runtime assertion failures.
 *
 * @ingroup php_assert
 *
 * @todo Deprecate this class. https://www.drupal.org/node/3054072
 * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use
 *   assert_options(ASSERT_EXCEPTION, TRUE).
 *
 * @see https://www.drupal.org/node/3105918
 */
class Handle {

+2 −2
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Drupal\Core;

use Composer\Autoload\ClassLoader;
use Drupal\Component\Assertion\Handle;
use Drupal\Component\EventDispatcher\Event;
use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\Component\Utility\UrlHelper;
@@ -1020,7 +1019,8 @@ public static function bootEnvironment($app_root = NULL) {

        // Web tests are to be conducted with runtime assertions active.
        assert_options(ASSERT_ACTIVE, TRUE);
        Handle::register();
        // Force assertion failures to be thrown as exceptions.
        assert_options(ASSERT_EXCEPTION, TRUE);

        // Log fatal errors to the test site directory.
        ini_set('log_errors', 1);
+2 −4
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
 * @see phpunit.xml.dist
 */

use Drupal\Component\Assertion\Handle;
use Drupal\TestTools\PhpUnitCompatibility\ClassWriter;

/**
@@ -176,9 +175,8 @@ class_alias('\Drupal\Tests\DocumentElement', '\Behat\Mink\Element\DocumentElemen

// Runtime assertions. PHPUnit follows the php.ini assert.active setting for
// runtime assertions. By default this setting is on. Ensure exceptions are
// thrown if an assert fails, but this call does not turn runtime assertions on
// if they weren't on already.
Handle::register();
// thrown if an assert fails.
assert_options(ASSERT_EXCEPTION, TRUE);

// Ensure ignored deprecation patterns listed in .deprecation-ignore.txt are
// considered in testing.