예제 #1
0
 public function testGetPropertyValueFromOverriddenPrivateProperty()
 {
     $entity = new Entity('foobar');
     $metadata = new PropertyMetadata(self::PARENTCLASS, 'data');
     $this->assertTrue($metadata->isPublic($entity));
     $this->assertEquals('Overridden data', $metadata->getPropertyValue($entity));
 }
예제 #2
0
 public function testGetPropertyValueFromRemovedProperty()
 {
     $entity = new Entity('foobar');
     $metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
     $metadata->name = 'test';
     $this->setExpectedException('Symfony\\Component\\Validator\\Exception\\ValidatorException');
     $metadata->getPropertyValue($entity);
 }
예제 #3
0
 public function extractConstraints(PropertyMetadata $propertyMetadata)
 {
     foreach ($propertyMetadata->getConstraints() as $constraint) {
         foreach ($this->defaults['_constraints'] as $key => $value) {
             try {
                 $this->defaults['_constraints'][$key] = @$constraint->{$key};
             } catch (InvalidOptionsException $e) {
             }
         }
     }
 }
예제 #4
0
 public function testGetValueFromPrivateProperty()
 {
     $entity = new Entity('foobar');
     $metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
     $this->assertEquals('foobar', $metadata->getValue($entity));
 }