Change @expectException with $this->expectException.

This commit is contained in:
Wilmer Arambula
2024-03-20 18:49:27 -03:00
parent ae7db0aaee
commit aec3b79e6d
4 changed files with 8 additions and 14 deletions

View File

@ -215,19 +215,15 @@ class FixtureControllerTest extends DatabaseTestCase
$this->assertEmpty(FixtureStorage::$firstFixtureData, 'first fixture data should not be loaded'); $this->assertEmpty(FixtureStorage::$firstFixtureData, 'first fixture data should not be loaded');
} }
/**
* @expectedException \yii\console\Exception
*/
public function testNoFixturesWereFoundInLoad() public function testNoFixturesWereFoundInLoad()
{ {
$this->expectException('\yii\console\Exception');
$this->_fixtureController->actionLoad(['NotExistingFixture']); $this->_fixtureController->actionLoad(['NotExistingFixture']);
} }
/**
* @expectedException \yii\console\Exception
*/
public function testNoFixturesWereFoundInUnload() public function testNoFixturesWereFoundInUnload()
{ {
$this->expectException('\yii\console\Exception');
$this->_fixtureController->actionUnload(['NotExistingFixture']); $this->_fixtureController->actionUnload(['NotExistingFixture']);
} }

View File

@ -323,7 +323,7 @@ CODE;
$output = $this->runMigrateControllerAction('new'); $output = $this->runMigrateControllerAction('new');
$this->assertSame(ExitCode::OK, $this->getExitCode()); $this->assertSame(ExitCode::OK, $this->getExitCode());
$this->assertNotContains('_test_new1', $output); $this->assertStringNotContainsString('_test_new1', $output);
} }
public function testMark() public function testMark()
@ -418,7 +418,7 @@ CODE;
$this->assertSame(ExitCode::OK, $this->getExitCode()); $this->assertSame(ExitCode::OK, $this->getExitCode());
$files = FileHelper::findFiles($this->migrationPath); $files = FileHelper::findFiles($this->migrationPath);
$fileContent = file_get_contents($files[0]); $fileContent = file_get_contents($files[0]);
$this->assertNotContains("namespace {$this->migrationNamespace};", $fileContent); $this->assertStringNotContainsString("namespace {$this->migrationNamespace};", $fileContent);
} }
/** /**

View File

@ -619,8 +619,7 @@ SQL;
* Test INSERT INTO ... SELECT SQL statement with wrong query object. * Test INSERT INTO ... SELECT SQL statement with wrong query object.
* *
* @dataProvider invalidSelectColumns * @dataProvider invalidSelectColumns
* @expectedException \yii\base\InvalidParamException *
* @expectedExceptionMessage Expected select query object with enumerated (named) parameters
* @param mixed $invalidSelectColumns * @param mixed $invalidSelectColumns
*/ */
public function testInsertSelectFailed($invalidSelectColumns) public function testInsertSelectFailed($invalidSelectColumns)
@ -634,6 +633,8 @@ SQL;
$this->expectException(\yii\base\InvalidArgumentException::class); $this->expectException(\yii\base\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected select query object with enumerated (named) parameters'); $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(); $command->insert('{{customer}}', $query)->execute();
} }

View File

@ -224,9 +224,6 @@ abstract class ConnectionTest extends DatabaseTestCase
$this->assertTrue(true); // should not be any exception so far $this->assertTrue(true); // should not be any exception so far
} }
/**
* @expectedException \Exception
*/
public function testTransactionShortcutException() public function testTransactionShortcutException()
{ {
$connection = $this->getConnection(true); $connection = $this->getConnection(true);