use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class TypeHintingTest method testCoreScalar.
@Test
public void testCoreScalar() {
ParameterEntity param = new ParameterEntity(null);
param.setType(HintType.SCALAR);
Assert.assertTrue(param.checkTypeHinting(null, new StringMemory("")));
Assert.assertFalse(param.checkTypeHinting(null, new ObjectMemory(null)));
Assert.assertFalse(param.checkTypeHinting(null, new ArrayMemory()));
Assert.assertFalse(param.checkTypeHinting(null, Memory.NULL));
Assert.assertTrue(param.checkTypeHinting(null, Memory.FALSE));
Assert.assertTrue(param.checkTypeHinting(null, Memory.TRUE));
Assert.assertTrue(param.checkTypeHinting(null, new LongMemory(0)));
Assert.assertTrue(param.checkTypeHinting(null, new DoubleMemory(0)));
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class TypeHintingTest method testCoreBool.
@Test
public void testCoreBool() {
ParameterEntity param = new ParameterEntity(null);
param.setType(HintType.BOOLEAN);
Assert.assertFalse(param.checkTypeHinting(null, new StringMemory("")));
Assert.assertFalse(param.checkTypeHinting(null, new ObjectMemory(null)));
Assert.assertFalse(param.checkTypeHinting(null, new ArrayMemory()));
Assert.assertFalse(param.checkTypeHinting(null, Memory.NULL));
Assert.assertTrue(param.checkTypeHinting(null, Memory.FALSE));
Assert.assertTrue(param.checkTypeHinting(null, Memory.TRUE));
Assert.assertFalse(param.checkTypeHinting(null, new LongMemory(0)));
Assert.assertFalse(param.checkTypeHinting(null, new DoubleMemory(0)));
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class TypeHintingTest method testCoreString.
@Test
public void testCoreString() {
ParameterEntity param = new ParameterEntity(null);
param.setType(HintType.STRING);
Assert.assertTrue(param.checkTypeHinting(null, new StringMemory("")));
Assert.assertFalse(param.checkTypeHinting(null, new ObjectMemory(null)));
Assert.assertFalse(param.checkTypeHinting(null, new ArrayMemory()));
Assert.assertFalse(param.checkTypeHinting(null, Memory.NULL));
Assert.assertFalse(param.checkTypeHinting(null, Memory.FALSE));
Assert.assertFalse(param.checkTypeHinting(null, Memory.TRUE));
Assert.assertFalse(param.checkTypeHinting(null, new LongMemory(0)));
Assert.assertFalse(param.checkTypeHinting(null, new DoubleMemory(0)));
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class TypeHintingTest method testCoreNumber.
/*@Test
public void testNumber(){
check("type_hinting/number.php", true);
}*/
@Test
public void testCoreNumber() {
ParameterEntity param = new ParameterEntity(null);
param.setType(HintType.NUMBER);
Assert.assertFalse(param.checkTypeHinting(null, new StringMemory("")));
Assert.assertFalse(param.checkTypeHinting(null, new ObjectMemory(null)));
Assert.assertFalse(param.checkTypeHinting(null, new ArrayMemory()));
Assert.assertFalse(param.checkTypeHinting(null, Memory.NULL));
Assert.assertFalse(param.checkTypeHinting(null, Memory.FALSE));
Assert.assertFalse(param.checkTypeHinting(null, Memory.TRUE));
Assert.assertTrue(param.checkTypeHinting(null, new LongMemory(0)));
Assert.assertTrue(param.checkTypeHinting(null, new DoubleMemory(0)));
}
use of php.runtime.reflection.ParameterEntity in project jphp by jphp-compiler.
the class TypeHintingTest method testCoreInt.
@Test
public void testCoreInt() {
ParameterEntity param = new ParameterEntity(null);
param.setType(HintType.INT);
Assert.assertFalse(param.checkTypeHinting(null, new StringMemory("")));
Assert.assertFalse(param.checkTypeHinting(null, new ObjectMemory(null)));
Assert.assertFalse(param.checkTypeHinting(null, new ArrayMemory()));
Assert.assertFalse(param.checkTypeHinting(null, Memory.NULL));
Assert.assertFalse(param.checkTypeHinting(null, Memory.FALSE));
Assert.assertFalse(param.checkTypeHinting(null, Memory.TRUE));
Assert.assertTrue(param.checkTypeHinting(null, new LongMemory(0)));
Assert.assertFalse(param.checkTypeHinting(null, new DoubleMemory(0)));
}
Aggregations