Skip to content

Commit 1b1303a

Browse files
committed
[Validator] Fixed StaticMethodLoaderTest to actually test something
1 parent d0537e0 commit 1b1303a

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractMethodStaticLoader.php renamed to src/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Component\Validator\Mapping\ClassMetadata;
66

7-
abstract class AbstractMethodStaticLoader
7+
abstract class AbstractStaticMethodLoader
88
{
99
abstract public static function loadMetadata(ClassMetadata $metadata);
1010
}

src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,19 @@ public function testLoadClassMetadataInAbstractClasses()
9090

9191
public function testLoadClassMetadataIgnoresAbstractMethods()
9292
{
93-
error_reporting(E_ALL | E_STRICT);
93+
// Disable error reporting, as AbstractStaticMethodLoader produces a
94+
// strict standards error
95+
error_reporting(0);
9496

95-
$loader = new StaticMethodLoader('loadMetadata');
96-
$caught = false;
97-
try {
98-
include __DIR__.'/AbstractMethodStaticLoader.php';
99-
} catch (\Exception $e) {
100-
// catching the PHP notice that is converted to an exception by PHPUnit
101-
$caught = true;
97+
if (0 !== error_reporting()) {
98+
$this->markTestSkipped('Could not disable error reporting');
10299
}
103100

104-
if (!$caught) {
105-
$this->fail('AbstractMethodStaticLoader should produce a strict standard error.');
106-
}
101+
include __DIR__.'/AbstractStaticMethodLoader.php';
107102

108-
$metadata = new ClassMetadata(__NAMESPACE__.'\AbstractMethodStaticLoader');
103+
$metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticMethodLoader');
104+
105+
$loader = new StaticMethodLoader('loadMetadata');
109106
$loader->loadClassMetadata($metadata);
110107

111108
$this->assertCount(0, $metadata->getConstraints());

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy