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
bce4a363
Commit
bce4a363
authored
Jul 15, 2016
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make test compatible with 2.5 branch
parent
cca70273
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
StatementTest.php
tests/Doctrine/Tests/DBAL/StatementTest.php
+19
-20
No files found.
tests/Doctrine/Tests/DBAL/StatementTest.php
View file @
bce4a363
...
@@ -3,19 +3,18 @@
...
@@ -3,19 +3,18 @@
namespace
Doctrine\Tests\DBAL
;
namespace
Doctrine\Tests\DBAL
;
use
Doctrine\DBAL\Statement
;
use
Doctrine\DBAL\Statement
;
use
Doctrine\DBAL\Logging\SQLLogger
;
class
StatementTest
extends
\Doctrine\Tests\DbalTestCase
class
StatementTest
extends
\Doctrine\Tests\DbalTestCase
{
{
/**
/**
*
*
* @var \Doctrine\DBAL\Connection
* @var \Doctrine\DBAL\Connection
*/
*/
private
$conn
;
private
$conn
;
/**
/**
*
*
* @var \Doctrine\DBAL\Configuration
* @var \Doctrine\DBAL\Configuration
*/
*/
private
$configuration
;
private
$configuration
;
...
@@ -32,7 +31,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -32,7 +31,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$driverConnection
->
expects
(
$this
->
any
())
$driverConnection
->
expects
(
$this
->
any
())
->
method
(
'prepare'
)
->
method
(
'prepare'
)
->
will
(
$this
->
returnValue
(
$this
->
pdoStatement
));
->
will
(
$this
->
returnValue
(
$this
->
pdoStatement
));
$driver
=
$this
->
getMock
(
'\Doctrine\DBAL\Driver'
);
$driver
=
$this
->
getMock
(
'\Doctrine\DBAL\Driver'
);
$constructorArgs
=
array
(
$constructorArgs
=
array
(
array
(
array
(
...
@@ -44,7 +43,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -44,7 +43,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$this
->
conn
->
expects
(
$this
->
atLeastOnce
())
$this
->
conn
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'getWrappedConnection'
)
->
method
(
'getWrappedConnection'
)
->
will
(
$this
->
returnValue
(
$driverConnection
));
->
will
(
$this
->
returnValue
(
$driverConnection
));
$this
->
configuration
=
$this
->
getMock
(
'\Doctrine\DBAL\Configuration'
);
$this
->
configuration
=
$this
->
getMock
(
'\Doctrine\DBAL\Configuration'
);
$this
->
conn
->
expects
(
$this
->
any
())
$this
->
conn
->
expects
(
$this
->
any
())
->
method
(
'getConfiguration'
)
->
method
(
'getConfiguration'
)
...
@@ -55,7 +54,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -55,7 +54,7 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
->
will
(
$this
->
returnValue
(
$driver
));
->
will
(
$this
->
returnValue
(
$driver
));
}
}
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound
()
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound
()
{
{
$name
=
'foo'
;
$name
=
'foo'
;
...
@@ -64,21 +63,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -64,21 +63,21 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values
=
array
(
$name
=>
$var
);
$values
=
array
(
$name
=>
$var
);
$types
=
array
(
$name
=>
$type
);
$types
=
array
(
$name
=>
$type
);
$sql
=
''
;
$sql
=
''
;
$logger
=
$this
->
getMock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
=
$this
->
getMock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
->
expects
(
$this
->
once
())
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
$this
->
configuration
->
expects
(
$this
->
once
())
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
->
method
(
'getSQLLogger'
)
->
will
(
$this
->
returnValue
(
$logger
));
->
will
(
$this
->
returnValue
(
$logger
));
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
->
bindValue
(
$name
,
$var
,
$type
);
$statement
->
bindValue
(
$name
,
$var
,
$type
);
$statement
->
execute
();
$statement
->
execute
();
}
}
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute
()
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute
()
{
{
$name
=
'foo'
;
$name
=
'foo'
;
...
@@ -86,16 +85,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -86,16 +85,16 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$values
=
array
(
$name
=>
$var
);
$values
=
array
(
$name
=>
$var
);
$types
=
array
();
$types
=
array
();
$sql
=
''
;
$sql
=
''
;
$logger
=
$this
->
getMock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
=
$this
->
getMock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
->
expects
(
$this
->
once
())
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
$this
->
configuration
->
expects
(
$this
->
once
())
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
->
method
(
'getSQLLogger'
)
->
will
(
$this
->
returnValue
(
$logger
));
->
will
(
$this
->
returnValue
(
$logger
));
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
->
execute
(
$values
);
$statement
->
execute
(
$values
);
}
}
...
@@ -104,14 +103,14 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -104,14 +103,14 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
{
{
$name
=
'foo'
;
$name
=
'foo'
;
$var
=
'bar'
;
$var
=
'bar'
;
$values
=
[
$name
=>
$var
]
;
$values
=
array
(
$name
=>
$var
)
;
$types
=
[
$name
=>
\PDO
::
PARAM_STR
]
;
$types
=
array
(
$name
=>
\PDO
::
PARAM_STR
)
;
$sql
=
''
;
$sql
=
''
;
$logger
=
$this
->
createMock
(
SQLLogger
::
class
);
$logger
=
$this
->
getMock
(
'Doctrine\DBAL\Logging\SQLLogger'
);
$logger
->
expects
(
self
::
once
())
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
method
(
'startQuery'
)
->
with
(
self
::
equalTo
(
$sql
),
self
::
equalTo
(
$values
),
self
::
equalTo
(
$types
));
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
$this
->
configuration
->
expects
(
self
::
once
())
$this
->
configuration
->
expects
(
self
::
once
())
->
method
(
'getSQLLogger'
)
->
method
(
'getSQLLogger'
)
...
@@ -151,4 +150,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
...
@@ -151,4 +150,4 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement
=
new
Statement
(
""
,
$this
->
conn
);
$statement
=
new
Statement
(
""
,
$this
->
conn
);
$statement
->
execute
();
$statement
->
execute
();
}
}
}
}
\ No newline at end of file
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