Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the rest of mock classes #3555

Merged
merged 1 commit into from May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 12 additions & 13 deletions tests/Doctrine/Tests/DBAL/ConnectionTest.php
Expand Up @@ -12,6 +12,7 @@
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Events;
Expand All @@ -21,10 +22,8 @@
use Doctrine\DBAL\Logging\EchoSQLLogger;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\VersionAwarePlatformDriver;
use Doctrine\Tests\DbalTestCase;
use Doctrine\Tests\Mocks\DriverStatementMock;
use Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock;
use Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock;
use Exception;
use PHPUnit\Framework\MockObject\MockObject;
use stdClass;
Expand Down Expand Up @@ -525,7 +524,7 @@ public function testFetchAssoc()
$this->createMock(DriverConnection::class)
));

$driverStatementMock = $this->createMock(DriverStatementMock::class);
$driverStatementMock = $this->createMock(Statement::class);

$driverStatementMock->expects($this->once())
->method('fetch')
Expand Down Expand Up @@ -561,7 +560,7 @@ public function testFetchArray()
$this->createMock(DriverConnection::class)
));

$driverStatementMock = $this->createMock(DriverStatementMock::class);
$driverStatementMock = $this->createMock(Statement::class);

$driverStatementMock->expects($this->once())
->method('fetch')
Expand Down Expand Up @@ -598,7 +597,7 @@ public function testFetchColumn()
$this->createMock(DriverConnection::class)
));

$driverStatementMock = $this->createMock(DriverStatementMock::class);
$driverStatementMock = $this->createMock(Statement::class);

$driverStatementMock->expects($this->once())
->method('fetchColumn')
Expand Down Expand Up @@ -634,7 +633,7 @@ public function testFetchAll()
$this->createMock(DriverConnection::class)
));

$driverStatementMock = $this->createMock(DriverStatementMock::class);
$driverStatementMock = $this->createMock(Statement::class);

$driverStatementMock->expects($this->once())
->method('fetchAll')
Expand Down Expand Up @@ -732,11 +731,11 @@ public function testCallConnectOnce($method, $params)
*/
public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform()
{
/** @var VersionAwarePlatformDriverMock|MockObject $driverMock */
$driverMock = $this->createMock(VersionAwarePlatformDriverMock::class);
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be reworked due to sebastianbergmann/phpunit#3955.


/** @var ServerInfoAwareConnectionMock|MockObject $driverConnectionMock */
$driverConnectionMock = $this->createMock(ServerInfoAwareConnectionMock::class);
/** @var ServerInfoAwareConnection|MockObject $driverConnectionMock */
$driverConnectionMock = $this->createMock(ServerInfoAwareConnection::class);

/** @var AbstractPlatform|MockObject $platformMock */
$platformMock = $this->getMockForAbstractClass(AbstractPlatform::class);
Expand Down Expand Up @@ -861,8 +860,8 @@ public function testThrowsExceptionWhenInValidPlatformSpecified() : void
*/
public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase()
{
/** @var VersionAwarePlatformDriverMock|MockObject $driverMock */
$driverMock = $this->createMock(VersionAwarePlatformDriverMock::class);
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be reworked due to sebastianbergmann/phpunit#3955.


$connection = new Connection(['dbname' => 'foo'], $driverMock);
$originalException = new Exception('Original exception');
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
Expand Up @@ -4,12 +4,12 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Platforms\MySQL80Platform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\MySqlSchemaManager;
use Doctrine\Tests\Mocks\DriverResultStatementMock;

class AbstractMySQLDriverTest extends AbstractDriverTest
{
Expand All @@ -23,7 +23,7 @@ public function testReturnsDatabaseName()
'password' => 'bar',
];

$statement = $this->createMock(DriverResultStatementMock::class);
$statement = $this->createMock(ResultStatement::class);

$statement->expects($this->once())
->method('fetchColumn')
Expand Down
Expand Up @@ -4,13 +4,13 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use Doctrine\Tests\Mocks\DriverResultStatementMock;

class AbstractPostgreSQLDriverTest extends AbstractDriverTest
{
Expand All @@ -24,7 +24,7 @@ public function testReturnsDatabaseName()
'password' => 'bar',
];

$statement = $this->createMock(DriverResultStatementMock::class);
$statement = $this->createMock(ResultStatement::class);

$statement->expects($this->once())
->method('fetchColumn')
Expand Down
11 changes: 1 addition & 10 deletions tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
Expand Up @@ -8,7 +8,6 @@
use Doctrine\DBAL\Portability\Connection;
use Doctrine\DBAL\Portability\Statement;
use Doctrine\Tests\DbalTestCase;
use Doctrine\Tests\Mocks\DriverStatementMock;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionProperty;
use function iterator_to_array;
Expand All @@ -29,7 +28,7 @@ class StatementTest extends DbalTestCase
*/
protected function setUp() : void
{
$this->wrappedStmt = $this->createWrappedStatement();
$this->wrappedStmt = $this->createMock(DriverStatement::class);
$this->conn = $this->createConnection();
$this->stmt = $this->createStatement($this->wrappedStmt, $this->conn);
}
Expand Down Expand Up @@ -179,12 +178,4 @@ protected function createStatement(DriverStatement $wrappedStatement, Connection
{
return new Statement($wrappedStatement, $connection);
}

/**
* @return DriverStatement|MockObject
*/
protected function createWrappedStatement()
{
return $this->createMock(DriverStatementMock::class);
}
}
49 changes: 0 additions & 49 deletions tests/Doctrine/Tests/Mocks/DriverConnectionMock.php

This file was deleted.

10 changes: 0 additions & 10 deletions tests/Doctrine/Tests/Mocks/DriverResultStatementMock.php

This file was deleted.

10 changes: 0 additions & 10 deletions tests/Doctrine/Tests/Mocks/DriverStatementMock.php

This file was deleted.

10 changes: 0 additions & 10 deletions tests/Doctrine/Tests/Mocks/ServerInfoAwareConnectionMock.php

This file was deleted.

10 changes: 0 additions & 10 deletions tests/Doctrine/Tests/Mocks/VersionAwarePlatformDriverMock.php

This file was deleted.