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
1e67141a
Commit
1e67141a
authored
Jun 30, 2016
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor deprecated PHPUnit_Framework_TestCase::getMock() calls
parent
0348953f
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
136 additions
and
113 deletions
+136
-113
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+26
-24
DBALExceptionTest.php
tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
+3
-3
AbstractDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php
+2
-2
AbstractMySQLDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+1
-1
AbstractPostgreSQLDriverTest.php
...ctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
+1
-1
OCI8StatementTest.php
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
+8
-4
MysqlSessionInitTest.php
tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
+2
-2
OracleSessionInitTest.php
tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
+1
-1
SQLSessionInitTest.php
tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php
+2
-2
LoggingTest.php
tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
+4
-4
PortabilityTest.php
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
+3
-1
DBAL461Test.php
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
+1
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+9
-3
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+1
-1
StatementTest.php
tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
+1
-1
ExpressionBuilderTest.php
...ine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
+1
-1
QueryBuilderTest.php
tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
+1
-1
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+6
-2
MySqlSchemaManagerTest.php
tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
+6
-7
PostgreSQLSchemaManagerTest.php
...octrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php
+5
-7
SchemaDiffTest.php
tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php
+1
-1
SchemaTest.php
tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php
+2
-5
CreateSchemaSqlCollectorTest.php
...ests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
+1
-1
SchemaSqlCollectorTest.php
...rine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
+6
-8
PoolingShardManagerTest.php
.../Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
+6
-3
SQLAzureShardManagerTest.php
...Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
+4
-1
MultiTenantShardChoserTest.php
.../DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
+4
-1
StatementTest.php
tests/Doctrine/Tests/DBAL/StatementTest.php
+26
-22
RunSqlCommandTest.php
...s/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php
+1
-1
GuidTypeTest.php
tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
+1
-1
No files found.
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
1e67141a
...
...
@@ -102,13 +102,15 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public
function
testConnectDispatchEvent
()
{
$listenerMock
=
$this
->
getMock
(
'ConnectDispatchEventListener'
,
array
(
'postConnect'
));
$listenerMock
=
$this
->
getMockBuilder
(
'ConnectDispatchEventListener'
)
->
setMethods
(
array
(
'postConnect'
))
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'postConnect'
);
$eventManager
=
new
EventManager
();
$eventManager
->
addEventListener
(
array
(
Events
::
postConnect
),
$listenerMock
);
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
((
$this
->
at
(
0
)))
->
method
(
'connect'
);
$platform
=
new
Mocks\MockPlatform
();
...
...
@@ -200,7 +202,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testConnectStartsTransactionInNoAutoCommitMode
()
{
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
...
...
@@ -220,7 +222,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testCommitStartsTransactionInNoAutoCommitMode
()
{
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
...
...
@@ -238,7 +240,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testRollBackStartsTransactionInNoAutoCommitMode
()
{
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
...
...
@@ -256,7 +258,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testSwitchingAutoCommitModeCommitsAllCurrentTransactions
()
{
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
...
...
@@ -278,7 +280,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public
function
testEmptyInsert
()
{
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
...
...
@@ -303,13 +305,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$types
=
array
(
\PDO
::
PARAM_INT
);
$result
=
array
();
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
$driverStatementMock
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetch'
)
...
...
@@ -337,13 +339,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$types
=
array
(
\PDO
::
PARAM_INT
);
$result
=
array
();
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
$driverStatementMock
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetch'
)
...
...
@@ -372,13 +374,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$column
=
0
;
$result
=
array
();
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
$driverStatementMock
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetchColumn'
)
...
...
@@ -429,13 +431,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$types
=
array
(
\PDO
::
PARAM_INT
);
$result
=
array
();
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
->
expects
(
$this
->
any
())
->
method
(
'connect'
)
->
will
(
$this
->
returnValue
(
new
DriverConnectionMock
()));
$driverStatementMock
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
$driverStatementMock
->
expects
(
$this
->
once
())
->
method
(
'fetchAll'
)
...
...
@@ -459,7 +461,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$params
[
'pdo'
]
=
new
\stdClass
();
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$conn
=
new
Connection
(
$params
,
$driverMock
);
...
...
@@ -470,7 +472,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$params
[
'pdo'
]
=
new
\stdClass
();
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$conn
=
new
Connection
(
$params
,
$driverMock
);
...
...
@@ -480,8 +482,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public
function
testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentException
()
{
/* @var $driver \Doctrine\DBAL\Driver */
$driver
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$pdoMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver\Connection'
);
$driver
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$pdoMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver\Connection'
);
// should never execute queries with invalid arguments
$pdoMock
->
expects
(
$this
->
never
())
->
method
(
'exec'
);
...
...
@@ -509,10 +511,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testCallConnectOnce
(
$method
,
$params
)
{
$driverMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver'
);
$pdoMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver\Connection'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver'
);
$pdoMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver\Connection'
);
$platformMock
=
new
Mocks\MockPlatform
();
$stmtMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver\Statement'
);
$stmtMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver\Statement'
);
$pdoMock
->
expects
(
$this
->
any
())
->
method
(
'prepare'
)
...
...
@@ -534,10 +536,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public
function
testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform
()
{
/** @var \Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock|\PHPUnit_Framework_MockObject_MockObject $driverMock */
$driverMock
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock'
);
$driverMock
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock'
);
/** @var \Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock|\PHPUnit_Framework_MockObject_MockObject $driverConnectionMock */
$driverConnectionMock
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock'
);
$driverConnectionMock
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\ServerInfoAwareConnectionMock'
);
/** @var \Doctrine\DBAL\Platforms\AbstractPlatform|\PHPUnit_Framework_MockObject_MockObject $platformMock */
$platformMock
=
$this
->
getMockForAbstractClass
(
'Doctrine\DBAL\Platforms\AbstractPlatform'
);
...
...
tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
View file @
1e67141a
...
...
@@ -9,15 +9,15 @@ class DBALExceptionTest extends \Doctrine\Tests\DbalTestCase
{
public
function
testDriverExceptionDuringQueryAcceptsBinaryData
()
{
$driver
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Driver'
);
$driver
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Driver'
);
$e
=
DBALException
::
driverExceptionDuringQuery
(
$driver
,
new
\Exception
,
''
,
array
(
'ABC'
,
chr
(
128
)));
$this
->
assertContains
(
'with params ["ABC", "\x80"]'
,
$e
->
getMessage
());
}
public
function
testAvoidOverWrappingOnDriverException
()
{
$driver
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Driver'
);
$ex
=
new
DriverException
(
''
,
$this
->
get
Mock
(
'\Doctrine\DBAL\Driver\DriverException'
));
$driver
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Driver'
);
$ex
=
new
DriverException
(
''
,
$this
->
create
Mock
(
'\Doctrine\DBAL\Driver\DriverException'
));
$e
=
DBALException
::
driverExceptionDuringQuery
(
$driver
,
$ex
,
''
);
$this
->
assertSame
(
$ex
,
$e
);
}
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php
View file @
1e67141a
...
...
@@ -59,7 +59,7 @@ abstract class AbstractDriverTest extends DbalTestCase
);
}
$driverException
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver\DriverException'
);
$driverException
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver\DriverException'
);
$driverException
->
expects
(
$this
->
any
())
->
method
(
'getErrorCode'
)
...
...
@@ -209,7 +209,7 @@ abstract class AbstractDriverTest extends DbalTestCase
foreach
(
$this
->
getExceptionConversionData
()
as
$convertedExceptionClassName
=>
$errors
)
{
foreach
(
$errors
as
$error
)
{
$driverException
=
$this
->
get
Mock
(
'Doctrine\DBAL\Driver\DriverException'
);
$driverException
=
$this
->
create
Mock
(
'Doctrine\DBAL\Driver\DriverException'
);
$driverException
->
expects
(
$this
->
any
())
->
method
(
'getErrorCode'
)
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
View file @
1e67141a
...
...
@@ -18,7 +18,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
'password'
=>
'bar'
,
);
$statement
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverResultStatementMock'
);
$statement
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverResultStatementMock'
);
$statement
->
expects
(
$this
->
once
())
->
method
(
'fetchColumn'
)
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
View file @
1e67141a
...
...
@@ -18,7 +18,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
'password'
=>
'bar'
,
);
$statement
=
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverResultStatementMock'
);
$statement
=
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverResultStatementMock'
);
$statement
->
expects
(
$this
->
once
())
->
method
(
'fetchColumn'
)
...
...
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
View file @
1e67141a
...
...
@@ -27,9 +27,10 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testExecute
(
array
$params
)
{
$statement
=
$this
->
getMock
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Statement'
,
array
(
'bindValue'
,
'errorInfo'
),
array
(),
''
,
false
);
$statement
=
$this
->
getMockBuilder
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Statement'
)
->
setMethods
(
array
(
'bindValue'
,
'errorInfo'
))
->
disableOriginalConstructor
()
->
getMock
();
$statement
->
expects
(
$this
->
at
(
0
))
->
method
(
'bindValue'
)
...
...
@@ -52,7 +53,10 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
// can't pass to constructor since we don't have a real database handle,
// but execute must check the connection for the executeMode
$conn
=
$this
->
getMock
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Connection'
,
array
(
'getExecuteMode'
),
array
(),
''
,
false
);
$conn
=
$this
->
getMockBuilder
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Connection'
)
->
setMethods
(
array
(
'getExecuteMode'
))
->
disableOriginalConstructor
()
->
getMock
();
$conn
->
expects
(
$this
->
once
())
->
method
(
'getExecuteMode'
);
...
...
tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
View file @
1e67141a
...
...
@@ -11,7 +11,7 @@ class MysqlSessionInitTest extends DbalTestCase
{
public
function
testPostConnect
()
{
$connectionMock
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$connectionMock
=
$this
->
createMock
(
'Doctrine\DBAL\Connection'
);
$connectionMock
->
expects
(
$this
->
once
())
->
method
(
'executeUpdate'
)
->
with
(
$this
->
equalTo
(
"SET NAMES foo COLLATE bar"
));
...
...
@@ -28,4 +28,4 @@ class MysqlSessionInitTest extends DbalTestCase
$listener
=
new
MysqlSessionInit
();
$this
->
assertEquals
(
array
(
Events
::
postConnect
),
$listener
->
getSubscribedEvents
());
}
}
\ No newline at end of file
}
tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
View file @
1e67141a
...
...
@@ -11,7 +11,7 @@ class OracleSessionInitTest extends DbalTestCase
{
public
function
testPostConnect
()
{
$connectionMock
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$connectionMock
=
$this
->
createMock
(
'Doctrine\DBAL\Connection'
);
$connectionMock
->
expects
(
$this
->
once
())
->
method
(
'executeUpdate'
)
->
with
(
$this
->
isType
(
'string'
));
...
...
tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php
View file @
1e67141a
...
...
@@ -14,7 +14,7 @@ class SQLSessionInitTest extends DbalTestCase
{
public
function
testPostConnect
()
{
$connectionMock
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$connectionMock
=
$this
->
createMock
(
'Doctrine\DBAL\Connection'
);
$connectionMock
->
expects
(
$this
->
once
())
->
method
(
'exec'
)
->
with
(
$this
->
equalTo
(
"SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"
));
...
...
@@ -30,4 +30,4 @@ class SQLSessionInitTest extends DbalTestCase
$listener
=
new
SQLSessionInit
(
"SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"
);
$this
->
assertEquals
(
array
(
Events
::
postConnect
),
$listener
->
getSubscribedEvents
());
}
}
\ No newline at end of file
}
tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
View file @
1e67141a
...
...
@@ -8,7 +8,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$sql
=
$this
->
_conn
->
getDatabasePlatform
()
->
getDummySelectSQL
();
$logMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logMock
->
expects
(
$this
->
at
(
0
))
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
array
()),
$this
->
equalTo
(
array
()));
...
...
@@ -24,7 +24,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql
=
$this
->
_conn
->
getDatabasePlatform
()
->
getDummySelectSQL
();
$logMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logMock
->
expects
(
$this
->
at
(
0
))
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
array
()),
$this
->
equalTo
(
array
()));
...
...
@@ -38,7 +38,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$sql
=
$this
->
_conn
->
getDatabasePlatform
()
->
getDummySelectSQL
();
$logMock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logMock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logMock
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
array
()));
...
...
@@ -49,4 +49,4 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
();
}
}
\ No newline at end of file
}
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
View file @
1e67141a
...
...
@@ -128,7 +128,9 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
'portability'
=>
$portability
);
$driverMock
=
$this
->
getMock
(
'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver'
,
array
(
'connect'
));
$driverMock
=
$this
->
getMockBuilder
(
'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver'
)
->
setMethods
(
array
(
'connect'
))
->
getMock
();
$driverMock
->
expects
(
$this
->
once
())
->
method
(
'connect'
)
...
...
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
View file @
1e67141a
...
...
@@ -11,7 +11,7 @@ class DBAL461Test extends \PHPUnit_Framework_TestCase
{
public
function
testIssue
()
{
$conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$conn
=
$this
->
createMock
(
'Doctrine\DBAL\Connection'
);
$platform
=
$this
->
getMockForAbstractClass
(
'Doctrine\DBAL\Platforms\AbstractPlatform'
);
$platform
->
registerDoctrineTypeMapping
(
'numeric'
,
'decimal'
);
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
1e67141a
...
...
@@ -318,7 +318,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
public
function
testGetCreateTableSqlDispatchEvent
()
{
$listenerMock
=
$this
->
getMock
(
'GetCreateTableSqlDispatchEvenListener'
,
array
(
'onSchemaCreateTable'
,
'onSchemaCreateTableColumn'
));
$listenerMock
=
$this
->
getMockBuilder
(
'GetCreateTableSqlDispatchEvenListener'
)
->
setMethods
(
array
(
'onSchemaCreateTable'
,
'onSchemaCreateTableColumn'
))
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'onSchemaCreateTable'
);
...
...
@@ -340,7 +342,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
public
function
testGetDropTableSqlDispatchEvent
()
{
$listenerMock
=
$this
->
getMock
(
'GetDropTableSqlDispatchEventListener'
,
array
(
'onSchemaDropTable'
));
$listenerMock
=
$this
->
getMockBuilder
(
'GetDropTableSqlDispatchEventListener'
)
->
setMethods
(
array
(
'onSchemaDropTable'
))
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'onSchemaDropTable'
);
...
...
@@ -363,7 +367,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
'onSchemaAlterTableRenameColumn'
);
$listenerMock
=
$this
->
getMock
(
'GetAlterTableSqlDispatchEvenListener'
,
$events
);
$listenerMock
=
$this
->
getMockBuilder
(
'GetAlterTableSqlDispatchEvenListener'
)
->
setMethods
(
$events
)
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'onSchemaAlterTable'
);
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
1e67141a
...
...
@@ -456,7 +456,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
{
$this
->
setExpectedException
(
'\InvalidArgumentException'
);
$this
->
_platform
->
getCreateConstraintSQL
(
$this
->
get
Mock
(
'\Doctrine\DBAL\Schema\Constraint'
),
'footable'
);
$this
->
_platform
->
getCreateConstraintSQL
(
$this
->
create
Mock
(
'\Doctrine\DBAL\Schema\Constraint'
),
'footable'
);
}
public
function
testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL
()
...
...
tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
View file @
1e67141a
...
...
@@ -188,6 +188,6 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
*/
protected
function
createWrappedStatement
()
{
return
$this
->
get
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
return
$this
->
create
Mock
(
'Doctrine\Tests\Mocks\DriverStatementMock'
);
}
}
tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
View file @
1e67141a
...
...
@@ -14,7 +14,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase
protected
function
setUp
()
{
$conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$conn
=
$this
->
createMock
(
'Doctrine\DBAL\Connection'
);
$this
->
expr
=
new
ExpressionBuilder
(
$conn
);
...
...
tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
View file @
1e67141a
...
...
@@ -14,7 +14,7 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase
protected
function
setUp
()
{
$this
->
conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$this
->
conn
=
$this
->
createMock
(
'Doctrine\DBAL\Connection'
);
$expressionBuilder
=
new
ExpressionBuilder
(
$this
->
conn
);
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
1e67141a
...
...
@@ -1131,8 +1131,12 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
public
function
testComparesNamespaces
()
{
$comparator
=
new
Comparator
();
$fromSchema
=
$this
->
getMock
(
'Doctrine\DBAL\Schema\Schema'
,
array
(
'getNamespaces'
,
'hasNamespace'
));
$toSchema
=
$this
->
getMock
(
'Doctrine\DBAL\Schema\Schema'
,
array
(
'getNamespaces'
,
'hasNamespace'
));
$fromSchema
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Schema\Schema'
)
->
setMethods
(
array
(
'getNamespaces'
,
'hasNamespace'
))
->
getMock
();
$toSchema
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Schema\Schema'
)
->
setMethods
(
array
(
'getNamespaces'
,
'hasNamespace'
))
->
getMock
();
$fromSchema
->
expects
(
$this
->
once
())
->
method
(
'getNamespaces'
)
...
...
tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
View file @
1e67141a
...
...
@@ -17,13 +17,12 @@ class MySqlSchemaManagerTest extends \PHPUnit_Framework_TestCase
protected
function
setUp
()
{
$eventManager
=
new
EventManager
();
$driverMock
=
$this
->
getMock
(
'Doctrine\DBAL\Driver'
);
$platform
=
$this
->
getMock
(
'Doctrine\DBAL\Platforms\MySqlPlatform'
);
$this
->
conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(
'fetchAll'
),
array
(
array
(
'platform'
=>
$platform
),
$driverMock
,
new
Configuration
(),
$eventManager
)
);
$driverMock
=
$this
->
createMock
(
'Doctrine\DBAL\Driver'
);
$platform
=
$this
->
createMock
(
'Doctrine\DBAL\Platforms\MySqlPlatform'
);
$this
->
conn
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Connection'
)
->
setMethods
(
array
(
'fetchAll'
))
->
setConstructorArgs
(
array
(
array
(
'platform'
=>
$platform
),
$driverMock
,
new
Configuration
(),
$eventManager
))
->
getMock
();
$this
->
manager
=
new
MySqlSchemaManager
(
$this
->
conn
);
}
...
...
tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php
View file @
1e67141a
...
...
@@ -20,13 +20,11 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase
protected
function
setUp
()
{
$driverMock
=
$this
->
getMock
(
'Doctrine\DBAL\Driver'
);
$platform
=
$this
->
getMock
(
'Doctrine\DBAL\Platforms\PostgreSqlPlatform'
);
$this
->
connection
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(
array
(
'platform'
=>
$platform
),
$driverMock
)
);
$driverMock
=
$this
->
createMock
(
'Doctrine\DBAL\Driver'
);
$platform
=
$this
->
createMock
(
'Doctrine\DBAL\Platforms\PostgreSqlPlatform'
);
$this
->
connection
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Connection'
)
->
setConstructorArgs
(
array
(
array
(
'platform'
=>
$platform
),
$driverMock
))
->
getMock
();
$this
->
schemaManager
=
new
PostgreSqlSchemaManager
(
$this
->
connection
,
$platform
);
}
...
...
tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php
View file @
1e67141a
...
...
@@ -35,7 +35,7 @@ class SchemaDiffTest extends \PHPUnit_Framework_TestCase
public
function
createPlatform
(
$unsafe
=
false
)
{
$platform
=
$this
->
get
Mock
(
'Doctrine\Tests\DBAL\Mocks\MockPlatform'
);
$platform
=
$this
->
create
Mock
(
'Doctrine\Tests\DBAL\Mocks\MockPlatform'
);
$platform
->
expects
(
$this
->
exactly
(
1
))
->
method
(
'getCreateSchemaSQL'
)
->
with
(
'foo_ns'
)
...
...
tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php
View file @
1e67141a
...
...
@@ -349,7 +349,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
public
function
testVisitsVisitor
()
{
$schema
=
new
Schema
();
$visitor
=
$this
->
get
Mock
(
'Doctrine\DBAL\Schema\Visitor\Visitor'
);
$visitor
=
$this
->
create
Mock
(
'Doctrine\DBAL\Schema\Visitor\Visitor'
);
$schema
->
createNamespace
(
'foo'
);
$schema
->
createNamespace
(
'bar'
);
...
...
@@ -364,9 +364,6 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
->
method
(
'acceptSchema'
)
->
with
(
$schema
);
$visitor
->
expects
(
$this
->
never
())
->
method
(
'acceptNamespace'
);
$visitor
->
expects
(
$this
->
at
(
1
))
->
method
(
'acceptTable'
)
->
with
(
$schema
->
getTable
(
'baz'
));
...
...
@@ -398,7 +395,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase
public
function
testVisitsNamespaceVisitor
()
{
$schema
=
new
Schema
();
$visitor
=
$this
->
get
Mock
(
'Doctrine\DBAL\Schema\Visitor\AbstractVisitor'
);
$visitor
=
$this
->
create
Mock
(
'Doctrine\DBAL\Schema\Visitor\AbstractVisitor'
);
$schema
->
createNamespace
(
'foo'
);
$schema
->
createNamespace
(
'bar'
);
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
View file @
1e67141a
...
...
@@ -105,7 +105,7 @@ class CreateSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
public
function
testResetsQueries
()
{
foreach
(
array
(
'supportsSchemas'
,
'supportsForeignKeys'
)
as
$method
)
{
foreach
(
array
(
'supportsSchemas'
,
'supportsForeignKey
Constraint
s'
)
as
$method
)
{
$this
->
platformMock
->
expects
(
$this
->
any
())
->
method
(
$method
)
->
will
(
$this
->
returnValue
(
true
));
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
View file @
1e67141a
...
...
@@ -8,10 +8,9 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
{
public
function
testCreateSchema
()
{
$platformMock
=
$this
->
getMock
(
'Doctrine\DBAL\Platforms\MySqlPlatform'
,
array
(
'getCreateTableSql'
,
'getCreateSequenceSql'
,
'getCreateForeignKeySql'
)
);
$platformMock
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Platforms\MySqlPlatform'
)
->
setMethods
(
array
(
'getCreateTableSql'
,
'getCreateSequenceSql'
,
'getCreateForeignKeySql'
))
->
getMock
();
$platformMock
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getCreateTableSql'
)
->
will
(
$this
->
returnValue
(
array
(
"foo"
)));
...
...
@@ -31,10 +30,9 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
public
function
testDropSchema
()
{
$platformMock
=
$this
->
getMock
(
'Doctrine\DBAL\Platforms\MySqlPlatform'
,
array
(
'getDropTableSql'
,
'getDropSequenceSql'
,
'getDropForeignKeySql'
)
);
$platformMock
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Platforms\MySqlPlatform'
)
->
setMethods
(
array
(
'getDropTableSql'
,
'getDropSequenceSql'
,
'getDropForeignKeySql'
))
->
getMock
();
$platformMock
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getDropTableSql'
)
->
will
(
$this
->
returnValue
(
"tbl"
));
...
...
tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
View file @
1e67141a
...
...
@@ -24,12 +24,15 @@ class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase
{
private
function
createConnectionMock
()
{
return
$this
->
getMock
(
'Doctrine\DBAL\Sharding\PoolingShardConnection'
,
array
(
'connect'
,
'getParams'
,
'fetchAll'
),
array
(),
''
,
false
);
return
$this
->
getMockBuilder
(
'Doctrine\DBAL\Sharding\PoolingShardConnection'
)
->
setMethods
(
array
(
'connect'
,
'getParams'
,
'fetchAll'
))
->
disableOriginalConstructor
()
->
getMock
();
}
private
function
createPassthroughShardChoser
()
{
$mock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Sharding\ShardChoser\ShardChoser'
);
$mock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Sharding\ShardChoser\ShardChoser'
);
$mock
->
expects
(
$this
->
any
())
->
method
(
'pickShard'
)
->
will
(
$this
->
returnCallback
(
function
(
$value
)
{
return
$value
;
}));
...
...
@@ -38,7 +41,7 @@ class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase
private
function
createStaticShardChoser
()
{
$mock
=
$this
->
get
Mock
(
'Doctrine\DBAL\Sharding\ShardChoser\ShardChoser'
);
$mock
=
$this
->
create
Mock
(
'Doctrine\DBAL\Sharding\ShardChoser\ShardChoser'
);
$mock
->
expects
(
$this
->
any
())
->
method
(
'pickShard'
)
->
will
(
$this
->
returnCallback
(
function
(
$value
)
{
return
1
;
}));
...
...
tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
View file @
1e67141a
...
...
@@ -85,7 +85,10 @@ class SQLAzureShardManagerTest extends \PHPUnit_Framework_TestCase
private
function
createConnection
(
array
$params
)
{
$conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(
'getParams'
,
'exec'
,
'isTransactionActive'
),
array
(),
''
,
false
);
$conn
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Connection'
)
->
setMethods
(
array
(
'getParams'
,
'exec'
,
'isTransactionActive'
))
->
disableOriginalConstructor
()
->
getMock
();
$conn
->
expects
(
$this
->
at
(
0
))
->
method
(
'getParams'
)
->
will
(
$this
->
returnValue
(
$params
));
return
$conn
;
}
...
...
tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
View file @
1e67141a
...
...
@@ -34,7 +34,10 @@ class MultiTenantShardChoserTest extends \PHPUnit_Framework_TestCase
private
function
createConnectionMock
()
{
return
$this
->
getMock
(
'Doctrine\DBAL\Sharding\PoolingShardConnection'
,
array
(
'connect'
,
'getParams'
,
'fetchAll'
),
array
(),
''
,
false
);
return
$this
->
getMockBuilder
(
'Doctrine\DBAL\Sharding\PoolingShardConnection'
)
->
setMethods
(
array
(
'connect'
,
'getParams'
,
'fetchAll'
))
->
disableOriginalConstructor
()
->
getMock
();
}
}
tests/Doctrine/Tests/DBAL/StatementTest.php
View file @
1e67141a
...
...
@@ -8,13 +8,13 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
{
/**
*
* @var \Doctrine\DBAL\Connection
* @var \Doctrine\DBAL\Connection
*/
private
$conn
;
/**
*
* @var \Doctrine\DBAL\Configuration
* @var \Doctrine\DBAL\Configuration
*/
private
$configuration
;
...
...
@@ -25,26 +25,30 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
protected
function
setUp
()
{
$this
->
pdoStatement
=
$this
->
getMock
(
'\PDOStatement'
,
array
(
'execute'
,
'bindParam'
,
'bindValue'
));
$this
->
pdoStatement
=
$this
->
getMockBuilder
(
'\PDOStatement'
)
->
setMethods
(
array
(
'execute'
,
'bindParam'
,
'bindValue'
))
->
getMock
();
$platform
=
new
\Doctrine\Tests\DBAL\Mocks\MockPlatform
();
$driverConnection
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Driver\Connection'
);
$driverConnection
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Driver\Connection'
);
$driverConnection
->
expects
(
$this
->
any
())
->
method
(
'prepare'
)
->
will
(
$this
->
returnValue
(
$this
->
pdoStatement
));
$driver
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Driver'
);
$driver
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Driver'
);
$constructorArgs
=
array
(
array
(
'platform'
=>
$platform
),
$driver
);
$this
->
conn
=
$this
->
getMock
(
'\Doctrine\DBAL\Connection'
,
array
(),
$constructorArgs
);
$this
->
conn
=
$this
->
getMockBuilder
(
'\Doctrine\DBAL\Connection'
)
->
setConstructorArgs
(
$constructorArgs
)
->
getMock
();
$this
->
conn
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'getWrappedConnection'
)
->
will
(
$this
->
returnValue
(
$driverConnection
));
$this
->
configuration
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Configuration'
);
$this
->
configuration
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Configuration'
);
$this
->
conn
->
expects
(
$this
->
any
())
->
method
(
'getConfiguration'
)
->
will
(
$this
->
returnValue
(
$this
->
configuration
));
...
...
@@ -54,7 +58,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
->
will
(
$this
->
returnValue
(
$driver
));
}
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound
()
{
$name
=
'foo'
;
...
...
@@ -63,21 +67,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values
=
array
(
$name
=>
$var
);
$types
=
array
(
$name
=>
$type
);
$sql
=
''
;
$logger
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
->
will
(
$this
->
returnValue
(
$logger
));
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
->
bindValue
(
$name
,
$var
,
$type
);
$statement
->
execute
();
}
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute
()
{
$name
=
'foo'
;
...
...
@@ -85,16 +89,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values
=
array
(
$name
=>
$var
);
$types
=
array
();
$sql
=
''
;
$logger
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
->
will
(
$this
->
returnValue
(
$logger
));
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
->
execute
(
$values
);
}
...
...
@@ -104,7 +108,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
*/
public
function
testExecuteCallsLoggerStopQueryOnException
()
{
$logger
=
$this
->
get
Mock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
=
$this
->
create
Mock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
...
...
@@ -128,4 +132,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement
=
new
Statement
(
""
,
$this
->
conn
);
$statement
->
execute
();
}
}
\ No newline at end of file
}
tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php
View file @
1e67141a
...
...
@@ -24,7 +24,7 @@ class RunSqlCommandTest extends \PHPUnit_Framework_TestCase
$this
->
command
=
$application
->
find
(
'dbal:run-sql'
);
$this
->
commandTester
=
new
CommandTester
(
$this
->
command
);
$this
->
connectionMock
=
$this
->
getMock
(
'\Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$this
->
connectionMock
=
$this
->
createMock
(
'\Doctrine\DBAL\Connection'
);
$this
->
connectionMock
->
method
(
'fetchAll'
)
->
willReturn
(
array
(
array
(
1
)));
$this
->
connectionMock
->
method
(
'executeUpdate'
)
...
...
tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
View file @
1e67141a
...
...
@@ -32,7 +32,7 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase
{
$this
->
assertTrue
(
$this
->
_type
->
requiresSQLCommentHint
(
$this
->
_platform
));
$mock
=
$this
->
get
Mock
(
get_class
(
$this
->
_platform
));
$mock
=
$this
->
create
Mock
(
get_class
(
$this
->
_platform
));
$mock
->
expects
(
$this
->
any
())
->
method
(
'hasNativeGuidType'
)
->
will
(
$this
->
returnValue
(
true
));
...
...
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