Commit 50a6a9ef authored by catch's avatar catch
Browse files

Issue #3060391 by mondrake, Mile23, Lendude, alexpott: Cleanup usage of PHPUnit 4.8 aliased classes

parent 1240a8a0
......@@ -7,7 +7,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Test\Exception\MissingGroupException;
use PHPUnit_Util_Test;
use PHPUnit\Util\Test;
/**
* Discovers available tests.
......@@ -418,14 +418,14 @@ public static function parseTestClassSummary($doc_comment) {
* - module: A list of Drupal module dependencies that are required to
* exist.
*
* @see PHPUnit_Util_Test::parseTestMethodAnnotations()
* @see \PHPUnit\Util\Test::parseTestMethodAnnotations()
* @see http://phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests-using-requires
*/
public static function parseTestClassAnnotations(\ReflectionClass $class) {
$annotations = PHPUnit_Util_Test::parseTestMethodAnnotations($class->getName())['class'];
$annotations = Test::parseTestMethodAnnotations($class->getName())['class'];
// @todo Enhance PHPUnit upstream to allow for custom @requires identifiers.
// @see PHPUnit_Util_Test::getRequirements()
// @see \PHPUnit\Util\Test::getRequirements()
// @todo Add support for 'PHP', 'OS', 'function', 'extension'.
// @see https://www.drupal.org/node/1273478
if (isset($annotations['requires'])) {
......
......@@ -24,7 +24,7 @@ class AggregatorPluginSettingsBaseTest extends UnitTestCase {
/**
* The stubbed config factory object.
*
* @var \PHPUnit_Framework_MockObject_MockBuilder
* @var \PHPUnit\Framework\MockObject\MockBuilder
*/
protected $configFactory;
......@@ -56,7 +56,7 @@ protected function setUp() {
->will($this->returnValue(['aggregator_test' => ['title' => '', 'description' => '']]));
}
/** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit_Framework_MockObject_MockBuilder $messenger */
/** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit\Framework\MockObject\MockBuilder $messenger */
$messenger = $this->createMock(MessengerInterface::class);
$messenger->expects($this->any())->method('addMessage');
......
......@@ -10,6 +10,7 @@
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use PHPUnit\Framework\AssertionFailedError;
/**
* Tests the new entity API for the date field type.
......@@ -255,7 +256,7 @@ public function testSetValueProperty() {
* @dataProvider datetimeValidationProvider
*/
public function testDatetimeValidation($value) {
$this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
$this->expectException(AssertionFailedError::class);
$this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATETIME);
$this->fieldStorage->save();
......@@ -315,7 +316,7 @@ public function datetimeValidationProvider() {
* @dataProvider dateonlyValidationProvider
*/
public function testDateonlyValidation($value) {
$this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
$this->expectException(AssertionFailedError::class);
$this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATE);
$this->fieldStorage->save();
......
......@@ -12,6 +12,7 @@
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\file\Entity\File;
use Drupal\user\Entity\Role;
use PHPUnit\Framework\Error\Warning;
/**
* Tests using entity fields of the image field type.
......@@ -153,7 +154,7 @@ public function testImageItemMalformed() {
$this->fail('Exception did not fail');
}
catch (EntityStorageException $exception) {
$this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $exception->getPrevious());
$this->assertInstanceOf(Warning::class, $exception->getPrevious());
$this->assertEquals($exception->getMessage(), 'Missing file with ID 9999.');
$this->assertEmpty($entity->image_test->width);
$this->assertEmpty($entity->image_test->height);
......
......@@ -46,7 +46,7 @@ class LocaleLookupTest extends UnitTestCase {
/**
* A mocked config factory built with UnitTestCase::getConfigFactoryStub().
*
* @var \Drupal\Core\Config\ConfigFactory|\PHPUnit_Framework_MockObject_MockBuilder
* @var \Drupal\Core\Config\ConfigFactory|\PHPUnit\Framework\MockObject\MockBuilder
*/
protected $configFactory;
......
......@@ -7,7 +7,7 @@
<testsuite name="Drupal\Tests\Core\Cache\NullBackendTest" file="/home/chx/www/system/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php" namespace="Drupal\Tests\Core\Cache" fullPackage="Drupal.Tests.Core.Cache" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/>
<testsuite name="Drupal\Tests\Core\Extension\ModuleHandlerUnitTest" file="/home/chx/www/system/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php" namespace="Drupal\Tests\Core\Extension" fullPackage="Drupal.Tests.Core.Extension" tests="1" assertions="0" failures="0" errors="1" time="0.002680">
<testcase name="testloadInclude" class="Drupal\Tests\Core\Extension\ModuleHandlerUnitTest" file="/home/chx/www/system/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php" line="37" assertions="0" time="0.002680">
<error type="PHPUnit_Framework_Error_Notice">Drupal\Tests\Core\Extension\ModuleHandlerUnitTest::testloadInclude
<error type="PHPUnit\Framework\Error\Notice">Drupal\Tests\Core\Extension\ModuleHandlerUnitTest::testloadInclude
Undefined index: foo
/home/chx/www/system/core/lib/Drupal/Core/Extension/ModuleHandler.php:219
......@@ -20,19 +20,19 @@ Undefined index: foo
<testsuite name="Drupal\Tests\Core\Route\RoleAccessCheckTest" file="/var/www/d8/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTestkTest.php" namespace="Drupal\Tests\Core\Route" fullPackage="Drupal.Tests.Core.Route" tests="3" assertions="3" failures="3" errors="0" time="0.009176">
<testsuite name="Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess" tests="3" assertions="3" failures="3" errors="0" time="0.009176">
<testcase name="testRoleAccess with data set #0" assertions="1" time="0.004519">
<failure type="PHPUnit_Framework_ExpectationFailedException">Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess with data set #0 ('role_test_1', array(Drupal\user\Entity\User, Drupal\user\Entity\User))
<failure type="PHPUnit\Framework\ExpectationFailedException">Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess with data set #0 ('role_test_1', array(Drupal\user\Entity\User, Drupal\user\Entity\User))
Access granted for user with the roles role_test_1 on path: role_test_1
Failed asserting that false is true.
</failure>
</testcase>
<testcase name="testRoleAccess with data set #1" assertions="1" time="0.002354">
<failure type="PHPUnit_Framework_ExpectationFailedException">Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess with data set #1 ('role_test_2', array(Drupal\user\Entity\User, Drupal\user\Entity\User))
<failure type="PHPUnit\Framework\ExpectationFailedException">Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess with data set #1 ('role_test_2', array(Drupal\user\Entity\User, Drupal\user\Entity\User))
Access granted for user with the roles role_test_2 on path: role_test_2
Failed asserting that false is true.
</failure>
</testcase>
<testcase name="testRoleAccess with data set #2" assertions="1" time="0.002303">
<failure type="PHPUnit_Framework_ExpectationFailedException">Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess with data set #2 ('role_test_3', array(Drupal\user\Entity\User))
<failure type="PHPUnit\Framework\ExpectationFailedException">Drupal\Tests\Core\Route\RoleAccessCheckTest::testRoleAccess with data set #2 ('role_test_3', array(Drupal\user\Entity\User))
Access granted for user with the roles role_test_1, role_test_2 on path: role_test_3
Failed asserting that false is true.
</failure>
......
......@@ -7,6 +7,7 @@
use Drupal\node\Entity\NodeType;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\RoleInterface;
use PHPUnit\Framework\ExpectationFailedException;
/**
* Tests breadcrumbs functionality.
......@@ -399,7 +400,7 @@ public function testAssertBreadcrumbTrait() {
$this->assertBreadcrumb('menu-test/breadcrumb1', []);
$this->fail($message);
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->assertTrue(TRUE, $message);
}
......@@ -409,7 +410,7 @@ public function testAssertBreadcrumbTrait() {
$this->assertBreadcrumb('menu-test/breadcrumb1', $home);
$this->fail($message);
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->assertTrue(TRUE, $message);
}
......@@ -426,7 +427,7 @@ public function testAssertBreadcrumbTrait() {
$this->assertBreadcrumb('menu-test/breadcrumb1', $trail);
$this->fail($message);
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->assertTrue(TRUE, $message);
}
}
......
......@@ -20,6 +20,7 @@
use Drupal\views\Plugin\views\pager\PagerPluginBase;
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views_test_data\Plugin\views\display\DisplayTest;
use PHPUnit\Framework\Error\Warning;
use Symfony\Component\HttpFoundation\Response;
/**
......@@ -201,7 +202,7 @@ public function testSetDisplayWithInvalidDisplay() {
$view->setDisplay('invalid');
$this->fail('Expected error, when setDisplay() called with invalid display ID');
}
catch (\PHPUnit_Framework_Error_Warning $e) {
catch (Warning $e) {
$this->assertEquals('setDisplay() called with invalid display ID "invalid".', $e->getMessage());
}
......
......@@ -20,7 +20,6 @@
use Drupal\simpletest\Form\SimpletestResultsForm;
use Drupal\Core\Test\TestDiscovery;
use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\Version;
use Symfony\Component\HttpFoundation\Request;
// Define some colors for display.
......@@ -144,14 +143,6 @@
exit(SIMPLETEST_SCRIPT_EXIT_SUCCESS);
}
// Ensure we have the correct PHPUnit version for the version of PHP.
if (class_exists('\PHPUnit_Runner_Version')) {
$phpunit_version = \PHPUnit_Runner_Version::id();
}
else {
$phpunit_version = Version::id();
}
$test_list = simpletest_script_get_test_list();
// Try to allocate unlimited time to run the tests.
......
......@@ -3,6 +3,7 @@
namespace Drupal\FunctionalJavascriptTests;
use Behat\Mink\Driver\GoutteDriver;
use PHPUnit\Framework\AssertionFailedError;
/**
* Tests if we can execute JavaScript in the browser.
......@@ -56,7 +57,7 @@ public function testAssertJsCondition() {
// We expected the following assertion to fail because the window has been
// re-sized to have a width of 500 not 400.
$this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
$this->expectException(AssertionFailedError::class);
$this->assertJsCondition($javascript, 100);
}
......
......@@ -168,7 +168,7 @@ protected function assertElementNotVisible($css_selector, $message = '') {
* (optional) A message to display with the assertion. If left blank, a
* default message will be displayed.
*
* @throws \PHPUnit_Framework_AssertionFailedError
* @throws \PHPUnit\Framework\AssertionFailedError
*
* @see \Behat\Mink\Driver\DriverInterface::evaluateScript()
*/
......
......@@ -8,6 +8,7 @@
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\CronRunTrait;
use PHPUnit\Framework\ExpectationFailedException;
/**
* Tests BrowserTestBase functionality.
......@@ -263,7 +264,7 @@ public function testXpathAsserts() {
$this->assertFieldByXPath("//input[@id = 'notexisting']");
$this->fail('The "notexisting" field was found.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('assertFieldByXPath correctly failed. The "notexisting" field was not found.');
}
......@@ -279,7 +280,7 @@ public function testXpathAsserts() {
$this->assertFieldsByValue($this->xpath("//input[@id = 'edit-name']"), 'not the value');
$this->fail('The "edit-name" field is found with the value "not the value".');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('The "edit-name" field is not found with the value "not the value".');
}
}
......@@ -320,7 +321,7 @@ public function testFieldAssertsForTextfields() {
$this->assertField('invalid_name_and_id');
$this->fail('The "invalid_name_and_id" field was found.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('assertField correctly failed. The "invalid_name_and_id" field was not found.');
}
......@@ -359,7 +360,7 @@ public function testFieldAssertsForTextfields() {
$this->assertFieldById('edit-name');
$this->fail('The "edit-name" field with no value was found.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('The "edit-name" field with no value was not found.');
}
......@@ -368,7 +369,7 @@ public function testFieldAssertsForTextfields() {
$this->assertFieldById('edit-name', 'not the value');
$this->fail('The "name" field was found, using the wrong value.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('The "name" field was not found, using the wrong value.');
}
......@@ -409,7 +410,7 @@ public function testFieldAssertsForTextfields() {
$this->assertFieldByName('non-existing-name');
$this->fail('The "non-existing-name" field was found.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('The "non-existing-name" field was not found');
}
......@@ -418,7 +419,7 @@ public function testFieldAssertsForTextfields() {
$this->assertFieldByName('name', 'not the value');
$this->fail('The "name" field with incorrect value was found.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass('assertFieldByName correctly failed. The "name" field with incorrect value was not found.');
}
......@@ -473,7 +474,7 @@ public function testFieldAssertsForOptions() {
$this->assertOptionSelected('options', 1);
$this->fail('The select option "1" was selected.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass($e->getMessage());
}
......@@ -492,7 +493,7 @@ public function testFieldAssertsForButton() {
$this->assertFieldById('Save', NULL);
$this->fail('The field with id of "Save" was found.');
}
catch (\PHPUnit_Framework_ExpectationFailedException $e) {
catch (ExpectationFailedException $e) {
$this->pass($e->getMessage());
}
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Config\PreExistingConfigException;
use Drupal\Core\Config\UnmetDependenciesException;
use Drupal\KernelTests\KernelTestBase;
use PHPUnit\Framework\Error\Warning;
/**
* Tests installation of configuration objects in installation functionality.
......@@ -257,7 +258,7 @@ public function testLanguage() {
* Tests installing configuration where the filename and ID do not match.
*/
public function testIdMisMatch() {
$this->expectException(\PHPUnit_Framework_Error_Warning::class);
$this->expectException(Warning::class);
$this->expectExceptionMessage('The configuration name "config_test.dynamic.no_id_match" does not match the ID "does_not_match"');
$this->installModules(['config_test_id_mismatch']);
}
......
......@@ -5,6 +5,7 @@
use Drupal\FunctionalTests\BrowserMissingDependentModuleMethodTest;
use Drupal\FunctionalTests\BrowserMissingDependentModuleTest;
use Drupal\KernelTests\KernelTestBase;
use PHPUnit\Framework\SkippedTestError;
/**
* @group Test
......@@ -36,7 +37,7 @@ public function testMethodRequiresModule() {
$stub_test->publicCheckRequirements();
$this->fail('Missing required module throws skipped test exception.');
}
catch (\PHPUnit_Framework_SkippedTestError $e) {
catch (SkippedTestError $e) {
$this->assertEqual('Required modules: module_does_not_exist', $e->getMessage());
}
}
......@@ -63,7 +64,7 @@ public function testRequiresModule() {
$stub_test->publicCheckRequirements();
$this->fail('Missing required module throws skipped test exception.');
}
catch (\PHPUnit_Framework_SkippedTestError $e) {
catch (SkippedTestError $e) {
$this->assertEqual('Required modules: module_does_not_exist', $e->getMessage());
}
}
......
......@@ -22,6 +22,7 @@
use Drupal\Tests\PhpunitCompatibilityTrait;
use Drupal\Tests\RandomGeneratorTrait;
use Drupal\Tests\TestRequirementsTrait;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Request;
......@@ -477,7 +478,7 @@ protected function initFileCache() {
* @return \Drupal\Core\Extension\Extension[]
* Extension objects for $modules, keyed by module name.
*
* @throws \PHPUnit_Framework_Exception
* @throws \PHPUnit\Framework\Exception
* If a module is not available.
*
* @see \Drupal\Tests\KernelTestBase::enableModules()
......@@ -490,7 +491,7 @@ private function getExtensionsForModules(array $modules) {
$list = $discovery->scan('module');
foreach ($modules as $name) {
if (!isset($list[$name])) {
throw new \PHPUnit_Framework_Exception("Unavailable module: '$name'. If this module needs to be downloaded separately, annotate the test class with '@requires module $name'.");
throw new Exception("Unavailable module: '$name'. If this module needs to be downloaded separately, annotate the test class with '@requires module $name'.");
}
$extensions[$name] = $list[$name];
}
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Database\Database;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\visitor\vfsStreamStructureVisitor;
use PHPUnit\Framework\SkippedTestError;
/**
* @coversDefaultClass \Drupal\KernelTests\KernelTestBase
......@@ -249,7 +250,7 @@ public function testMethodRequiresModule() {
$stub_test->publicCheckRequirements();
$this->fail('Missing required module throws skipped test exception.');
}
catch (\PHPUnit_Framework_SkippedTestError $e) {
catch (SkippedTestError $e) {
$this->assertEqual('Required modules: module_does_not_exist', $e->getMessage());
}
}
......@@ -276,7 +277,7 @@ public function testRequiresModule() {
$stub_test->publicCheckRequirements();
$this->fail('Missing required module throws skipped test exception.');
}
catch (\PHPUnit_Framework_SkippedTestError $e) {
catch (SkippedTestError $e) {
$this->assertEqual('Required modules: module_does_not_exist', $e->getMessage());
}
}
......
......@@ -25,12 +25,7 @@ class DiffOpTest extends TestCase {
* @covers ::reverse
*/
public function testReverse() {
if (method_exists($this, 'expectException')) {
$this->expectException(Error::class);
}
else {
$this->expectException(\PHPUnit_Framework_Error::class);
}
$this->expectException(Error::class);
$op = new DiffOp();
$result = $op->reverse();
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\Component;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\TestCase;
/**
......@@ -144,7 +145,7 @@ public function testAssertNoCoreUseage($expected_pass, $file_data) {
$pass = TRUE;
$this->assertNoCoreUsage($file_uri);
}
catch (\PHPUnit_Framework_AssertionFailedError $e) {
catch (AssertionFailedError $e) {
$pass = FALSE;
}
$this->assertEquals($expected_pass, $pass, $expected_pass ?
......
......@@ -99,14 +99,8 @@ public function testCreateDirectoryFailWarning() {
'bin' => 'test',
]);
$code = "<?php\n echo 'here';";
if (method_exists($this, 'expectException')) {
$this->expectException(Warning::class);
$this->expectExceptionMessage('mkdir(): Permission Denied');
}
else {
$this->expectException(\PHPUnit_Framework_Error_Warning::class);
$this->expectExceptionMessage('mkdir(): Permission Denied');
}
$this->expectException(Warning::class);
$this->expectExceptionMessage('mkdir(): Permission Denied');
$storage->save('subdirectory/foo.php', $code);
}
......
......@@ -9,7 +9,7 @@
use Drupal\FunctionalTests\AssertLegacyTrait;
use Drupal\Tests\UnitTestCase;
use Drupal\Tests\WebAssert;
use PHPUnit_Framework_ExpectationFailedException;
use PHPUnit\Framework\ExpectationFailedException;
/**
* @coversDefaultClass \Drupal\FunctionalTests\AssertLegacyTrait
......@@ -66,7 +66,7 @@ public function testAssertUniqueText() {
*/
public function testAssertUniqueTextFail() {
$this->page->getText()->willReturn('foo bar bar');
$this->expectException(PHPUnit_Framework_ExpectationFailedException::class);
$this->expectException(ExpectationFailedException::class);
$this->assertUniqueText('bar');
}
......@@ -75,7 +75,7 @@ public function testAssertUniqueTextFail() {
*/
public function testAssertUniqueTextUnknown() {
$this->page->getText()->willReturn('foo bar bar');
$this->expectException(PHPUnit_Framework_ExpectationFailedException::class);
$this->expectException(ExpectationFailedException::class);
$this->assertUniqueText('alice');
}
......@@ -102,7 +102,7 @@ public function testAssertNoUniqueText() {
*/
public function testAssertNoUniqueTextFail() {
$this->page->getText()->willReturn('foo bar bar');
$this->expectException(PHPUnit_Framework_ExpectationFailedException::class);
$this->expectException(ExpectationFailedException::class);
$this->assertNoUniqueText('foo');
}
......@@ -111,7 +111,7 @@ public function testAssertNoUniqueTextFail() {
*/
public function testAssertNoUniqueTextUnknown() {
$this->page->getText()->willReturn('foo bar bar');
$this->expectException(PHPUnit_Framework_ExpectationFailedException::class);
$this->expectException(ExpectationFailedException::class);
$this->assertNoUniqueText('alice');
}
......@@ -150,7 +150,7 @@ public function testAssertOptionSelectedFail() {
->optionExists('myselect', 'two')
->willReturn($option_field->reveal());
$this->expectException(PHPUnit_Framework_ExpectationFailedException::class);
$this->expectException(ExpectationFailedException::class);
$this->assertOptionSelected('myselect', 'two');
}
......
......@@ -7,6 +7,7 @@
use Drupal\Tests\UnitTestCase;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\ConfigValueException;
use PHPUnit\Framework\Error\Warning;
/**
* Tests the Config.
......@@ -269,7 +270,7 @@ public function testSetIllegalOffsetValue() {
$this->config->set('testData', 1);
// Attempt to treat the single value as a nested item.
$this->expectException(\PHPUnit_Framework_Error_Warning::class);
$this->expectException(Warning::class);
$this->config->set('testData.illegalOffset', 1);
}
......
......@@ -7,6 +7,7 @@
use Drupal\Core\Database\Query\PlaceholderInterface;
use Drupal\Tests\UnitTestCase;
use Prophecy\Argument;
use PHPUnit\Framework\Error\Error;
/**
* @coversDefaultClass \Drupal\Core\Database\Query\Condition
......@@ -161,7 +162,7 @@ public function testCompileWithSqlInjectionForOperator($operator) {
$condition = new Condition('AND');
$condition->condition('name', 'value', $operator);
$this->expectException(\PHPUnit_Framework_Error::class);
$this->expectException(Error::class);
$condition->compile($connection, $query_placeholder);
}
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Routing\TrustedRedirectResponse;
use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
use Drupal\Tests\UnitTestCase;
use PHPUnit\Framework\Error\Error;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -123,7 +124,7 @@ public function testDestinationRedirectToExternalUrl($request, $expected) {
$listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
$dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'checkRedirectUrl']);
$event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
$this->expectException(\PHPUnit_Framework_Error::class);
$this->expectException(Error::class);
$dispatcher->dispatch(KernelEvents::RESPONSE, $event);
}
......@@ -171,7 +172,7 @@ public function testDestinationRedirectWithInvalidUrl(Request $request) {
$listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
$dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'checkRedirectUrl']);
$event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
$this->expectException(\PHPUnit_Framework_Error::class);
$this->expectException(Error::class);
$dispatcher->dispatch(KernelEvents::RESPONSE, $event);
}
......
......@@ -5,6 +5,7 @@
use Drupal\Core\EventSubscriber\SpecialAttributesRouteSubscriber;
use Drupal\Core\Routing\RouteBuildEvent;
use Drupal\Tests\UnitTestCase;
use PHPUnit\Framework\Error\Warning;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
......@@ -98,7 +99,7 @@ public function testOnRouteBuildingInvalidVariables(Route $route) {