Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6fc6ecd

Browse files
committed
[Validator] Fixed tests under PHP<5.3.9
The new implementation is disabled on those PHP versions.
1 parent 778ec24 commit 6fc6ecd

13 files changed

+54
-50
lines changed

src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,16 @@
1212
namespace Symfony\Component\Validator\Mapping;
1313

1414
use Symfony\Component\Validator\ClassBasedInterface;
15+
use Symfony\Component\Validator\PropertyMetadataContainerInterface as LegacyPropertyMetadataContainerInterface;;
1516

1617
/**
1718
* @since %%NextVersion%%
1819
* @author Bernhard Schussek <[email protected]>
1920
*/
20-
interface ClassMetadataInterface extends MetadataInterface, ClassBasedInterface
21+
interface ClassMetadataInterface extends MetadataInterface, LegacyPropertyMetadataContainerInterface, ClassBasedInterface
2122
{
2223
public function getConstrainedProperties();
2324

24-
public function hasPropertyMetadata($property);
25-
26-
/**
27-
* Returns all metadata instances for the given named property.
28-
*
29-
* If your implementation does not support properties, simply throw an
30-
* exception in this method (for example a <tt>BadMethodCallException</tt>).
31-
*
32-
* @param string $property The property name.
33-
*
34-
* @return PropertyMetadataInterface[] A list of metadata instances. Empty if
35-
* no metadata exists for the property.
36-
*/
37-
public function getPropertyMetadata($property);
38-
3925
public function hasGroupSequence();
4026

4127
public function getGroupSequence();

src/Symfony/Component/Validator/Mapping/GenericMetadata.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\Valid;
16+
use Symfony\Component\Validator\ValidationVisitorInterface;
1617

1718
/**
1819
* @since %%NextVersion%%
@@ -149,4 +150,12 @@ public function getTraversalStrategy()
149150
{
150151
return $this->traversalStrategy;
151152
}
153+
154+
/**
155+
* {@inheritdoc}
156+
*/
157+
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath)
158+
{
159+
// Thanks PHP < 5.3.9
160+
}
152161
}

src/Symfony/Component/Validator/Mapping/MemberMetadata.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414
use Symfony\Component\Validator\Constraints\Valid;
1515
use Symfony\Component\Validator\ValidationVisitorInterface;
16-
use Symfony\Component\Validator\PropertyMetadataInterface as LegacyPropertyMetadataInterface;
1716
use Symfony\Component\Validator\Constraint;
1817
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1918

