2 declare(strict_types = 1);
30 $restriction = $this->prophesize();
31 $restriction->willImplement(QueryRestrictionInterface::class);
32 $restriction->willImplement(EnforceableQueryRestrictionInterface::class);
33 $restriction->buildExpression([
'aTable' =>
'aTable'], $this->expressionBuilder)
36 $restriction->isEnforced()->willReturn(
true);
39 $subject->add($restriction->reveal());
40 $subject->removeAll();
42 $expression = $subject->buildExpression([
'aTable' =>
'aTable'], $this->expressionBuilder);
43 $this->assertSame(
'"aTable"."pid" = 0', (
string)$expression);
51 $restriction = $this->prophesize();
52 $restriction->willImplement(QueryRestrictionInterface::class);
53 $restriction->willImplement(EnforceableQueryRestrictionInterface::class);
54 $restriction->buildExpression()->shouldNotBeCalled();
55 $restriction->isEnforced()->willReturn(
true);
58 $restriction = $restriction->reveal();
59 $subject->add($restriction);
60 $subject->removeByType(get_class($restriction));
62 $expression = $subject->buildExpression([
'aTable' =>
'aTable'], $this->expressionBuilder);
63 $this->assertSame(
'', (
string)$expression);
71 $restriction = $this->prophesize();
72 $restriction->willImplement(QueryRestrictionInterface::class);
73 $restriction->willImplement(EnforceableQueryRestrictionInterface::class);
74 $restriction->buildExpression()->shouldNotBeCalled();
75 $restriction->isEnforced()->willReturn(
true);
78 $restriction = $restriction->reveal();
79 $subject->add($restriction);
80 $subject->removeByType(get_class($restriction));
81 $subject->removeAll();
83 $expression = $subject->buildExpression([
'aTable' =>
'aTable'], $this->expressionBuilder);
84 $this->assertSame(
'', (
string)$expression);
92 $restriction = $this->prophesize();
93 $restriction->willImplement(QueryRestrictionInterface::class);
94 $restriction->buildExpression()->shouldNotBeCalled();
97 $subject->add($restriction->reveal());
98 $subject->removeAll();
100 $expression = $subject->buildExpression([
'aTable' =>
'aTable'], $this->expressionBuilder);
101 $this->assertSame(
'', (
string)$expression);
109 $restriction = $this->prophesize();
110 $restriction->willImplement(QueryRestrictionInterface::class);
111 $restriction->willImplement(EnforceableQueryRestrictionInterface::class);
112 $restriction->buildExpression()->shouldNotBeCalled();
113 $restriction->isEnforced()->willReturn(
false);
116 $subject->add($restriction->reveal());
117 $subject->removeAll();
119 $expression = $subject->buildExpression([
'aTable' =>
'aTable'], $this->expressionBuilder);
120 $this->assertSame(
'', (
string)$expression);