Skip to content

Commit f39d8e0

Browse files
Ensure all tests pass, and fix deprecation warnings
1 parent b18ae49 commit f39d8e0

16 files changed

Lines changed: 1003 additions & 745 deletions

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ After making your changes and adding your tests, you can check whether the minim
6969
```
7070
$ XDEBUG_MODE=coverage php vendor/bin/phpunit --testsuite unit
7171
$ php vendor/bin/coverage-check coverage/clover.xml 90
72-
$ XDEBUG_MODE=coverage php vendor/bin/infection --min-msi=80
72+
$ XDEBUG_MODE=coverage php vendor/bin/infection --min-msi=8
7373
```
7474

7575
## Running test suites

phpunit.xml.dist

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit colors="true" verbose="true"
2+
<phpunit colors="true"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
displayDetailsOnTestsThatTriggerDeprecations="true"
6+
displayDetailsOnTestsThatTriggerErrors="true"
7+
displayDetailsOnTestsThatTriggerNotices="true"
8+
displayDetailsOnTestsThatTriggerWarnings="true"
9+
displayDetailsOnPhpunitDeprecations="true"
510
bootstrap="vendor/autoload.php"
611
>
712
<testsuites>
@@ -15,16 +20,18 @@
1520
<directory>tests/integration</directory>
1621
</testsuite>
1722
</testsuites>
18-
<coverage processUncoveredFiles="true" cacheDirectory="coverage/cache" pathCoverage="true">
19-
<report>
20-
<clover outputFile="coverage/clover.xml" />
21-
<html outputDirectory="coverage/" />
22-
</report>
23+
<source>
2324
<include>
2425
<directory suffix=".php">src</directory>
2526
</include>
2627
<exclude>
2728
<file>src/functions.php</file>
2829
</exclude>
30+
</source>
31+
<coverage cacheDirectory="coverage/cache" pathCoverage="true">
32+
<report>
33+
<clover outputFile="coverage/clover.xml" />
34+
<html outputDirectory="coverage/" />
35+
</report>
2936
</coverage>
3037
</phpunit>

tests/unit/Expressions/Literals/FloatTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
*/
1919
final class FloatTest extends TestCase
2020
{
21+
public static function provideToQueryData(): array
22+
{
23+
return [
24+
[1, '1.0'],
25+
[1.0, '1.0'],
26+
[111111111111111, '1.1111111111111E+14'],
27+
[1337.1337, '1337.1337'],
28+
];
29+
}
30+
2131
public function testZero(): void
2232
{
2333
$float = new Float_(0);
@@ -48,14 +58,4 @@ public function testInstanceOfFloatType(): void
4858
{
4959
$this->assertInstanceOf(FloatType::class, new Float_(1.0));
5060
}
51-
52-
public function provideToQueryData(): array
53-
{
54-
return [
55-
[1, '1.0'],
56-
[1.0, '1.0'],
57-
[111111111111111, '1.1111111111111E+14'],
58-
[1337.1337, '1337.1337'],
59-
];
60-
}
6161
}

tests/unit/Expressions/Literals/IntegerTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,30 @@
1919
*/
2020
final class IntegerTest extends TestCase
2121
{
22+
public static function provideToQueryData(): array
23+
{
24+
return [
25+
[1, "1"],
26+
[2, "2"],
27+
["2147483649", "2147483649"],
28+
["9223372036854775816", "9223372036854775816"],
29+
[-12, "-12"],
30+
[69, "69"],
31+
["292922929312312831203129382304823043284234729847294324724982749274294729427429471230918457", "292922929312312831203129382304823043284234729847294324724982749274294729427429471230918457"],
32+
["-1238109438204130457284308235720483205", "-1238109438204130457284308235720483205"],
33+
];
34+
}
35+
36+
public static function provideInvalidInputData(): array
37+
{
38+
return [
39+
['nonumber'],
40+
['12.3E36'],
41+
['0x86'],
42+
['5.5'],
43+
];
44+
}
45+
2246
public function testZero(): void
2347
{
2448
$decimal = new Integer(0);
@@ -65,28 +89,4 @@ public function testInvalidInput($input): void
6589
$this->expectException(TypeError::class);
6690
new Integer($input);
6791
}
68-
69-
public function provideToQueryData(): array
70-
{
71-
return [
72-
[1, "1"],
73-
[2, "2"],
74-
["2147483649", "2147483649"],
75-
["9223372036854775816", "9223372036854775816"],
76-
[-12, "-12"],
77-
[69, "69"],
78-
["292922929312312831203129382304823043284234729847294324724982749274294729427429471230918457", "292922929312312831203129382304823043284234729847294324724982749274294729427429471230918457"],
79-
["-1238109438204130457284308235720483205", "-1238109438204130457284308235720483205"],
80-
];
81-
}
82-
83-
public function provideInvalidInputData(): array
84-
{
85-
return [
86-
['nonumber'],
87-
['12.3E36'],
88-
['0x86'],
89-
['5.5'],
90-
];
91-
}
9292
}

tests/unit/Expressions/Literals/ListTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020
*/
2121
final class ListTest extends TestCase
2222
{
23+
public static function provideOneDimensionalData(): array
24+
{
25+
return [
26+
[[Query::literal(12)], "[12]"],
27+
[[Query::literal('12')], "['12']"],
28+
[[Query::literal('12'), Query::literal('13')], "['12', '13']"],
29+
];
30+
}
31+
32+
public static function provideMultidimensionalData(): array
33+
{
34+
return [
35+
[[new List_([Query::literal(12)])], "[[12]]"],
36+
[[new List_([Query::literal('12')])], "[['12']]"],
37+
[[new List_([Query::literal('12'), Query::literal('14')]), new List_([Query::literal('13')])], "[['12', '14'], ['13']]"],
38+
];
39+
}
40+
2341
public function testEmpty(): void
2442
{
2543
$list = new List_([]);
@@ -145,22 +163,4 @@ public function testMultidimensional(array $expressions, string $expected): void
145163

146164
$this->assertSame($expected, $list->toQuery());
147165
}
148-
149-
public function provideOneDimensionalData(): array
150-
{
151-
return [
152-
[[Query::literal(12)], "[12]"],
153-
[[Query::literal('12')], "['12']"],
154-
[[Query::literal('12'), Query::literal('13')], "['12', '13']"],
155-
];
156-
}
157-
158-
public function provideMultidimensionalData(): array
159-
{
160-
return [
161-
[[new List_([Query::literal(12)])], "[[12]]"],
162-
[[new List_([Query::literal('12')])], "[['12']]"],
163-
[[new List_([Query::literal('12'), Query::literal('14')]), new List_([Query::literal('13')])], "[['12', '14'], ['13']]"],
164-
];
165-
}
166166
}

0 commit comments

Comments
 (0)