Issue #3427178 by mondrake, longwave: Replace calls to ::expectWarning*() from Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest
parent
26e9f32dfa
commit
c8cfcf07a8
|
@ -2221,18 +2221,6 @@ $ignoreErrors[] = [
|
|||
'count' => 1,
|
||||
'path' => __DIR__ . '/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php',
|
||||
];
|
||||
$ignoreErrors[] = [
|
||||
'message' => '#^Call to deprecated method expectWarning\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
|
||||
https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#',
|
||||
'count' => 1,
|
||||
'path' => __DIR__ . '/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php',
|
||||
];
|
||||
$ignoreErrors[] = [
|
||||
'message' => '#^Call to deprecated method expectWarningMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
|
||||
https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#',
|
||||
'count' => 1,
|
||||
'path' => __DIR__ . '/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php',
|
||||
];
|
||||
$ignoreErrors[] = [
|
||||
'message' => '#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#',
|
||||
'count' => 1,
|
||||
|
|
|
@ -37,7 +37,6 @@ trait DoTrustedCallbackTrait {
|
|||
* @param string $error_type
|
||||
* (optional) The type of error to trigger. One of:
|
||||
* - TrustedCallbackInterface::THROW_EXCEPTION
|
||||
* - TrustedCallbackInterface::TRIGGER_WARNING
|
||||
* - TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION
|
||||
* Defaults to TrustedCallbackInterface::THROW_EXCEPTION.
|
||||
* @param string $extra_trusted_interface
|
||||
|
@ -99,9 +98,6 @@ trait DoTrustedCallbackTrait {
|
|||
if ($error_type === TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION) {
|
||||
@trigger_error($message, E_USER_DEPRECATED);
|
||||
}
|
||||
elseif ($error_type === TrustedCallbackInterface::TRIGGER_WARNING) {
|
||||
trigger_error($message, E_USER_WARNING);
|
||||
}
|
||||
else {
|
||||
throw new UntrustedCallbackException($message);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ class StaticTrustedCallbackHelper {
|
|||
* @param string $error_type
|
||||
* (optional) The type of error to trigger. One of:
|
||||
* - TrustedCallbackInterface::THROW_EXCEPTION
|
||||
* - TrustedCallbackInterface::TRIGGER_WARNING
|
||||
* - TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION
|
||||
* Defaults to TrustedCallbackInterface::THROW_EXCEPTION.
|
||||
* @param string $extra_trusted_interface
|
||||
|
|
|
@ -14,11 +14,6 @@ interface TrustedCallbackInterface {
|
|||
*/
|
||||
const THROW_EXCEPTION = 'exception';
|
||||
|
||||
/**
|
||||
* Untrusted callbacks trigger E_USER_WARNING errors.
|
||||
*/
|
||||
const TRIGGER_WARNING = 'warning';
|
||||
|
||||
/**
|
||||
* Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
|
||||
*/
|
||||
|
|
|
@ -87,15 +87,6 @@ class DoTrustedCallbackTraitTest extends UnitTestCase {
|
|||
$this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider errorTypeProvider
|
||||
*/
|
||||
public function testWarning($callback) {
|
||||
$this->expectWarning();
|
||||
$this->expectWarningMessage('Drupal\Tests\Core\Security\UntrustedObject::callback is not trusted');
|
||||
$this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::TRIGGER_WARNING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for tests of ::doTrustedCallback $error_type argument.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue