22
22
namespace WikibaseSolutions \CypherDSL \Tests \Unit ;
23
23
24
24
use PHPUnit \Framework \TestCase ;
25
+ use TypeError ;
25
26
use WikibaseSolutions \CypherDSL \ExpressionList ;
26
27
use WikibaseSolutions \CypherDSL \Query ;
27
28
@@ -32,19 +33,33 @@ class ExpressionListTest extends TestCase
32
33
{
33
34
use TestHelper;
34
35
35
- public function testEmpty ()
36
+ public function testEmpty (): void
36
37
{
37
38
$ expressionList = new ExpressionList ([]);
38
39
39
40
$ this ->assertSame ("[] " , $ expressionList ->toQuery ());
40
41
}
41
42
43
+ public function testFromLiterals (): void
44
+ {
45
+ $ expressionList = ExpressionList::fromLiterals (['a ' , 'b ' , 234.3 , 1 , true , false ]);
46
+
47
+ $ this ->assertSame ("['a', 'b', 234.3, 1, true, false] " , $ expressionList ->toQuery ());
48
+ }
49
+
50
+ public function testFromLiteralsError (): void
51
+ {
52
+ $ expressionList = ExpressionList::fromLiterals (['a ' , 'b ' , 234.3 , 1 , true , false ]);
53
+ $ this ->expectException (TypeError::class);
54
+ $ expressionList = ExpressionList::fromLiterals ([$ expressionList ]);
55
+ }
56
+
42
57
/**
43
58
* @dataProvider provideOneDimensionalData
44
59
* @param array $expressions
45
60
* @param string $expected
46
61
*/
47
- public function testOneDimensional (array $ expressions , string $ expected )
62
+ public function testOneDimensional (array $ expressions , string $ expected ): void
48
63
{
49
64
$ expressionList = new ExpressionList ($ expressions );
50
65
@@ -56,7 +71,7 @@ public function testOneDimensional(array $expressions, string $expected)
56
71
* @param array $expressions
57
72
* @param string $expected
58
73
*/
59
- public function testMultidimensional (array $ expressions , string $ expected )
74
+ public function testMultidimensional (array $ expressions , string $ expected ): void
60
75
{
61
76
$ expressionList = new ExpressionList ($ expressions );
62
77
0 commit comments