20-
abstract class MemberMetadata extends ElementMetadata implements PropertyMetadataInterface, LegacyPropertyMetadataInterface
19+
abstract class MemberMetadata extends ElementMetadata implements PropertyMetadataInterface
2120
{
2221
public $class;
2322
public $name;

src/Symfony/Component/Validator/Mapping/MetadataInterface.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator\Mapping;
1313

14+
use Symfony\Component\Validator\MetadataInterface as LegacyMetadataInterface;
15+
1416
/**
1517
* A container for validation metadata.
1618
*
@@ -42,17 +44,8 @@
4244
*
4345
* @author Bernhard Schussek <[email protected]>
4446
*/
45-
interface MetadataInterface
47+
interface MetadataInterface extends LegacyMetadataInterface
4648
{
47-
/**
48-
* Returns all constraints for a given validation group.
49-
*
50-
* @param string $group The validation group.
51-
*
52-
* @return \Symfony\Component\Validator\Constraint[] A list of constraint instances.
53-
*/
54-
public function findConstraints($group);
55-
5649
public function getCascadingStrategy();
5750

5851
public function getTraversalStrategy();

src/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Validator\Mapping;
1313

1414
use Symfony\Component\Validator\ClassBasedInterface;
15+
use Symfony\Component\Validator\PropertyMetadataInterface as LegacyPropertyMetadataInterface;
1516

1617
/**
1718
* A container for validation metadata of a property.
@@ -26,21 +27,6 @@
2627
*
2728
* @see MetadataInterface
2829
*/
29-
interface PropertyMetadataInterface extends MetadataInterface, ClassBasedInterface
30+
interface PropertyMetadataInterface extends MetadataInterface, LegacyPropertyMetadataInterface, ClassBasedInterface
3031
{
31-
/**
32-
* Returns the name of the property.
33-
*
34-
* @return string The property name.
35-
*/
36-
public function getPropertyName();
37-
38-
/**
39-
* Extracts the value of the property from the given object.
40-
*
41-
* @param mixed $object The object to extract the property value from.
42-
*
43-
* @return mixed The value of the property.
44-
*/
45-
public function getPropertyValue($object);
4632
}

src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CountryValidatorTest extends \PHPUnit_Framework_TestCase
2222

2323
protected function setUp()
2424
{
25-
IntlTestHelper::requireIntl($this);
25+
IntlTestHelper::requireFullIntl($this);
2626

2727
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
2828
$this->validator = new CountryValidator();

src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CurrencyValidatorTest extends \PHPUnit_Framework_TestCase
2222

2323
protected function setUp()
2424
{
25-
IntlTestHelper::requireIntl($this);
25+
IntlTestHelper::requireFullIntl($this);
2626

2727
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
2828
$this->validator = new CurrencyValidator();

src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LanguageValidatorTest extends \PHPUnit_Framework_TestCase
2222

2323
protected function setUp()
2424
{
25-
IntlTestHelper::requireIntl($this);
25+
IntlTestHelper::requireFullIntl($this);
2626

2727
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
2828
$this->validator = new LanguageValidator();

src/Symfony/Component/Validator/Tests/Context/ExecutionContextTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class ExecutionContextTest extends \PHPUnit_Framework_TestCase
4646

4747
protected function setUp()
4848
{
49+
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
50+
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
51+
}
52+
4953
$this->validator = $this->getMock('Symfony\Component\Validator\Validator\ValidatorInterface');
5054
$this->groupManager = $this->getMock('Symfony\Component\Validator\Group\GroupManagerInterface');
5155
$this->translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface');

src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase
3535
/**
3636
* @var FakeMetadataFactory
3737
*/
38-
protected $metadataFactory;
38+
public $metadataFactory;
3939

4040
/**
4141
* @var ClassMetadata
4242
*/
43-
protected $metadata;
43+
public $metadata;
4444

4545
/**
4646
* @var ClassMetadata
4747
*/
48-
protected $referenceMetadata;
48+
public $referenceMetadata;
4949

5050
protected function setUp()
5151
{

src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323

2424
class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest
2525
{
26+
protected function setUp()
27+
{
28+
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
29+
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
30+
}
31+
32+
parent::setUp();
33+
}
34+
2635
protected function createValidator(MetadataFactoryInterface $metadataFactory)
2736
{
2837
$nodeTraverser = new NodeTraverser($metadataFactory);

src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323

2424
class LegacyValidatorLegacyApiTest extends AbstractLegacyApiTest
2525
{
26+
protected function setUp()
27+
{
28+
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
29+
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
30+
}
31+
32+
parent::setUp();
33+
}
34+
2635
protected function createValidator(MetadataFactoryInterface $metadataFactory)
2736
{
2837
$nodeTraverser = new NodeTraverser($metadataFactory);

src/Symfony/Component/Validator/Tests/Validator/Validator2Dot5ApiTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323

2424
class Validator2Dot5ApiTest extends Abstract2Dot5ApiTest
2525
{
26+
protected function setUp()
27+
{
28+
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
29+
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
30+
}
31+
32+
parent::setUp();
33+
}
34+
2635
protected function createValidator(MetadataFactoryInterface $metadataFactory)
2736
{
2837
$nodeTraverser = new NodeTraverser($metadataFactory);

0 commit comments

Comments
 (0)