Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
808ba3f5
Unverified
Commit
808ba3f5
authored
May 23, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the rest of mock classes
parent
04cb1b41
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
17 additions
and
116 deletions
+17
-116
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+12
-13
AbstractMySQLDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+2
-2
AbstractPostgreSQLDriverTest.php
...ctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
+2
-2
StatementTest.php
tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
+1
-10
DriverConnectionMock.php
tests/Doctrine/Tests/Mocks/DriverConnectionMock.php
+0
-49
DriverResultStatementMock.php
tests/Doctrine/Tests/Mocks/DriverResultStatementMock.php
+0
-10
DriverStatementMock.php
tests/Doctrine/Tests/Mocks/DriverStatementMock.php
+0
-10
ServerInfoAwareConnectionMock.php
tests/Doctrine/Tests/Mocks/ServerInfoAwareConnectionMock.php
+0
-10
VersionAwarePlatformDriverMock.php
...s/Doctrine/Tests/Mocks/VersionAwarePlatformDriverMock.php
+0
-10
No files found.
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
808ba3f5
...
@@ -12,6 +12,7 @@ use Doctrine\DBAL\ConnectionException;
...
@@ -12,6 +12,7 @@ use Doctrine\DBAL\ConnectionException;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Driver\Connection
as
DriverConnection
;
use
Doctrine\DBAL\Driver\Connection
as
DriverConnection
;
use
Doctrine\DBAL\Driver\ServerInfoAwareConnection
;
use
Doctrine\DBAL\Driver\Statement
;
use
Doctrine\DBAL\Driver\Statement
;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\Events
;
use
Doctrine\DBAL\Events
;
...
@@ -21,10 +22,8 @@ use Doctrine\DBAL\Logging\DebugStack;
...
@@ -21,10 +22,8 @@ use Doctrine\DBAL\Logging\DebugStack;
use
Doctrine\DBAL\Logging\EchoSQLLogger
;
use
Doctrine\DBAL\Logging\EchoSQLLogger
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\VersionAwarePlatformDriver
;
use
Doctrine\Tests\DbalTestCase
;
use
Doctrine\Tests\DbalTestCase
;
use
Doctrine\Tests\Mocks\DriverStatementMock
;
use
Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock
;
use
Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock
;
use
Exception
;
use
Exception
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
stdClass
;
use
stdClass
;
...
@@ -525,7 +524,7 @@ class ConnectionTest extends DbalTestCase
...
@@ -525,7 +524,7 @@ class ConnectionTest extends DbalTestCase
$this
->
createMock
(
DriverConnection
::
class
)
$this
->
createMock
(
DriverConnection
::
class
)
));
));
$driverStatementMock
=
$this
->
createMock
(
DriverStatementMock
::
class
);
$driverStatementMock
=
$this
->
createMock
(
Statement
::
class
);
$driverStatementMock
->
expects
(
$this
->
once
())
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetch'
)
->
method
(
'fetch'
)
...
@@ -561,7 +560,7 @@ class ConnectionTest extends DbalTestCase
...
@@ -561,7 +560,7 @@ class ConnectionTest extends DbalTestCase
$this
->
createMock
(
DriverConnection
::
class
)
$this
->
createMock
(
DriverConnection
::
class
)
));
));
$driverStatementMock
=
$this
->
createMock
(
DriverStatementMock
::
class
);
$driverStatementMock
=
$this
->
createMock
(
Statement
::
class
);
$driverStatementMock
->
expects
(
$this
->
once
())
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetch'
)
->
method
(
'fetch'
)
...
@@ -598,7 +597,7 @@ class ConnectionTest extends DbalTestCase
...
@@ -598,7 +597,7 @@ class ConnectionTest extends DbalTestCase
$this
->
createMock
(
DriverConnection
::
class
)
$this
->
createMock
(
DriverConnection
::
class
)
));
));
$driverStatementMock
=
$this
->
createMock
(
DriverStatementMock
::
class
);
$driverStatementMock
=
$this
->
createMock
(
Statement
::
class
);
$driverStatementMock
->
expects
(
$this
->
once
())
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetchColumn'
)
->
method
(
'fetchColumn'
)
...
@@ -634,7 +633,7 @@ class ConnectionTest extends DbalTestCase
...
@@ -634,7 +633,7 @@ class ConnectionTest extends DbalTestCase
$this
->
createMock
(
DriverConnection
::
class
)
$this
->
createMock
(
DriverConnection
::
class
)
));
));
$driverStatementMock
=
$this
->
createMock
(
DriverStatementMock
::
class
);
$driverStatementMock
=
$this
->
createMock
(
Statement
::
class
);
$driverStatementMock
->
expects
(
$this
->
once
())
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetchAll'
)
->
method
(
'fetchAll'
)
...
@@ -732,11 +731,11 @@ class ConnectionTest extends DbalTestCase
...
@@ -732,11 +731,11 @@ class ConnectionTest extends DbalTestCase
*/
*/
public
function
testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform
()
public
function
testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform
()
{
{
/** @var
VersionAwarePlatformDriverMock
|MockObject $driverMock */
/** @var
Driver|VersionAwarePlatformDriver
|MockObject $driverMock */
$driverMock
=
$this
->
createMock
(
VersionAwarePlatformDriverMock
::
class
);
$driverMock
=
$this
->
createMock
(
[
Driver
::
class
,
VersionAwarePlatformDriver
::
class
]
);
/** @var ServerInfoAwareConnection
Mock
|MockObject $driverConnectionMock */
/** @var ServerInfoAwareConnection|MockObject $driverConnectionMock */
$driverConnectionMock
=
$this
->
createMock
(
ServerInfoAwareConnection
Mock
::
class
);
$driverConnectionMock
=
$this
->
createMock
(
ServerInfoAwareConnection
::
class
);
/** @var AbstractPlatform|MockObject $platformMock */
/** @var AbstractPlatform|MockObject $platformMock */
$platformMock
=
$this
->
getMockForAbstractClass
(
AbstractPlatform
::
class
);
$platformMock
=
$this
->
getMockForAbstractClass
(
AbstractPlatform
::
class
);
...
@@ -861,8 +860,8 @@ class ConnectionTest extends DbalTestCase
...
@@ -861,8 +860,8 @@ class ConnectionTest extends DbalTestCase
*/
*/
public
function
testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase
()
public
function
testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase
()
{
{
/** @var
VersionAwarePlatformDriverMock
|MockObject $driverMock */
/** @var
Driver|VersionAwarePlatformDriver
|MockObject $driverMock */
$driverMock
=
$this
->
createMock
(
VersionAwarePlatformDriverMock
::
class
);
$driverMock
=
$this
->
createMock
(
[
Driver
::
class
,
VersionAwarePlatformDriver
::
class
]
);
$connection
=
new
Connection
([
'dbname'
=>
'foo'
],
$driverMock
);
$connection
=
new
Connection
([
'dbname'
=>
'foo'
],
$driverMock
);
$originalException
=
new
Exception
(
'Original exception'
);
$originalException
=
new
Exception
(
'Original exception'
);
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
View file @
808ba3f5
...
@@ -4,12 +4,12 @@ namespace Doctrine\Tests\DBAL\Driver;
...
@@ -4,12 +4,12 @@ namespace Doctrine\Tests\DBAL\Driver;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Driver\AbstractMySQLDriver
;
use
Doctrine\DBAL\Driver\AbstractMySQLDriver
;
use
Doctrine\DBAL\Driver\ResultStatement
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Platforms\MySQL80Platform
;
use
Doctrine\DBAL\Platforms\MySQL80Platform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Schema\MySqlSchemaManager
;
use
Doctrine\DBAL\Schema\MySqlSchemaManager
;
use
Doctrine\Tests\Mocks\DriverResultStatementMock
;
class
AbstractMySQLDriverTest
extends
AbstractDriverTest
class
AbstractMySQLDriverTest
extends
AbstractDriverTest
{
{
...
@@ -23,7 +23,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
...
@@ -23,7 +23,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
'password'
=>
'bar'
,
'password'
=>
'bar'
,
];
];
$statement
=
$this
->
createMock
(
DriverResultStatementMock
::
class
);
$statement
=
$this
->
createMock
(
ResultStatement
::
class
);
$statement
->
expects
(
$this
->
once
())
$statement
->
expects
(
$this
->
once
())
->
method
(
'fetchColumn'
)
->
method
(
'fetchColumn'
)
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
View file @
808ba3f5
...
@@ -4,13 +4,13 @@ namespace Doctrine\Tests\DBAL\Driver;
...
@@ -4,13 +4,13 @@ namespace Doctrine\Tests\DBAL\Driver;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Driver\AbstractPostgreSQLDriver
;
use
Doctrine\DBAL\Driver\AbstractPostgreSQLDriver
;
use
Doctrine\DBAL\Driver\ResultStatement
;
use
Doctrine\DBAL\Platforms\PostgreSQL100Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL100Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL91Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL91Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Schema\PostgreSqlSchemaManager
;
use
Doctrine\DBAL\Schema\PostgreSqlSchemaManager
;
use
Doctrine\Tests\Mocks\DriverResultStatementMock
;
class
AbstractPostgreSQLDriverTest
extends
AbstractDriverTest
class
AbstractPostgreSQLDriverTest
extends
AbstractDriverTest
{
{
...
@@ -24,7 +24,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
...
@@ -24,7 +24,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
'password'
=>
'bar'
,
'password'
=>
'bar'
,
];
];
$statement
=
$this
->
createMock
(
DriverResultStatementMock
::
class
);
$statement
=
$this
->
createMock
(
ResultStatement
::
class
);
$statement
->
expects
(
$this
->
once
())
$statement
->
expects
(
$this
->
once
())
->
method
(
'fetchColumn'
)
->
method
(
'fetchColumn'
)
...
...
tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
View file @
808ba3f5
...
@@ -8,7 +8,6 @@ use Doctrine\DBAL\ParameterType;
...
@@ -8,7 +8,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Portability\Connection
;
use
Doctrine\DBAL\Portability\Connection
;
use
Doctrine\DBAL\Portability\Statement
;
use
Doctrine\DBAL\Portability\Statement
;
use
Doctrine\Tests\DbalTestCase
;
use
Doctrine\Tests\DbalTestCase
;
use
Doctrine\Tests\Mocks\DriverStatementMock
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
ReflectionProperty
;
use
ReflectionProperty
;
use
function
iterator_to_array
;
use
function
iterator_to_array
;
...
@@ -29,7 +28,7 @@ class StatementTest extends DbalTestCase
...
@@ -29,7 +28,7 @@ class StatementTest extends DbalTestCase
*/
*/
protected
function
setUp
()
:
void
protected
function
setUp
()
:
void
{
{
$this
->
wrappedStmt
=
$this
->
create
WrappedStatement
(
);
$this
->
wrappedStmt
=
$this
->
create
Mock
(
DriverStatement
::
class
);
$this
->
conn
=
$this
->
createConnection
();
$this
->
conn
=
$this
->
createConnection
();
$this
->
stmt
=
$this
->
createStatement
(
$this
->
wrappedStmt
,
$this
->
conn
);
$this
->
stmt
=
$this
->
createStatement
(
$this
->
wrappedStmt
,
$this
->
conn
);
}
}
...
@@ -179,12 +178,4 @@ class StatementTest extends DbalTestCase
...
@@ -179,12 +178,4 @@ class StatementTest extends DbalTestCase
{
{
return
new
Statement
(
$wrappedStatement
,
$connection
);
return
new
Statement
(
$wrappedStatement
,
$connection
);
}
}
/**
* @return DriverStatement|MockObject
*/
protected
function
createWrappedStatement
()
{
return
$this
->
createMock
(
DriverStatementMock
::
class
);
}
}
}
tests/Doctrine/Tests/Mocks/DriverConnectionMock.php
deleted
100644 → 0
View file @
04cb1b41
<?php
namespace
Doctrine\Tests\Mocks
;
use
Doctrine\DBAL\Driver\Connection
;
use
Doctrine\DBAL\ParameterType
;
class
DriverConnectionMock
implements
Connection
{
public
function
prepare
(
$prepareString
)
{
}
public
function
query
()
{
}
public
function
quote
(
$input
,
$type
=
ParameterType
::
STRING
)
{
}
public
function
exec
(
$statement
)
{
}
public
function
lastInsertId
(
$name
=
null
)
{
}
public
function
beginTransaction
()
{
}
public
function
commit
()
{
}
public
function
rollBack
()
{
}
public
function
errorCode
()
{
}
public
function
errorInfo
()
{
}
}
tests/Doctrine/Tests/Mocks/DriverResultStatementMock.php
deleted
100644 → 0
View file @
04cb1b41
<?php
namespace
Doctrine\Tests\Mocks
;
use
Doctrine\DBAL\Driver\ResultStatement
;
use
IteratorAggregate
;
interface
DriverResultStatementMock
extends
ResultStatement
,
IteratorAggregate
{
}
tests/Doctrine/Tests/Mocks/DriverStatementMock.php
deleted
100644 → 0
View file @
04cb1b41
<?php
namespace
Doctrine\Tests\Mocks
;
use
Doctrine\DBAL\Driver\Statement
;
use
IteratorAggregate
;
interface
DriverStatementMock
extends
Statement
,
IteratorAggregate
{
}
tests/Doctrine/Tests/Mocks/ServerInfoAwareConnectionMock.php
deleted
100644 → 0
View file @
04cb1b41
<?php
namespace
Doctrine\Tests\Mocks
;
use
Doctrine\DBAL\Driver\Connection
;
use
Doctrine\DBAL\Driver\ServerInfoAwareConnection
;
interface
ServerInfoAwareConnectionMock
extends
Connection
,
ServerInfoAwareConnection
{
}
tests/Doctrine/Tests/Mocks/VersionAwarePlatformDriverMock.php
deleted
100644 → 0
View file @
04cb1b41
<?php
namespace
Doctrine\Tests\Mocks
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\VersionAwarePlatformDriver
;
interface
VersionAwarePlatformDriverMock
extends
Driver
,
VersionAwarePlatformDriver
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment