/**
  * @param string $className
  * @return \Metadata\ClassMetadata|\TQ\ExtDirect\Metadata\ActionMetadata|null
  */
 protected function loadMetadataForClass($className)
 {
     $driver = new AnnotationDriver(new AnnotationReader());
     $reflectionClass = new \ReflectionClass($className);
     $classMetadata = $driver->loadMetadataForClass($reflectionClass);
     return $classMetadata;
 }
Пример #2
0
 public function testSerialize()
 {
     $driver = new AnnotationDriver(new AnnotationReader());
     $reflectionClass = new \ReflectionClass('TQ\\ExtDirect\\Tests\\Metadata\\Services\\Service1');
     $origMetadata = $driver->loadMetadataForClass($reflectionClass);
     $serialized = serialize($origMetadata);
     /** @var \TQ\ExtDirect\Metadata\ActionMetadata $restoredMetadata */
     $restoredMetadata = unserialize($serialized);
     $this->assertEquals($origMetadata->isAction, $restoredMetadata->isAction);
     $this->assertEquals($origMetadata->serviceId, $restoredMetadata->serviceId);
     $this->assertEquals($origMetadata->alias, $restoredMetadata->alias);
     $this->assertEquals($origMetadata->authorizationExpression, $restoredMetadata->authorizationExpression);
     $this->assertEquals(count($origMetadata->methodMetadata), count($restoredMetadata->methodMetadata));
 }
Пример #3
0
 public function testSerialize()
 {
     $driver = new AnnotationDriver(new AnnotationReader());
     $reflectionClass = new \ReflectionClass('TQ\\ExtDirect\\Tests\\Metadata\\Services\\Service1');
     $origMetadata = $driver->loadMetadataForClass($reflectionClass);
     $serialized = serialize($origMetadata);
     /** @var \TQ\ExtDirect\Metadata\ActionMetadata $restoredMetadata */
     $restoredMetadata = unserialize($serialized);
     /** @var \TQ\ExtDirect\Metadata\MethodMetadata $origMethodMetadata */
     /** @var \TQ\ExtDirect\Metadata\MethodMetadata $restoredMethodMetadata */
     $origMethodMetadata = $origMetadata->methodMetadata['methodA'];
     $restoredMethodMetadata = $restoredMetadata->methodMetadata['methodA'];
     $this->assertEquals($origMethodMetadata->isMethod, $restoredMethodMetadata->isMethod);
     $this->assertEquals($origMethodMetadata->isFormHandler, $restoredMethodMetadata->isFormHandler);
     $this->assertEquals($origMethodMetadata->hasNamedParams, $restoredMethodMetadata->hasNamedParams);
     $this->assertEquals($origMethodMetadata->isStrict, $restoredMethodMetadata->isStrict);
     $this->assertEquals(count($origMethodMetadata->parameters), count($restoredMethodMetadata->parameters));
     $this->assertEquals(count($origMethodMetadata->parameterMetadata), count($restoredMethodMetadata->parameterMetadata));
     $this->assertEquals($origMethodMetadata->authorizationExpression, $restoredMethodMetadata->authorizationExpression);
     $this->assertEquals($origMethodMetadata->result, $restoredMethodMetadata->result);
 }