Skip to content

Commit 0533e6f

Browse files
authored
Merge pull request #4346 from mvorisek/improve_cs
Minor CS improvement - use ::class for TestCase::expectException input
2 parents 11fead5 + 6ef95b6 commit 0533e6f

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Doctrine\DBAL\Types\Type;
1818
use Doctrine\Tests\DbalTestCase;
1919
use Doctrine\Tests\Types\CommentedType;
20+
use InvalidArgumentException;
2021

2122
use function get_class;
2223
use function implode;
@@ -84,7 +85,7 @@ public static function getReturnsForeignKeyReferentialActionSQL(): iterable
8485

8586
public function testGetInvalidForeignKeyReferentialActionSQL(): void
8687
{
87-
$this->expectException('InvalidArgumentException');
88+
$this->expectException(InvalidArgumentException::class);
8889
$this->platform->getForeignKeyReferentialActionSQL('unknown');
8990
}
9091

tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Doctrine\DBAL\Platforms\AbstractPlatform;
66
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
77
use Doctrine\DBAL\Schema\Index;
8+
use UnexpectedValueException;
89

910
class SQLAnywhere16PlatformTest extends SQLAnywhere12PlatformTest
1011
{
@@ -64,7 +65,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL(): void
6465

6566
public function testThrowsExceptionOnInvalidWithNullsNotDistinctIndexOptions(): void
6667
{
67-
$this->expectException('UnexpectedValueException');
68+
$this->expectException(UnexpectedValueException::class);
6869

6970
$this->platform->getCreateIndexSQL(
7071
new Index(

tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Doctrine\DBAL\Sharding\PoolingShardConnection;
77
use Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser;
88
use Doctrine\DBAL\Sharding\ShardingException;
9+
use InvalidArgumentException;
910
use PHPUnit\Framework\TestCase;
1011
use stdClass;
1112

@@ -50,7 +51,7 @@ public function testConnect(): void
5051

5152
public function testNoGlobalServerException(): void
5253
{
53-
$this->expectException('InvalidArgumentException');
54+
$this->expectException(InvalidArgumentException::class);
5455
$this->expectExceptionMessage("Connection Parameters require 'global' and 'shards' configurations.");
5556

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

6768
public function testNoShardsServersException(): void
6869
{
69-
$this->expectException('InvalidArgumentException');
70+
$this->expectException(InvalidArgumentException::class);
7071
$this->expectExceptionMessage("Connection Parameters require 'global' and 'shards' configurations.");
7172

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

8081
public function testNoShardsChoserException(): void
8182
{
82-
$this->expectException('InvalidArgumentException');
83+
$this->expectException(InvalidArgumentException::class);
8384
$this->expectExceptionMessage("Missing Shard Choser configuration 'shardChoser'");
8485

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

9697
public function testShardChoserWrongInstance(): void
9798
{
98-
$this->expectException('InvalidArgumentException');
99+
$this->expectException(InvalidArgumentException::class);
99100
$this->expectExceptionMessage(
100101
"The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser"
101102
);
@@ -114,7 +115,7 @@ public function testShardChoserWrongInstance(): void
114115

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

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

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

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

147148
public function testDuplicateShardId(): void
148149
{
149-
$this->expectException('InvalidArgumentException');
150+
$this->expectException(InvalidArgumentException::class);
150151
$this->expectExceptionMessage('Shard 1 is duplicated in the configuration.');
151152

152153
DriverManager::getConnection([

0 commit comments

Comments
 (0)