8000 [Validator] Replaced inexistent interface. · symfony/symfony@8fd3256 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fd3256

Browse files
committed
[Validator] Replaced inexistent interface.
ClassMetadataFactoryInterface was removed in 2.3 and replaced with MetadataFactoryInterface.
1 parent 7921772 commit 8fd3256

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,28 @@
1111

1212
namespace Symfony\Component\Validator\Mapping;
1313

14+
use Symfony\Component\Validator\MetadataFactoryInterface;
15+
1416
/**
15-
* Simple implementation of ClassMetadataFactoryInterface that can be used when using ValidatorInterface::validateValue().
17+
* Simple implementation of MetadataFactoryInterface that can be used when using ValidatorInterface::validateValue().
1618
*
1719
* @author Fabien Potencier <fabien@symfony.com>
1820
*/
19-
class BlackholeMetadataFactory implements ClassMetadataFactoryInterface
21+
class BlackholeMetadataFactory implements MetadataFactoryInterface
2022
{
21-
public function getClassMetadata($class)
23+
/**
24+
* @inheritdoc
25+
*/
26+
public function getMetadataFor($value)
2227
{
2328
throw new \LogicException('BlackholeClassMetadataFactory only works with ValidatorInterface::validateValue().');
2429
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function hasMetadataFor($value)
35+
{
36+
return false;
37+
}
2538
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Tests\Mapping;
13+
14+
use Symfony\Component\Validator\Mapping\BlackholeMetadataFactory;
15+
16+
class BlackholeMetadataFactoryTest extends \PHPUnit_Framework_TestCase
17+
{
18+
/**
19+
* @expectedException \LogicException
20+
*/
21+
public function testGetMetadataForThrowsALogicException()
22+
{
23+
$metadataFactory = new BlackholeMetadataFactory();
24+
$metadataFactory->getMetadataFor('foo');
25+
}
26+
27+
public function testHasMetadataForReturnsFalse()
28+
{
29+
$metadataFactory = new BlackholeMetadataFactory();
30+
31+
$this->assertFalse($metadataFactory->hasMetadataFor('foo'));
32+
}
33+
}

0 commit comments

Comments
 (0)
0