isClassOf() public method

public isClassOf ( $instance )
Example #1
0
 public function testPHPClass()
 {
     $class = new Lisphp_Runtime_PHPClass('ArrayObject');
     $obj = $this->applyFunction($class, array(1, 2, 3));
     $this->assertType('ArrayObject', $obj);
     $this->assertEquals(array(1, 2, 3), $obj->getArrayCopy());
     try {
         new Lisphp_Runtime_PHPClass('UndefinedClassName');
         $this->fail();
     } catch (UnexpectedValueException $e) {
         # pass
     }
     $class = new Lisphp_Runtime_PHPClass('Lisphp_SampleClass');
     $methods = $class->getStaticMethods();
     $this->assertEquals(2, count($methods));
     $this->assertType('Lisphp_Runtime_PHPFunction', $methods['a']);
     $this->assertEquals(array('Lisphp_SampleClass', 'a'), $methods['a']->callback);
     $this->assertType('Lisphp_Runtime_PHPFunction', $methods['b']);
     $this->assertEquals(array('Lisphp_SampleClass', 'b'), $methods['b']->callback);
     $this->assertTrue($class->isClassOf(new Lisphp_SampleClass()));
     $this->assertFalse($class->isClassOf(new stdClass()));
     $this->assertFalse($class->isClassOf(213));
 }