Unverified Commit 16d449c1 authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #3848 from BenMorel/expectException

expectException() is not static
parents 7f4ef4ac 8bded0b9
...@@ -63,8 +63,8 @@ class ArrayStatementTest extends TestCase ...@@ -63,8 +63,8 @@ class ArrayStatementTest extends TestCase
{ {
$statement = $this->createTestArrayStatement(); $statement = $this->createTestArrayStatement();
self::expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
self::expectExceptionMessage('Caching layer does not support 2nd/3rd argument to setFetchMode().'); $this->expectExceptionMessage('Caching layer does not support 2nd/3rd argument to setFetchMode().');
$statement->setFetchMode(FetchMode::ASSOCIATIVE, 'arg1', 'arg2'); $statement->setFetchMode(FetchMode::ASSOCIATIVE, 'arg1', 'arg2');
} }
...@@ -114,8 +114,8 @@ class ArrayStatementTest extends TestCase ...@@ -114,8 +114,8 @@ class ArrayStatementTest extends TestCase
{ {
$statement = $this->createTestArrayStatement(); $statement = $this->createTestArrayStatement();
self::expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
self::expectExceptionMessage('Invalid fetch mode given for fetching result, 9999 given.'); $this->expectExceptionMessage('Invalid fetch mode given for fetching result, 9999 given.');
$statement->fetch(9999); $statement->fetch(9999);
} }
......
...@@ -40,8 +40,8 @@ class PDOStatementTest extends DbalFunctionalTestCase ...@@ -40,8 +40,8 @@ class PDOStatementTest extends DbalFunctionalTestCase
'name' => 'Bob', 'name' => 'Bob',
]); ]);
self::expectException(UnknownFetchMode::class); $this->expectException(UnknownFetchMode::class);
self::expectExceptionMessage('Unknown fetch mode 12.'); $this->expectExceptionMessage('Unknown fetch mode 12.');
$data = $this->connection->query('SELECT id, name FROM stmt_test ORDER BY id') $data = $this->connection->query('SELECT id, name FROM stmt_test ORDER BY id')
->fetchAll(PDO::FETCH_KEY_PAIR); ->fetchAll(PDO::FETCH_KEY_PAIR);
......
...@@ -582,8 +582,8 @@ SQL; ...@@ -582,8 +582,8 @@ SQL;
$connection = DriverManager::getConnection($params); $connection = DriverManager::getConnection($params);
$schemaManager = $connection->getSchemaManager(); $schemaManager = $connection->getSchemaManager();
self::expectException(DatabaseRequired::class); $this->expectException(DatabaseRequired::class);
self::expectExceptionMessage('A database is required for the method: Doctrine\DBAL\Schema\AbstractSchemaManager::listTableColumns'); $this->expectExceptionMessage('A database is required for the method: Doctrine\DBAL\Schema\AbstractSchemaManager::listTableColumns');
$schemaManager->listTableColumns('users'); $schemaManager->listTableColumns('users');
} }
......
...@@ -374,7 +374,7 @@ EOF ...@@ -374,7 +374,7 @@ EOF
// but the wrapper connection wraps everything in a DBAL exception // but the wrapper connection wraps everything in a DBAL exception
$this->iniSet('error_reporting', '0'); $this->iniSet('error_reporting', '0');
self::expectException(DBALException::class); $this->expectException(DBALException::class);
$stmt->execute([null]); $stmt->execute([null]);
} }
...@@ -393,7 +393,7 @@ EOF ...@@ -393,7 +393,7 @@ EOF
$query = $platform->getDummySelectSQL(); $query = $platform->getDummySelectSQL();
$stmt = $this->connection->query($query); $stmt = $this->connection->query($query);
self::expectException(DBALException::class); $this->expectException(DBALException::class);
$stmt->fetchColumn($index); $stmt->fetchColumn($index);
} }
......
...@@ -65,16 +65,16 @@ class ColumnTest extends TestCase ...@@ -65,16 +65,16 @@ class ColumnTest extends TestCase
public function testSettingUnknownOptionIsStillSupported() : void public function testSettingUnknownOptionIsStillSupported() : void
{ {
self::expectException(UnknownColumnOption::class); $this->expectException(UnknownColumnOption::class);
self::expectExceptionMessage('The "unknown_option" column option is not supported.'); $this->expectExceptionMessage('The "unknown_option" column option is not supported.');
new Column('foo', $this->createMock(Type::class), ['unknown_option' => 'bar']); new Column('foo', $this->createMock(Type::class), ['unknown_option' => 'bar']);
} }
public function testOptionsShouldNotBeIgnored() : void public function testOptionsShouldNotBeIgnored() : void
{ {
self::expectException(UnknownColumnOption::class); $this->expectException(UnknownColumnOption::class);
self::expectExceptionMessage('The "unknown_option" column option is not supported.'); $this->expectExceptionMessage('The "unknown_option" column option is not supported.');
$col1 = new Column('bar', Type::getType(Types::INTEGER), ['unknown_option' => 'bar', 'notnull' => true]); $col1 = new Column('bar', Type::getType(Types::INTEGER), ['unknown_option' => 'bar', 'notnull' => true]);
self::assertTrue($col1->getNotnull()); self::assertTrue($col1->getNotnull());
......
...@@ -44,8 +44,8 @@ class RunSqlCommandTest extends TestCase ...@@ -44,8 +44,8 @@ class RunSqlCommandTest extends TestCase
public function testMissingSqlArgument() : void public function testMissingSqlArgument() : void
{ {
self::expectException(RuntimeException::class); $this->expectException(RuntimeException::class);
self::expectExceptionMessage('Argument "sql" is required in order to execute this command correctly.'); $this->expectExceptionMessage('Argument "sql" is required in order to execute this command correctly.');
$this->commandTester->execute([ $this->commandTester->execute([
'command' => $this->command->getName(), 'command' => $this->command->getName(),
...@@ -55,8 +55,8 @@ class RunSqlCommandTest extends TestCase ...@@ -55,8 +55,8 @@ class RunSqlCommandTest extends TestCase
public function testIncorrectDepthOption() : void public function testIncorrectDepthOption() : void
{ {
self::expectException(LogicException::class); $this->expectException(LogicException::class);
self::expectExceptionMessage('Option "depth" must contains an integer value.'); $this->expectExceptionMessage('Option "depth" must contains an integer value.');
$this->commandTester->execute([ $this->commandTester->execute([
'command' => $this->command->getName(), 'command' => $this->command->getName(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment