Skip to content

Commit

Permalink
Minot CS improvement - use ::class for TestCase::expectException input
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 14, 2020
1 parent d896d62 commit 6ef95b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DbalTestCase;
use Doctrine\Tests\Types\CommentedType;
use InvalidArgumentException;

use function get_class;
use function implode;
Expand Down Expand Up @@ -84,7 +85,7 @@ public static function getReturnsForeignKeyReferentialActionSQL(): iterable

public function testGetInvalidForeignKeyReferentialActionSQL(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->platform->getForeignKeyReferentialActionSQL('unknown');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Schema\Index;
use UnexpectedValueException;

class SQLAnywhere16PlatformTest extends SQLAnywhere12PlatformTest
{
Expand Down Expand Up @@ -64,7 +65,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL(): void

public function testThrowsExceptionOnInvalidWithNullsNotDistinctIndexOptions(): void
{
$this->expectException('UnexpectedValueException');
$this->expectException(UnexpectedValueException::class);

$this->platform->getCreateIndexSQL(
new Index(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Sharding\PoolingShardConnection;
use Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser;
use Doctrine\DBAL\Sharding\ShardingException;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use stdClass;

Expand Down Expand Up @@ -50,7 +51,7 @@ public function testConnect(): void

public function testNoGlobalServerException(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Connection Parameters require 'global' and 'shards' configurations.");

DriverManager::getConnection([
Expand All @@ -66,7 +67,7 @@ public function testNoGlobalServerException(): void

public function testNoShardsServersException(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Connection Parameters require 'global' and 'shards' configurations.");

DriverManager::getConnection([
Expand All @@ -79,7 +80,7 @@ public function testNoShardsServersException(): void

public function testNoShardsChoserException(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Missing Shard Choser configuration 'shardChoser'");

DriverManager::getConnection([
Expand All @@ -95,7 +96,7 @@ public function testNoShardsChoserException(): void

public function testShardChoserWrongInstance(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
"The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser"
);
Expand All @@ -114,7 +115,7 @@ public function testShardChoserWrongInstance(): void

public function testShardNonNumericId(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Shard Id has to be a non-negative number.');

DriverManager::getConnection([
Expand All @@ -130,7 +131,7 @@ public function testShardNonNumericId(): void

public function testShardMissingId(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Missing 'id' for one configured shard. Please specify a unique shard-id.");

DriverManager::getConnection([
Expand All @@ -146,7 +147,7 @@ public function testShardMissingId(): void

public function testDuplicateShardId(): void
{
$this->expectException('InvalidArgumentException');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Shard 1 is duplicated in the configuration.');

DriverManager::getConnection([
Expand Down

0 comments on commit 6ef95b6

Please sign in to comment.