Skip to content

Commit 74e042c

Browse files
authored
Merge pull request #260 from php-java/add-test-for-declare
Add tests for declare statement
2 parents d19578b + 094a162 commit 74e042c

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
class TestDeclareStatement
5+
{
6+
/**
7+
* @param \PHPJava\Packages\java\lang\String_[] $args
8+
*/
9+
public static function main($args)
10+
{
11+
echo "Hello World!\n";
12+
}
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
declare(strict_types=1);
3+
namespace PHPJava\DeclareStatement;
4+
5+
class TestDeclareStatementWithNamespace
6+
{
7+
/**
8+
* @param \PHPJava\Packages\java\lang\String_[] $args
9+
*/
10+
public static function main($args)
11+
{
12+
echo "Hello World!\n";
13+
}
14+
}

tests/Cases/Compiler/StructureTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,24 @@ public function testUseStatementWithNamespace()
2727
$output[0]
2828
);
2929
}
30+
31+
public function testDeclareStatement()
32+
{
33+
[$output, $return] = $this->runJavaTest(__METHOD__);
34+
35+
$this->assertSame(
36+
'Hello World!',
37+
$output[0]
38+
);
39+
}
40+
41+
public function testDeclareStatementWithNamespace()
42+
{
43+
[$output, $return] = $this->runJavaTest(__METHOD__, 'PHPJava.DeclareStatement');
44+
45+
$this->assertSame(
46+
'Hello World!',
47+
$output[0]
48+
);
49+
}
3050
}

0 commit comments

Comments
 (0)