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');
}
/**
* @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']);
}

View File

@ -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);
}
/**

View File

@ -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();
}

View File

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