use of php.runtime.Memory in project jphp by jphp-compiler.
the class ClassesTest method testToString.
@Test
public void testToString() {
Memory memory = includeResource("classes/__toString.php");
Assert.assertEquals("success", memory.toString());
}
use of php.runtime.Memory in project jphp by jphp-compiler.
the class ClassesTest method testInstanceOf.
@Test
public void testInstanceOf() {
Memory memory = includeResource("classes/instance_of.php");
Assert.assertEquals("success", memory.toString());
}
use of php.runtime.Memory in project jphp by jphp-compiler.
the class ClassesTest method testNew.
@Test
public void testNew() {
Memory memory = includeResource("classes/new.php");
Assert.assertEquals("success", memory.toString());
}
use of php.runtime.Memory in project jphp by jphp-compiler.
the class ClassesTest method testDestruct.
@Test
public void testDestruct() {
Memory memory = includeResource("classes/__destruct.php");
Assert.assertEquals("1111111111", getOutput());
}
use of php.runtime.Memory in project jphp by jphp-compiler.
the class ClassesTest method testProperties.
@Test
public void testProperties() throws Throwable {
Memory memory;
memory = runDynamic("class A { var $x = 11, $y = 30; } return new A();", false);
Assert.assertTrue(memory.isObject());
IObject object = ((ObjectMemory) memory).value;
Assert.assertEquals(11, object.getReflection().getProperty(environment, null, object, "x", null, 0).toLong());
Assert.assertEquals(30, object.getReflection().getProperty(environment, null, object, "y", null, 0).toLong());
memory = runDynamic("class A { public $arr = array(1, 2, 3); } return new A()->arr;", false);
Assert.assertTrue(memory.isArray());
}
Aggregations