Merge branch '2.3' into 2.4
* 2.3: [Validators] Fixed failing tests requiring ICU 52.1 which are skipped otherwise return empty metadata collection if none do exist
This commit is contained in:
commit
9c69d7004d
|
@ -298,6 +298,10 @@ class ClassMetadata extends ElementMetadata implements MetadataInterface, ClassB
|
||||||
*/
|
*/
|
||||||
public function getMemberMetadatas($property)
|
public function getMemberMetadatas($property)
|
||||||
{
|
{
|
||||||
|
if (!isset($this->members[$property])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->members[$property];
|
return $this->members[$property];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +318,10 @@ class ClassMetadata extends ElementMetadata implements MetadataInterface, ClassB
|
||||||
*/
|
*/
|
||||||
public function getPropertyMetadata($property)
|
public function getPropertyMetadata($property)
|
||||||
{
|
{
|
||||||
|
if (!isset($this->members[$property])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->members[$property];
|
return $this->members[$property];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class CountryValidatorTest extends AbstractConstraintValidatorTest
|
||||||
$this->validator->validate($country, $constraint);
|
$this->validator->validate($country, $constraint);
|
||||||
|
|
||||||
$this->assertViolation('myMessage', array(
|
$this->assertViolation('myMessage', array(
|
||||||
'{{ value }}' => $country,
|
'{{ value }}' => '"'.$country.'"',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class CurrencyValidatorTest extends AbstractConstraintValidatorTest
|
||||||
$this->validator->validate($currency, $constraint);
|
$this->validator->validate($currency, $constraint);
|
||||||
|
|
||||||
$this->assertViolation('myMessage', array(
|
$this->assertViolation('myMessage', array(
|
||||||
'{{ value }}' => $currency,
|
'{{ value }}' => '"'.$currency.'"',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
use Symfony\Component\Intl\Util\IntlTestHelper;
|
||||||
use Symfony\Component\Validator\Constraints\Language;
|
use Symfony\Component\Validator\Constraints\Language;
|
||||||
use Symfony\Component\Validator\Constraints\LanguageValidator;
|
use Symfony\Component\Validator\Constraints\LanguageValidator;
|
||||||
use Symfony\Component\Validator\Validation;
|
|
||||||
|
|
||||||
class LanguageValidatorTest extends AbstractConstraintValidatorTest
|
class LanguageValidatorTest extends AbstractConstraintValidatorTest
|
||||||
{
|
{
|
||||||
|
@ -83,7 +82,7 @@ class LanguageValidatorTest extends AbstractConstraintValidatorTest
|
||||||
$this->validator->validate($language, $constraint);
|
$this->validator->validate($language, $constraint);
|
||||||
|
|
||||||
$this->assertViolation('myMessage', array(
|
$this->assertViolation('myMessage', array(
|
||||||
'{{ value }}' => $language,
|
'{{ value }}' => '"'.$language.'"',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
use Symfony\Component\Intl\Util\IntlTestHelper;
|
||||||
use Symfony\Component\Validator\Constraints\Locale;
|
use Symfony\Component\Validator\Constraints\Locale;
|
||||||
use Symfony\Component\Validator\Constraints\LocaleValidator;
|
use Symfony\Component\Validator\Constraints\LocaleValidator;
|
||||||
use Symfony\Component\Validator\Validation;
|
|
||||||
|
|
||||||
class LocaleValidatorTest extends AbstractConstraintValidatorTest
|
class LocaleValidatorTest extends AbstractConstraintValidatorTest
|
||||||
{
|
{
|
||||||
|
@ -85,7 +84,7 @@ class LocaleValidatorTest extends AbstractConstraintValidatorTest
|
||||||
$this->validator->validate($locale, $constraint);
|
$this->validator->validate($locale, $constraint);
|
||||||
|
|
||||||
$this->assertViolation('myMessage', array(
|
$this->assertViolation('myMessage', array(
|
||||||
'{{ value }}' => $locale,
|
'{{ value }}' => '"'.$locale.'"',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,4 +222,20 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase
|
||||||
$metadata->setGroupSequenceProvider(true);
|
$metadata->setGroupSequenceProvider(true);
|
||||||
$this->assertTrue($metadata->isGroupSequenceProvider());
|
$this->assertTrue($metadata->isGroupSequenceProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/symfony/symfony/issues/11604
|
||||||
|
*/
|
||||||
|
public function testGetMemberMetadatasReturnsEmptyArrayWithoutConfiguredMetadata()
|
||||||
|
{
|
||||||
|
$this->assertCount(0, $this->metadata->getMemberMetadatas('foo'), '->getMemberMetadatas() returns an empty collection if no metadata is configured for the given property');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/symfony/symfony/issues/11604
|
||||||
|
*/
|
||||||
|
public function testGetPropertyMetadataReturnsEmptyArrayWithoutConfiguredMetadata()
|
||||||
|
{
|
||||||
|
$this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue