PropertyMetadataTest.php 829 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Symfony\Tests\Component\Validator\Mapping;
  3. require_once __DIR__.'/../Fixtures/Entity.php';
  4. use Symfony\Component\Validator\Mapping\PropertyMetadata;
  5. use Symfony\Tests\Component\Validator\Fixtures\Entity;
  6. class PropertyMetadataTest extends \PHPUnit_Framework_TestCase
  7. {
  8. const CLASSNAME = 'Symfony\Tests\Component\Validator\Fixtures\Entity';
  9. public function testInvalidPropertyName()
  10. {
  11. $this->setExpectedException('Symfony\Component\Validator\Exception\ValidatorException');
  12. new PropertyMetadata(self::CLASSNAME, 'foobar');
  13. }
  14. public function testGetValueFromPrivateProperty()
  15. {
  16. $entity = new Entity('foobar');
  17. $metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
  18. $this->assertEquals('foobar', $metadata->getValue($entity));
  19. }
  20. }