Chris@0: Class_::MODIFIER_ABSTRACT)); Chris@0: $this->assertTrue($class->isAbstract()); Chris@0: Chris@0: $class = new Class_('Foo'); Chris@0: $this->assertFalse($class->isAbstract()); Chris@0: } Chris@0: Chris@0: public function testIsFinal() { Chris@0: $class = new Class_('Foo', array('type' => Class_::MODIFIER_FINAL)); Chris@0: $this->assertTrue($class->isFinal()); Chris@0: Chris@0: $class = new Class_('Foo'); Chris@0: $this->assertFalse($class->isFinal()); Chris@0: } Chris@0: Chris@0: public function testGetMethods() { Chris@0: $methods = array( Chris@0: new ClassMethod('foo'), Chris@0: new ClassMethod('bar'), Chris@0: new ClassMethod('fooBar'), Chris@0: ); Chris@0: $class = new Class_('Foo', array( Chris@0: 'stmts' => array( Chris@0: new TraitUse(array()), Chris@0: $methods[0], Chris@0: new ClassConst(array()), Chris@0: $methods[1], Chris@0: new Property(0, array()), Chris@0: $methods[2], Chris@0: ) Chris@0: )); Chris@0: Chris@0: $this->assertSame($methods, $class->getMethods()); Chris@0: } Chris@0: Chris@0: public function testGetMethod() { Chris@0: $methodConstruct = new ClassMethod('__CONSTRUCT'); Chris@0: $methodTest = new ClassMethod('test'); Chris@0: $class = new Class_('Foo', array( Chris@0: 'stmts' => array( Chris@0: new ClassConst(array()), Chris@0: $methodConstruct, Chris@0: new Property(0, array()), Chris@0: $methodTest, Chris@0: ) Chris@0: )); Chris@0: Chris@0: $this->assertSame($methodConstruct, $class->getMethod('__construct')); Chris@0: $this->assertSame($methodTest, $class->getMethod('test')); Chris@0: $this->assertNull($class->getMethod('nonExisting')); Chris@0: } Chris@0: Chris@0: public function testDeprecatedTypeNode() { Chris@0: $class = new Class_('Foo', array('type' => Class_::MODIFIER_ABSTRACT)); Chris@0: $this->assertTrue($class->isAbstract()); Chris@0: $this->assertSame(Class_::MODIFIER_ABSTRACT, $class->flags); Chris@0: $this->assertSame(Class_::MODIFIER_ABSTRACT, $class->type); Chris@0: } Chris@0: }