Skip to content

Commit ac8c3cc

Browse files
committed
Add test
1 parent 8421221 commit ac8c3cc

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

tests/EnclosingMethodTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace PHPJava\Tests;
3+
4+
class EnclosingMethodTest extends Base
5+
{
6+
protected $fixtures = [
7+
'EnclosingMethodTest',
8+
];
9+
10+
public function testEnclosingMethod()
11+
{
12+
ob_start();
13+
$this->initiatedJavaClasses['EnclosingMethodTest']
14+
->getInvoker()
15+
->getStatic()
16+
->getMethods()
17+
->call(
18+
'main',
19+
[]
20+
);
21+
$result = ob_get_clean();
22+
$this->assertEquals("Hello World!\n", $result);
23+
}
24+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class EnclosingMethodTest
2+
{
3+
public String text;
4+
5+
public static void main(String[] args)
6+
{
7+
new EnclosingMethodTest() {{
8+
this.text = "Hello World!";
9+
callHelloWorld();
10+
}};
11+
}
12+
13+
public void callHelloWorld()
14+
{
15+
System.out.println(this.text);
16+
}
17+
}

0 commit comments

Comments
 (0)