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
9f9629c0
Unverified
Commit
9f9629c0
authored
May 27, 2020
by
Grégoire Paris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid mocking inexistent classes
It confuses both Psalm and PHPStan, and involves complicated mocking.
parent
b00a2e3a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
27 deletions
+46
-27
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+6
-3
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+12
-7
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+28
-17
No files found.
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
9f9629c0
...
...
@@ -144,9 +144,7 @@ class ConnectionTest extends DbalTestCase
public
function
testConnectDispatchEvent
()
:
void
{
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'ConnectDispatchEventListener'
))
->
addMethods
([
'postConnect'
])
->
getMock
();
$listenerMock
=
$this
->
createMock
(
ConnectDispatchEventListener
::
class
);
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'postConnect'
);
$eventManager
=
new
EventManager
();
...
...
@@ -948,3 +946,8 @@ class ConnectionTest extends DbalTestCase
$connection
->
executeCacheQuery
(
$query
,
[],
[],
$queryCacheProfile
);
}
}
interface
ConnectDispatchEventListener
{
public
function
postConnect
()
:
void
;
}
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
9f9629c0
...
...
@@ -369,10 +369,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$this
->
schemaManager
->
dropAndCreateTable
(
$table
);
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'ListTableColumnsDispatchEventListener'
))
->
addMethods
([
'onSchemaColumnDefinition'
])
->
getMock
();
$listenerMock
=
$this
->
createMock
(
ListTableColumnsDispatchEventListener
::
class
);
$listenerMock
->
expects
(
$this
->
exactly
(
7
))
->
method
(
'onSchemaColumnDefinition'
);
...
...
@@ -397,9 +394,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$this
->
schemaManager
->
dropAndCreateTable
(
$table
);
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'ListTableIndexesDispatchEventListener'
))
->
addMethods
([
'onSchemaIndexDefinition'
])
->
getMock
();
$listenerMock
=
$this
->
createMock
(
ListTableIndexesDispatchEventListener
::
class
);
$listenerMock
->
expects
(
$this
->
exactly
(
3
))
->
method
(
'onSchemaIndexDefinition'
);
...
...
@@ -1653,3 +1648,13 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
}
}
}
interface
ListTableColumnsDispatchEventListener
{
public
function
onSchemaColumnDefinition
()
:
void
;
}
interface
ListTableIndexesDispatchEventListener
{
public
function
onSchemaIndexDefinition
()
:
void
;
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
9f9629c0
...
...
@@ -372,9 +372,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public
function
testGetCreateTableSqlDispatchEvent
()
:
void
{
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'GetCreateTableSqlDispatchEvenListener'
))
->
addMethods
([
'onSchemaCreateTable'
,
'onSchemaCreateTableColumn'
])
->
getMock
();
$listenerMock
=
$this
->
createMock
(
GetCreateTableSqlDispatchEventListener
::
class
);
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'onSchemaCreateTable'
);
...
...
@@ -396,9 +394,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public
function
testGetDropTableSqlDispatchEvent
()
:
void
{
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'GetDropTableSqlDispatchEventListener'
))
->
addMethods
([
'onSchemaDropTable'
])
->
getMock
();
$listenerMock
=
$this
->
createMock
(
GetDropTableSqlDispatchEventListener
::
class
);
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'onSchemaDropTable'
);
...
...
@@ -413,17 +409,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public
function
testGetAlterTableSqlDispatchEvent
()
:
void
{
$events
=
[
'onSchemaAlterTable'
,
'onSchemaAlterTableAddColumn'
,
'onSchemaAlterTableRemoveColumn'
,
'onSchemaAlterTableChangeColumn'
,
'onSchemaAlterTableRenameColumn'
,
];
$listenerMock
=
$this
->
getMockBuilder
(
$this
->
getMockClass
(
'GetAlterTableSqlDispatchEvenListener'
))
->
addMethods
(
$events
)
->
getMock
();
$listenerMock
=
$this
->
createMock
(
GetAlterTableSqlDispatchEventListener
::
class
);
$listenerMock
->
expects
(
$this
->
once
())
->
method
(
'onSchemaAlterTable'
);
...
...
@@ -1532,3 +1518,28 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
);
}
}
interface
GetCreateTableSqlDispatchEventListener
{
public
function
onSchemaCreateTable
()
:
void
;
public
function
onSchemaCreateTableColumn
()
:
void
;
}
interface
GetAlterTableSqlDispatchEventListener
{
public
function
onSchemaAlterTable
()
:
void
;
public
function
onSchemaAlterTableAddColumn
()
:
void
;
public
function
onSchemaAlterTableRemoveColumn
()
:
void
;
public
function
onSchemaAlterTableChangeColumn
()
:
void
;
public
function
onSchemaAlterTableRenameColumn
()
:
void
;
}
interface
GetDropTableSqlDispatchEventListener
{
public
function
onSchemaDropTable
()
:
void
;
}
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