Skip to content

Commit 11bab19

Browse files
committed
Add tests for PHP 7.0, 7.1 and 7.2.
1 parent b490d73 commit 11bab19

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed

tests/PHPSemVerChecker/Scanner/ScannerTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,28 @@ public function testInvalidCodeParsing()
2121
$scanner = new Scanner();
2222
$scanner->scan(__DIR__.'/../../fixtures/general/InvalidCode.php');
2323
}
24+
25+
public function testPHP70()
26+
{
27+
$scanner = new Scanner();
28+
$scanner->scan(__DIR__.'/../../fixtures/general/PHP7.0.php');
29+
30+
$this->assertTrue(true);
31+
}
32+
33+
public function testPHP71()
34+
{
35+
$scanner = new Scanner();
36+
$scanner->scan(__DIR__.'/../../fixtures/general/PHP7.1.php');
37+
38+
$this->assertTrue(true);
39+
}
40+
41+
public function testPHP72()
42+
{
43+
$scanner = new Scanner();
44+
$scanner->scan(__DIR__.'/../../fixtures/general/PHP7.2.php');
45+
46+
$this->assertTrue(true);
47+
}
2448
}

tests/fixtures/general/PHP7.0.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
function testScalarTypes(string $test)
4+
{
5+
6+
}
7+
8+
function testReturnType(): array
9+
{
10+
return [];
11+
}
12+
13+
function testNullCoalescingOperator()
14+
{
15+
return 1 ?? 2;
16+
}
17+
18+
function testSpaceshipOperator()
19+
{
20+
return 1 <=> 1;
21+
}
22+
23+
function testAnonymousClass()
24+
{
25+
new class {
26+
public function test()
27+
{
28+
29+
}
30+
};
31+
}

tests/fixtures/general/PHP7.1.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
function testNullableTypes(?string $test)
4+
{
5+
6+
}
7+
8+
function testNullFunctions(): void
9+
{
10+
11+
}

tests/fixtures/general/PHP7.2.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function testNewObjectType(): object
4+
{
5+
6+
}

0 commit comments

Comments
 (0)