[Validator] Fixed StaticMethodLoaderTest to actually test something

This commit is contained in:
Bernhard Schussek 2014-09-24 15:56:15 +02:00
parent d0537e0efb
commit 1b1303a8d8
2 changed files with 12 additions and 15 deletions

View File

@ -4,7 +4,7 @@ namespace Symfony\Component\Validator\Tests\Mapping\Loader;
use Symfony\Component\Validator\Mapping\ClassMetadata;
abstract class AbstractMethodStaticLoader
abstract class AbstractStaticMethodLoader
{
abstract public static function loadMetadata(ClassMetadata $metadata);
}

View File

@ -90,22 +90,19 @@ class StaticMethodLoaderTest extends \PHPUnit_Framework_TestCase
public function testLoadClassMetadataIgnoresAbstractMethods()
{
error_reporting(E_ALL | E_STRICT);
// Disable error reporting, as AbstractStaticMethodLoader produces a
// strict standards error
error_reporting(0);
if (0 !== error_reporting()) {
$this->markTestSkipped('Could not disable error reporting');
}
include __DIR__.'/AbstractStaticMethodLoader.php';
$metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticMethodLoader');
$loader = new StaticMethodLoader('loadMetadata');
$caught = false;
try {
include __DIR__.'/AbstractMethodStaticLoader.php';
} catch (\Exception $e) {
// catching the PHP notice that is converted to an exception by PHPUnit
$caught = true;
}
if (!$caught) {
$this->fail('AbstractMethodStaticLoader should produce a strict standard error.');
}
$metadata = new ClassMetadata(__NAMESPACE__.'\AbstractMethodStaticLoader');
$loader->loadClassMetadata($metadata);
$this->assertCount(0, $metadata->getConstraints());