Skip to content

Commit f5ddd0c

Browse files
Remove mocks from ProcedureTest
1 parent 543d69b commit f5ddd0c

File tree

2 files changed

+24
-31
lines changed

2 files changed

+24
-31
lines changed

tests/unit/Expressions/ExistsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* @covers \WikibaseSolutions\CypherDSL\Expressions\Exists
2626
*/
27-
class ExistsTest extends TestCase
27+
final class ExistsTest extends TestCase
2828
{
2929
public function testToQuery(): void
3030
{

tests/unit/Expressions/Procedures/ProcedureTest.php

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace WikibaseSolutions\CypherDSL\Tests\Unit\Expressions\Procedures;
1111

1212
use PHPUnit\Framework\TestCase;
13+
use WikibaseSolutions\CypherDSL\Expressions\Literals\Boolean;
1314
use WikibaseSolutions\CypherDSL\Expressions\Literals\List_;
1415
use WikibaseSolutions\CypherDSL\Expressions\Literals\Literal;
1516
use WikibaseSolutions\CypherDSL\Expressions\Literals\Map;
@@ -28,12 +29,13 @@
2829
use WikibaseSolutions\CypherDSL\Expressions\Procedures\Single;
2930
use WikibaseSolutions\CypherDSL\Expressions\Procedures\Time;
3031
use WikibaseSolutions\CypherDSL\Expressions\Variable;
32+
use WikibaseSolutions\CypherDSL\Query;
3133
use WikibaseSolutions\CypherDSL\Types\AnyType;
3234

3335
/**
3436
* @covers \WikibaseSolutions\CypherDSL\Expressions\Procedures\Procedure
3537
*/
36-
class ProcedureTest extends TestCase
38+
final class ProcedureTest extends TestCase
3739
{
3840
public function testRaw(): void
3941
{
@@ -44,9 +46,9 @@ public function testRaw(): void
4446

4547
public function testAll(): void
4648
{
47-
$variable = new Variable("a");
48-
$list = new List_;
49-
$predicate = $this->createMock(AnyType::class);
49+
$variable = Query::variable('a');
50+
$list = Query::list([]);
51+
$predicate = Query::boolean(true);
5052

5153
$all = Procedure::all($variable, $list, $predicate);
5254

@@ -55,9 +57,9 @@ public function testAll(): void
5557

5658
public function testAny(): void
5759
{
58-
$variable = new Variable("a");
59-
$list = new List_;
60-
$predicate = $this->createMock(AnyType::class);
60+
$variable = Query::variable('a');
61+
$list = Query::list([]);
62+
$predicate = Query::boolean(true);
6163

6264
$any = Procedure::any($variable, $list, $predicate);
6365

@@ -66,7 +68,7 @@ public function testAny(): void
6668

6769
public function testExists(): void
6870
{
69-
$expression = $this->createMock(AnyType::class);
71+
$expression = Query::string("Hello World");
7072

7173
$exists = Procedure::exists($expression);
7274

@@ -75,7 +77,7 @@ public function testExists(): void
7577

7678
public function testIsEmpty(): void
7779
{
78-
$list = new List_;
80+
$list = Query::list([]);
7981

8082
$isEmpty = Procedure::isEmpty($list);
8183

@@ -84,9 +86,9 @@ public function testIsEmpty(): void
8486

8587
public function testNone(): void
8688
{
87-
$variable = new Variable("a");
88-
$list = new List_;
89-
$predicate = $this->createMock(AnyType::class);
89+
$variable = Query::variable('a');
90+
$list = Query::list([]);
91+
$predicate = Query::boolean(true);
9092

9193
$none = Procedure::none($variable, $list, $predicate);
9294

@@ -95,9 +97,9 @@ public function testNone(): void
9597

9698
public function testSingle(): void
9799
{
98-
$variable = new Variable("a");
99-
$list = new List_;
100-
$predicate = $this->createMock(AnyType::class);
100+
$variable = Query::variable('a');
101+
$list = Query::list([]);
102+
$predicate = Query::boolean(true);
101103

102104
$single = Procedure::single($variable, $list, $predicate);
103105

@@ -106,7 +108,7 @@ public function testSingle(): void
106108

107109
public function testPoint(): void
108110
{
109-
$map = new Map([]);
111+
$map = Query::map([]);
110112

111113
$point = Procedure::point($map);
112114

@@ -115,7 +117,7 @@ public function testPoint(): void
115117

116118
public function testDate(): void
117119
{
118-
$value = $this->createMock(AnyType::class);
120+
$value = Query::string("Hello World!");
119121

120122
$date = Procedure::date($value);
121123

@@ -128,7 +130,7 @@ public function testDate(): void
128130

129131
public function testDateTime(): void
130132
{
131-
$value = $this->createMock(AnyType::class);
133+
$value = Query::string("Hello World!");
132134

133135
$date = Procedure::datetime($value);
134136

@@ -141,7 +143,7 @@ public function testDateTime(): void
141143

142144
public function testLocalDateTime(): void
143145
{
144-
$value = $this->createMock(AnyType::class);
146+
$value = Query::string("Hello World!");
145147

146148
$date = Procedure::localdatetime($value);
147149

@@ -154,7 +156,7 @@ public function testLocalDateTime(): void
154156

155157
public function testLocalTime(): void
156158
{
157-
$value = $this->createMock(AnyType::class);
159+
$value = Query::string("Hello World!");
158160

159161
$date = Procedure::localtime($value);
160162

@@ -167,7 +169,7 @@ public function testLocalTime(): void
167169

168170
public function testTime(): void
169171
{
170-
$value = $this->createMock(AnyType::class);
172+
$value = Query::string("Hello World!");
171173

172174
$date = Procedure::time($value);
173175

@@ -177,13 +179,4 @@ public function testTime(): void
177179

178180
$this->assertInstanceOf(Time::class, $date);
179181
}
180-
181-
public function testToQuery(): void
182-
{
183-
$mock = $this->getMockForAbstractClass(Procedure::class);
184-
$mock->method('getSignature')->willReturn('foo(%s)');
185-
$mock->method('getParameters')->willReturn([Literal::string('bar')]);
186-
187-
$this->assertSame("foo('bar')", $mock->toQuery());
188-
}
189182
}

0 commit comments

Comments
 (0)