diff --git a/tests/framework/console/controllers/FixtureControllerTest.php b/tests/framework/console/controllers/FixtureControllerTest.php index a7882d1f1a..ef44853b4e 100644 --- a/tests/framework/console/controllers/FixtureControllerTest.php +++ b/tests/framework/console/controllers/FixtureControllerTest.php @@ -215,19 +215,15 @@ class FixtureControllerTest extends DatabaseTestCase $this->assertEmpty(FixtureStorage::$firstFixtureData, 'first fixture data should not be loaded'); } - /** - * @expectedException \yii\console\Exception - */ public function testNoFixturesWereFoundInLoad() { + $this->expectException('\yii\console\Exception'); $this->_fixtureController->actionLoad(['NotExistingFixture']); } - /** - * @expectedException \yii\console\Exception - */ public function testNoFixturesWereFoundInUnload() { + $this->expectException('\yii\console\Exception'); $this->_fixtureController->actionUnload(['NotExistingFixture']); } diff --git a/tests/framework/console/controllers/MigrateControllerTestTrait.php b/tests/framework/console/controllers/MigrateControllerTestTrait.php index 046c512741..da3223764a 100644 --- a/tests/framework/console/controllers/MigrateControllerTestTrait.php +++ b/tests/framework/console/controllers/MigrateControllerTestTrait.php @@ -323,7 +323,7 @@ CODE; $output = $this->runMigrateControllerAction('new'); $this->assertSame(ExitCode::OK, $this->getExitCode()); - $this->assertNotContains('_test_new1', $output); + $this->assertStringNotContainsString('_test_new1', $output); } public function testMark() @@ -418,7 +418,7 @@ CODE; $this->assertSame(ExitCode::OK, $this->getExitCode()); $files = FileHelper::findFiles($this->migrationPath); $fileContent = file_get_contents($files[0]); - $this->assertNotContains("namespace {$this->migrationNamespace};", $fileContent); + $this->assertStringNotContainsString("namespace {$this->migrationNamespace};", $fileContent); } /** diff --git a/tests/framework/db/CommandTest.php b/tests/framework/db/CommandTest.php index 1817ff65b4..b888a7073d 100644 --- a/tests/framework/db/CommandTest.php +++ b/tests/framework/db/CommandTest.php @@ -619,8 +619,7 @@ SQL; * Test INSERT INTO ... SELECT SQL statement with wrong query object. * * @dataProvider invalidSelectColumns - * @expectedException \yii\base\InvalidParamException - * @expectedExceptionMessage Expected select query object with enumerated (named) parameters + * * @param mixed $invalidSelectColumns */ public function testInsertSelectFailed($invalidSelectColumns) @@ -634,6 +633,8 @@ SQL; $this->expectException(\yii\base\InvalidArgumentException::class); $this->expectExceptionMessage('Expected select query object with enumerated (named) parameters'); + $this->expectException('yii\base\InvalidParamException'); + $this->expectExceptionMessage('Expected select query object with enumerated (named) parameters'); $command->insert('{{customer}}', $query)->execute(); } diff --git a/tests/framework/db/ConnectionTest.php b/tests/framework/db/ConnectionTest.php index 663f611592..8b3a4f65d6 100644 --- a/tests/framework/db/ConnectionTest.php +++ b/tests/framework/db/ConnectionTest.php @@ -224,15 +224,12 @@ abstract class ConnectionTest extends DatabaseTestCase $this->assertTrue(true); // should not be any exception so far } - /** - * @expectedException \Exception - */ public function testTransactionShortcutException() { $connection = $this->getConnection(true); $this->expectException(\Exception::class); - + $connection->transaction(function () use ($connection) { $connection->createCommand()->insert('profile', ['description' => 'test transaction shortcut'])->execute(); throw new \Exception('Exception in transaction shortcut');