Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Condition example
/** * @covers ::compile * @dataProvider providerSimpleCondition */
public
function
testSimpleCondition
(
$expected
,
$field_name
)
{
$connection
=
$this
->
prophesize
(
Connection::
class
)
;
$connection
->
escapeField
(
$field_name
)
->
will
(
function
D
$args
)
{
return
preg_replace
(
'/[^A-Za-z0-9_.]+/', '',
$args
[
0
]
)
;
}
)
;
$connection
->
mapConditionOperator
(
'='
)
->
willReturn
(
[
'operator' => '='
]
)
;
$connection
->
condition
(
'AND'
)
->
willReturn
(
new
Condition
(
'AND'
)
)
;
$connection
=
$connection
->
reveal
(
)
;
$query_placeholder
=
$this
->
prophesize
(
PlaceholderInterface::
class
)
;
$counter
= 0;
$query_placeholder
->
nextPlaceholder
(
)
->
will
(
function
D
)
use
(
&
$counter
)
{
return
$counter
++;
}
)
;
$query_placeholder
->
uniqueIdentifier
(
)
->
willReturn
(
4
)
;
$query_placeholder
=
$query_placeholder
->
reveal
(
)
;