/** * Tests that initialization from a reflection class works as expected. * * @return void */ public function testFromReflectionClass() { // initialize the annotation aliases $aliases = array(Stateful::ANNOTATION => Stateful::__getClass(), PreAttach::ANNOTATION => PreAttach::__getClass(), PostDetach::ANNOTATION => PostDetach::__getClass(), PostActivate::ANNOTATION => PostActivate::__getClass(), PrePassivate::ANNOTATION => PrePassivate::__getClass()); // create the reflection class $reflectionClass = new ReflectionClass(__CLASS__, array(), $aliases); // check that the descriptor has been initialized $this->assertSame($this->descriptor, $this->descriptor->fromReflectionClass($reflectionClass)); $this->assertSame('StatefulSessionBeanDescriptorTest', $this->descriptor->getName()); $this->assertSame('AppserverIo\\Description\\StatefulSessionBeanDescriptorTest', $this->descriptor->getClassName()); $this->assertCount(0, $this->descriptor->getEpbReferences()); $this->assertCount(0, $this->descriptor->getResReferences()); $this->assertCount(0, $this->descriptor->getReferences()); $this->assertCount(1, $this->descriptor->getPreAttachCallbacks()); $this->assertCount(1, $this->descriptor->getPostDetachCallbacks()); $this->assertCount(1, $this->descriptor->getPostActivateCallbacks()); $this->assertCount(1, $this->descriptor->getPrePassivateCallbacks()); }