Skip to content

Commit edfcd7b

Browse files
committed
Fix tests and mutlanewarray problem
1 parent d6c766c commit edfcd7b

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/Kernel/Mnemonics/_getstatic.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace PHPJava\Kernel\Mnemonics;
33

4+
use PHPJava\Exceptions\NotImplementedException;
45
use PHPJava\Kernel\Structures\_Fieldref;
56
use PHPJava\Utilities\ClassResolver;
67
use PHPJava\Utilities\Formatter;
@@ -36,6 +37,9 @@ public function execute(): void
3637
/**
3738
* @var \PHPJava\Core\JavaClass $className
3839
*/
40+
throw new NotImplementedException(
41+
'Not implemented operation.'
42+
);
3943
return;
4044
}
4145
$this->pushToOperandStack(new $classObject());

src/Kernel/Types/_Array/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function offsetUnset($offset)
6262

6363
public function offsetSet($offset, $value)
6464
{
65-
if (empty($offset)) {
65+
if ($offset === null) {
6666
$this->data[] = $value;
6767
return;
6868
}

tests/ArrayTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ public function testMultiDimensionArrayWithConstants()
105105
public function testMultiDimensionArrayWithDynamic()
106106
{
107107
$actual = $this->call('multiDimensionArrayWithDynamic');
108-
var_dump($actual);
109-
$this->assertEquals('Hello World!', $actual);
108+
$this->assertCount(3, $actual);
109+
$this->assertEquals('Hello', (string) $actual[0]);
110+
$this->assertEquals(' ', (string) $actual[1]);
111+
$this->assertEquals('World!', (string) $actual[2]);
110112
}
111113
}

tests/fixtures/java/ArrayTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static String multiDimensionArrayWithConstants()
4949
return a[0][0] + "" + a[0][1] + "" + a[0][2];
5050
}
5151

52-
public static String[] testMultiDimensionArrayWithDynamic()
52+
public static String[] multiDimensionArrayWithDynamic()
5353
{
5454
String[][] a = new String[1][3];
5555
a[0][0] = "Hello";

0 commit comments

Comments
 (0)