Skip to content

Commit 1e640a4

Browse files
committed
Add invokeinterface test
1 parent 1b7e1df commit 1e640a4

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

tests/InvokeOperationsTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
namespace PHPJava\Tests;
3+
4+
use PHPUnit\Framework\TestCase;
5+
6+
class InvokeOperationsTest extends Base
7+
{
8+
protected $fixtures = [
9+
'InvokeDynamicTest',
10+
];
11+
12+
public function testInvokeInterface()
13+
{
14+
ob_start();
15+
$this->initiatedJavaClasses['InvokeDynamicTest']
16+
->getInvoker()
17+
->getStatic()
18+
->getMethods()
19+
->call(
20+
'main',
21+
[]
22+
);
23+
$getHelloWorld = ob_get_clean();
24+
$this->assertEquals("Hello World!\n", $getHelloWorld);
25+
}
26+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class InvokeDynamicTest
2+
{
3+
interface InterfaceTest
4+
{
5+
public String callee(String name);
6+
}
7+
8+
public static void main(String[] args)
9+
{
10+
InterfaceTest it = v -> { return "Hello" + v; };
11+
System.out.println(it.callee(" World!"));
12+
}
13+
}

0 commit comments

Comments
 (0)