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
b6b44f87
Unverified
Commit
b6b44f87
authored
Aug 26, 2019
by
Marco Pivetta
Committed by
GitHub
Aug 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3664 from baspeeters/refactor-deprecated-mock-calls
Refactor usage of MockBuilder's deprecated setMethods()
parents
54b52aed
36f7e929
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
35 additions
and
36 deletions
+35
-36
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+8
-8
OCI8StatementTest.php
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
+2
-2
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+5
-6
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+6
-6
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+4
-4
DB2SchemaManagerTest.php
tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
+1
-1
MySqlSchemaManagerTest.php
tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
+1
-1
CreateSchemaSqlCollectorTest.php
...ests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
+1
-1
DropSchemaSqlCollectorTest.php
.../Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
+1
-1
SchemaSqlCollectorTest.php
...rine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
+2
-2
PoolingShardManagerTest.php
.../Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
+1
-1
SQLAzureShardManagerTest.php
...Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
+1
-1
MultiTenantShardChoserTest.php
.../DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
+1
-1
StatementTest.php
tests/Doctrine/Tests/DBAL/StatementTest.php
+1
-1
No files found.
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
b6b44f87
...
...
@@ -67,7 +67,7 @@ class ConnectionTest extends DbalTestCase
$platform
=
$this
->
getMockForAbstractClass
(
AbstractPlatform
::
class
);
return
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'executeUpdate'
])
->
only
Methods
([
'executeUpdate'
])
->
setConstructorArgs
([[
'platform'
=>
$platform
],
$driverMock
])
->
getMock
();
}
...
...
@@ -145,8 +145,8 @@ class ConnectionTest extends DbalTestCase
public
function
testConnectDispatchEvent
()
:
void
{
$listenerMock
=
$this
->
getMockBuilder
(
'ConnectDispatchEventListener'
)
->
set
Methods
([
'postConnect'
])
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'ConnectDispatchEventListener'
)
)
->
add
Methods
([
'postConnect'
])
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'postConnect'
);
...
...
@@ -566,7 +566,7 @@ class ConnectionTest extends DbalTestCase
/** @var Connection|MockObject $conn */
$conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'executeQuery'
])
->
only
Methods
([
'executeQuery'
])
->
setConstructorArgs
([[],
$driverMock
])
->
getMock
();
...
...
@@ -602,7 +602,7 @@ class ConnectionTest extends DbalTestCase
/** @var Connection|MockObject $conn */
$conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'executeQuery'
])
->
only
Methods
([
'executeQuery'
])
->
setConstructorArgs
([[],
$driverMock
])
->
getMock
();
...
...
@@ -639,7 +639,7 @@ class ConnectionTest extends DbalTestCase
/** @var Connection|MockObject $conn */
$conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'executeQuery'
])
->
only
Methods
([
'executeQuery'
])
->
setConstructorArgs
([[],
$driverMock
])
->
getMock
();
...
...
@@ -674,7 +674,7 @@ class ConnectionTest extends DbalTestCase
/** @var Connection|MockObject $conn */
$conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'executeQuery'
])
->
only
Methods
([
'executeQuery'
])
->
setConstructorArgs
([[],
$driverMock
])
->
getMock
();
...
...
@@ -756,7 +756,7 @@ class ConnectionTest extends DbalTestCase
$conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
setConstructorArgs
([[
'pdo'
=>
$pdoMock
,
'platform'
=>
$platformMock
],
$driverMock
])
->
set
Methods
([
'connect'
])
->
only
Methods
([
'connect'
])
->
getMock
();
$conn
->
expects
(
$this
->
once
())
->
method
(
'connect'
);
...
...
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
View file @
b6b44f87
...
...
@@ -36,7 +36,7 @@ class OCI8StatementTest extends DbalTestCase
public
function
testExecute
(
array
$params
)
:
void
{
$statement
=
$this
->
getMockBuilder
(
OCI8Statement
::
class
)
->
set
Methods
([
'bindValue'
,
'errorInfo'
])
->
only
Methods
([
'bindValue'
,
'errorInfo'
])
->
disableOriginalConstructor
()
->
getMock
();
...
...
@@ -67,7 +67,7 @@ class OCI8StatementTest extends 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
->
getMockBuilder
(
OCI8Connection
::
class
)
->
set
Methods
([
'getExecuteMode'
])
->
only
Methods
([
'getExecuteMode'
])
->
disableOriginalConstructor
()
->
getMock
();
$conn
->
expects
(
$this
->
once
())
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
b6b44f87
...
...
@@ -367,10 +367,10 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$this
->
schemaManager
->
dropAndCreateTable
(
$table
);
$listenerMock
=
$this
->
getMockBuilder
(
'ListTableColumnsDispatchEventListener'
)
->
setMethods
([
'onSchemaColumnDefinition'
])
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'ListTableColumnsDispatchEventListener'
))
->
addMethods
([
'onSchemaColumnDefinition'
])
->
getMock
();
$listenerMock
->
expects
(
$this
->
exactly
(
7
))
->
method
(
'onSchemaColumnDefinition'
);
...
...
@@ -395,9 +395,8 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$this
->
schemaManager
->
dropAndCreateTable
(
$table
);
$listenerMock
=
$this
->
getMockBuilder
(
'ListTableIndexesDispatchEventListener'
)
->
setMethods
([
'onSchemaIndexDefinition'
])
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'ListTableIndexesDispatchEventListener'
))
->
addMethods
([
'onSchemaIndexDefinition'
])
->
getMock
();
$listenerMock
->
expects
(
$this
->
exactly
(
3
))
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
b6b44f87
...
...
@@ -380,8 +380,8 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public
function
testGetCreateTableSqlDispatchEvent
()
:
void
{
$listenerMock
=
$this
->
getMockBuilder
(
'GetCreateTableSqlDispatchEvenListener'
)
->
set
Methods
([
'onSchemaCreateTable'
,
'onSchemaCreateTableColumn'
])
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'GetCreateTableSqlDispatchEvenListener'
)
)
->
add
Methods
([
'onSchemaCreateTable'
,
'onSchemaCreateTableColumn'
])
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
...
...
@@ -404,8 +404,8 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public
function
testGetDropTableSqlDispatchEvent
()
:
void
{
$listenerMock
=
$this
->
getMockBuilder
(
'GetDropTableSqlDispatchEventListener'
)
->
set
Methods
([
'onSchemaDropTable'
])
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'GetDropTableSqlDispatchEventListener'
)
)
->
add
Methods
([
'onSchemaDropTable'
])
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
...
...
@@ -429,8 +429,8 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
'onSchemaAlterTableRenameColumn'
,
];
$listenerMock
=
$this
->
getMockBuilder
(
'GetAlterTableSqlDispatchEvenListener'
)
->
set
Methods
(
$events
)
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'GetAlterTableSqlDispatchEvenListener'
)
)
->
add
Methods
(
$events
)
->
getMock
();
$listenerMock
->
expects
(
$this
->
once
())
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
b6b44f87
...
...
@@ -617,7 +617,7 @@ class ComparatorTest extends TestCase
$c
=
new
Comparator
();
$diff
=
$c
->
compare
(
$schemaA
,
$schemaB
);
self
::
assertSchemaTableChangeCount
(
$diff
,
1
,
0
,
1
);
$this
->
assertSchemaTableChangeCount
(
$diff
,
1
,
0
,
1
);
}
public
function
testSequencesCaseInsensitive
()
:
void
...
...
@@ -637,7 +637,7 @@ class ComparatorTest extends TestCase
$c
=
new
Comparator
();
$diff
=
$c
->
compare
(
$schemaA
,
$schemaB
);
self
::
assertSchemaSequenceChangeCount
(
$diff
,
1
,
0
,
1
);
$this
->
assertSchemaSequenceChangeCount
(
$diff
,
1
,
0
,
1
);
}
public
function
testCompareColumnCompareCaseInsensitive
()
:
void
...
...
@@ -1172,10 +1172,10 @@ class ComparatorTest extends TestCase
{
$comparator
=
new
Comparator
();
$fromSchema
=
$this
->
getMockBuilder
(
Schema
::
class
)
->
set
Methods
([
'getNamespaces'
,
'hasNamespace'
])
->
only
Methods
([
'getNamespaces'
,
'hasNamespace'
])
->
getMock
();
$toSchema
=
$this
->
getMockBuilder
(
Schema
::
class
)
->
set
Methods
([
'getNamespaces'
,
'hasNamespace'
])
->
only
Methods
([
'getNamespaces'
,
'hasNamespace'
])
->
getMock
();
$fromSchema
->
expects
(
$this
->
once
())
...
...
tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
View file @
b6b44f87
...
...
@@ -30,7 +30,7 @@ final class DB2SchemaManagerTest extends TestCase
$platform
=
$this
->
createMock
(
DB2Platform
::
class
);
$this
->
conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'fetchAll'
,
'quote'
])
->
only
Methods
([
'fetchAll'
,
'quote'
])
->
setConstructorArgs
([[
'platform'
=>
$platform
],
$driverMock
,
new
Configuration
(),
$eventManager
])
->
getMock
();
$this
->
manager
=
new
DB2SchemaManager
(
$this
->
conn
);
...
...
tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
View file @
b6b44f87
...
...
@@ -27,7 +27,7 @@ class MySqlSchemaManagerTest extends TestCase
$driverMock
=
$this
->
createMock
(
Driver
::
class
);
$platform
=
$this
->
createMock
(
MySqlPlatform
::
class
);
$this
->
conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'fetchAll'
])
->
only
Methods
([
'fetchAll'
])
->
setConstructorArgs
([[
'platform'
=>
$platform
],
$driverMock
,
new
Configuration
(),
$eventManager
])
->
getMock
();
$this
->
manager
=
new
MySqlSchemaManager
(
$this
->
conn
);
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
View file @
b6b44f87
...
...
@@ -26,7 +26,7 @@ class CreateSchemaSqlCollectorTest extends TestCase
parent
::
setUp
();
$this
->
platformMock
=
$this
->
getMockBuilder
(
AbstractPlatform
::
class
)
->
set
Methods
(
->
only
Methods
(
[
'getCreateForeignKeySQL'
,
'getCreateSchemaSQL'
,
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
View file @
b6b44f87
...
...
@@ -23,7 +23,7 @@ class DropSchemaSqlCollectorTest extends TestCase
$keyConstraintTwo
=
$this
->
getStubKeyConstraint
(
'second'
);
$platform
=
$this
->
getMockBuilder
(
AbstractPlatform
::
class
)
->
set
Methods
([
'getDropForeignKeySQL'
])
->
only
Methods
([
'getDropForeignKeySQL'
])
->
getMockForAbstractClass
();
$collector
=
new
DropSchemaSqlCollector
(
$platform
);
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
View file @
b6b44f87
...
...
@@ -11,7 +11,7 @@ class SchemaSqlCollectorTest extends TestCase
public
function
testCreateSchema
()
:
void
{
$platformMock
=
$this
->
getMockBuilder
(
MySqlPlatform
::
class
)
->
set
Methods
([
'getCreateTableSql'
,
'getCreateSequenceSql'
,
'getCreateForeignKeySql'
])
->
only
Methods
([
'getCreateTableSql'
,
'getCreateSequenceSql'
,
'getCreateForeignKeySql'
])
->
getMock
();
$platformMock
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getCreateTableSql'
)
...
...
@@ -33,7 +33,7 @@ class SchemaSqlCollectorTest extends TestCase
public
function
testDropSchema
()
:
void
{
$platformMock
=
$this
->
getMockBuilder
(
MySqlPlatform
::
class
)
->
set
Methods
([
'getDropTableSql'
,
'getDropSequenceSql'
,
'getDropForeignKeySql'
])
->
only
Methods
([
'getDropTableSql'
,
'getDropSequenceSql'
,
'getDropForeignKeySql'
])
->
getMock
();
$platformMock
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getDropTableSql'
)
...
...
tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
View file @
b6b44f87
...
...
@@ -16,7 +16,7 @@ class PoolingShardManagerTest extends TestCase
private
function
createConnectionMock
()
:
PoolingShardConnection
{
return
$this
->
getMockBuilder
(
PoolingShardConnection
::
class
)
->
set
Methods
([
'connect'
,
'getParams'
,
'fetchAll'
])
->
only
Methods
([
'connect'
,
'getParams'
,
'fetchAll'
])
->
disableOriginalConstructor
()
->
getMock
();
}
...
...
tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
View file @
b6b44f87
...
...
@@ -85,7 +85,7 @@ class SQLAzureShardManagerTest extends TestCase
private
function
createConnection
(
array
$params
)
:
Connection
{
$conn
=
$this
->
getMockBuilder
(
Connection
::
class
)
->
set
Methods
([
'getParams'
,
'exec'
,
'isTransactionActive'
])
->
only
Methods
([
'getParams'
,
'exec'
,
'isTransactionActive'
])
->
disableOriginalConstructor
()
->
getMock
();
$conn
->
expects
(
$this
->
at
(
0
))
->
method
(
'getParams'
)
->
will
(
$this
->
returnValue
(
$params
));
...
...
tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
View file @
b6b44f87
...
...
@@ -20,7 +20,7 @@ class MultiTenantShardChoserTest extends TestCase
private
function
createConnectionMock
()
:
PoolingShardConnection
{
return
$this
->
getMockBuilder
(
PoolingShardConnection
::
class
)
->
set
Methods
([
'connect'
,
'getParams'
,
'fetchAll'
])
->
only
Methods
([
'connect'
,
'getParams'
,
'fetchAll'
])
->
disableOriginalConstructor
()
->
getMock
();
}
...
...
tests/Doctrine/Tests/DBAL/StatementTest.php
View file @
b6b44f87
...
...
@@ -28,7 +28,7 @@ class StatementTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
pdoStatement
=
$this
->
getMockBuilder
(
PDOStatement
::
class
)
->
set
Methods
([
'execute'
,
'bindParam'
,
'bindValue'
])
->
only
Methods
([
'execute'
,
'bindParam'
,
'bindValue'
])
->
getMock
();
$driverConnection
=
$this
->
createMock
(
DriverConnection
::
class
);
...
...
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