Skip to content

Commit 16d449c

Browse files
authored
Merge pull request #3848 from BenMorel/expectException
expectException() is not static
2 parents 7f4ef4a + 8bded0b commit 16d449c

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

tests/Doctrine/Tests/DBAL/Cache/ArrayStatementTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public function testSetFetchModeThrowsInvalidArgumentException() : void
6363
{
6464
$statement = $this->createTestArrayStatement();
6565

66-
self::expectException(InvalidArgumentException::class);
67-
self::expectExceptionMessage('Caching layer does not support 2nd/3rd argument to setFetchMode().');
66+
$this->expectException(InvalidArgumentException::class);
67+
$this->expectExceptionMessage('Caching layer does not support 2nd/3rd argument to setFetchMode().');
6868

6969
$statement->setFetchMode(FetchMode::ASSOCIATIVE, 'arg1', 'arg2');
7070
}
@@ -114,8 +114,8 @@ public function testFetchThrowsInvalidArgumentException() : void
114114
{
115115
$statement = $this->createTestArrayStatement();
116116

117-
self::expectException(InvalidArgumentException::class);
118-
self::expectExceptionMessage('Invalid fetch mode given for fetching result, 9999 given.');
117+
$this->expectException(InvalidArgumentException::class);
118+
$this->expectExceptionMessage('Invalid fetch mode given for fetching result, 9999 given.');
119119

120120
$statement->fetch(9999);
121121
}

tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public function testPDOSpecificModeIsAccepted() : void
4040
'name' => 'Bob',
4141
]);
4242

43-
self::expectException(UnknownFetchMode::class);
44-
self::expectExceptionMessage('Unknown fetch mode 12.');
43+
$this->expectException(UnknownFetchMode::class);
44+
$this->expectExceptionMessage('Unknown fetch mode 12.');
4545

4646
$data = $this->connection->query('SELECT id, name FROM stmt_test ORDER BY id')
4747
->fetchAll(PDO::FETCH_KEY_PAIR);

tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ public function testListTableColumnsThrowsDatabaseRequired() : void
582582
$connection = DriverManager::getConnection($params);
583583
$schemaManager = $connection->getSchemaManager();
584584

585-
self::expectException(DatabaseRequired::class);
586-
self::expectExceptionMessage('A database is required for the method: Doctrine\DBAL\Schema\AbstractSchemaManager::listTableColumns');
585+
$this->expectException(DatabaseRequired::class);
586+
$this->expectExceptionMessage('A database is required for the method: Doctrine\DBAL\Schema\AbstractSchemaManager::listTableColumns');
587587

588588
$schemaManager->listTableColumns('users');
589589
}

tests/Doctrine/Tests/DBAL/Functional/StatementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public function testExecWithRedundantParameters() : void
374374
// but the wrapper connection wraps everything in a DBAL exception
375375
$this->iniSet('error_reporting', '0');
376376

377-
self::expectException(DBALException::class);
377+
$this->expectException(DBALException::class);
378378
$stmt->execute([null]);
379379
}
380380

@@ -393,7 +393,7 @@ public function testFetchColumnNonExistingIndex(int $index) : void
393393
$query = $platform->getDummySelectSQL();
394394
$stmt = $this->connection->query($query);
395395

396-
self::expectException(DBALException::class);
396+
$this->expectException(DBALException::class);
397397
$stmt->fetchColumn($index);
398398
}
399399

tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ public function testToArray() : void
6565

6666
public function testSettingUnknownOptionIsStillSupported() : void
6767
{
68-
self::expectException(UnknownColumnOption::class);
69-
self::expectExceptionMessage('The "unknown_option" column option is not supported.');
68+
$this->expectException(UnknownColumnOption::class);
69+
$this->expectExceptionMessage('The "unknown_option" column option is not supported.');
7070

7171
new Column('foo', $this->createMock(Type::class), ['unknown_option' => 'bar']);
7272
}
7373

7474
public function testOptionsShouldNotBeIgnored() : void
7575
{
76-
self::expectException(UnknownColumnOption::class);
77-
self::expectExceptionMessage('The "unknown_option" column option is not supported.');
76+
$this->expectException(UnknownColumnOption::class);
77+
$this->expectExceptionMessage('The "unknown_option" column option is not supported.');
7878

7979
$col1 = new Column('bar', Type::getType(Types::INTEGER), ['unknown_option' => 'bar', 'notnull' => true]);
8080
self::assertTrue($col1->getNotnull());

tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ protected function setUp() : void
4444

4545
public function testMissingSqlArgument() : void
4646
{
47-
self::expectException(RuntimeException::class);
48-
self::expectExceptionMessage('Argument "sql" is required in order to execute this command correctly.');
47+
$this->expectException(RuntimeException::class);
48+
$this->expectExceptionMessage('Argument "sql" is required in order to execute this command correctly.');
4949

5050
$this->commandTester->execute([
5151
'command' => $this->command->getName(),
@@ -55,8 +55,8 @@ public function testMissingSqlArgument() : void
5555

5656
public function testIncorrectDepthOption() : void
5757
{
58-
self::expectException(LogicException::class);
59-
self::expectExceptionMessage('Option "depth" must contains an integer value.');
58+
$this->expectException(LogicException::class);
59+
$this->expectExceptionMessage('Option "depth" must contains an integer value.');
6060

6161
$this->commandTester->execute([
6262
'command' => $this->command->getName(),

0 commit comments

Comments
 (0)