[Validator] add missing parent isset and add test
This commit is contained in:
parent
8e8ee09747
commit
bcb79a39ef
@ -214,6 +214,16 @@ abstract class Constraint
|
||||
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $option The option name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($option)
|
||||
{
|
||||
return 'groups' === $option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given group if this constraint is in the Default group.
|
||||
*
|
||||
|
@ -26,6 +26,16 @@ class FileTest extends TestCase
|
||||
|
||||
$this->assertSame($bytes, $file->maxSize);
|
||||
$this->assertSame($binaryFormat, $file->binaryFormat);
|
||||
$this->assertTrue($file->__isset('maxSize'));
|
||||
}
|
||||
|
||||
public function testMagicIsset()
|
||||
{
|
||||
$file = new File(array('maxSize' => 1));
|
||||
|
||||
$this->assertTrue($file->__isset('maxSize'));
|
||||
$this->assertTrue($file->__isset('groups'));
|
||||
$this->assertFalse($file->__isset('toto'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user