simplified PHPUnit exception expectations
This commit is contained in:
parent
ba7e68f842
commit
eb75781ccd
@ -105,7 +105,7 @@ class EntityUserProviderTest extends TestCase
|
|||||||
$user1 = new User(null, null, 'user1');
|
$user1 = new User(null, null, 'user1');
|
||||||
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
|
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
|
$this->expectException(
|
||||||
'InvalidArgumentException',
|
'InvalidArgumentException',
|
||||||
'You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine'
|
'You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine'
|
||||||
);
|
);
|
||||||
@ -125,7 +125,7 @@ class EntityUserProviderTest extends TestCase
|
|||||||
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
|
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
|
||||||
|
|
||||||
$user2 = new User(1, 2, 'user2');
|
$user2 = new User(1, 2, 'user2');
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
|
$this->expectException(
|
||||||
'Symfony\Component\Security\Core\Exception\UsernameNotFoundException',
|
'Symfony\Component\Security\Core\Exception\UsernameNotFoundException',
|
||||||
'User with id {"id1":1,"id2":2} not found'
|
'User with id {"id1":1,"id2":2} not found'
|
||||||
);
|
);
|
||||||
|
@ -103,7 +103,7 @@ class CookieTest extends TestCase
|
|||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
|
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
Cookie::fromString('foo');
|
Cookie::fromString('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class CookieTest extends TestCase
|
|||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
Cookie::fromString('foo=bar', 'foobar');
|
Cookie::fromString('foo=bar', 'foobar');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class CommandTest extends TestCase
|
|||||||
public function testSetAliasesNull()
|
public function testSetAliasesNull()
|
||||||
{
|
{
|
||||||
$command = new \TestCommand();
|
$command = new \TestCommand();
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$command->setAliases(null);
|
$command->setAliases(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class OutputFormatterStyleTest extends TestCase
|
|||||||
$style->setForeground('default');
|
$style->setForeground('default');
|
||||||
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
|
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$style->setForeground('undefined-color');
|
$style->setForeground('undefined-color');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class OutputFormatterStyleTest extends TestCase
|
|||||||
$style->setBackground('default');
|
$style->setBackground('default');
|
||||||
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
|
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$style->setBackground('undefined-color');
|
$style->setBackground('undefined-color');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class ParserTest extends TestCase
|
|||||||
|
|
||||||
/** @var FunctionNode $function */
|
/** @var FunctionNode $function */
|
||||||
$function = $selectors[0]->getTree();
|
$function = $selectors[0]->getTree();
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
|
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
|
||||||
Parser::parseSeries($function->getArguments());
|
Parser::parseSeries($function->getArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class TokenStreamTest extends TestCase
|
|||||||
|
|
||||||
public function testFailToGetNextIdentifier()
|
public function testFailToGetNextIdentifier()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
|
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
|
||||||
|
|
||||||
$stream = new TokenStream();
|
$stream = new TokenStream();
|
||||||
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
|
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
|
||||||
@ -73,7 +73,7 @@ class TokenStreamTest extends TestCase
|
|||||||
|
|
||||||
public function testFailToGetNextIdentifierOrStar()
|
public function testFailToGetNextIdentifierOrStar()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
|
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
|
||||||
|
|
||||||
$stream = new TokenStream();
|
$stream = new TokenStream();
|
||||||
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
|
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
|
||||||
|
@ -1008,7 +1008,7 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$container->registerExtension($extension = new \ProjectExtension());
|
$container->registerExtension($extension = new \ProjectExtension());
|
||||||
$this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension');
|
$this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension');
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
|
$this->expectException('LogicException');
|
||||||
$container->getExtension('no_registered');
|
$container->getExtension('no_registered');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class GenericEventTest extends TestCase
|
|||||||
$this->assertEquals('Event', $this->event['name']);
|
$this->assertEquals('Event', $this->event['name']);
|
||||||
|
|
||||||
// test getting invalid arg
|
// test getting invalid arg
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$this->assertFalse($this->event['nameNotExist']);
|
$this->assertFalse($this->event['nameNotExist']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class DateIntervalToArrayTransformerTest extends DateIntervalTestCase
|
|||||||
{
|
{
|
||||||
$transformer = new DateIntervalToArrayTransformer();
|
$transformer = new DateIntervalToArrayTransformer();
|
||||||
$this->assertNull($transformer->reverseTransform(null));
|
$this->assertNull($transformer->reverseTransform(null));
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
|
$this->expectException(UnexpectedTypeException::class);
|
||||||
$transformer->reverseTransform('12345');
|
$transformer->reverseTransform('12345');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class DateIntervalToArrayTransformerTest extends DateIntervalTestCase
|
|||||||
{
|
{
|
||||||
$transformer = new DateIntervalToArrayTransformer();
|
$transformer = new DateIntervalToArrayTransformer();
|
||||||
$input = array('years' => '1');
|
$input = array('years' => '1');
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
|
$this->expectException(TransformationFailedException::class);
|
||||||
$transformer->reverseTransform($input);
|
$transformer->reverseTransform($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class DateIntervalToStringTransformerTest extends DateIntervalTestCase
|
|||||||
public function testTransformExpectsDateTime()
|
public function testTransformExpectsDateTime()
|
||||||
{
|
{
|
||||||
$transformer = new DateIntervalToStringTransformer();
|
$transformer = new DateIntervalToStringTransformer();
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
|
$this->expectException(UnexpectedTypeException::class);
|
||||||
$transformer->transform('1234');
|
$transformer->transform('1234');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class DateIntervalToStringTransformerTest extends DateIntervalTestCase
|
|||||||
{
|
{
|
||||||
$reverseTransformer = new DateIntervalToStringTransformer($format, true);
|
$reverseTransformer = new DateIntervalToStringTransformer($format, true);
|
||||||
$interval = new \DateInterval($output);
|
$interval = new \DateInterval($output);
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
|
$this->expectException(TransformationFailedException::class);
|
||||||
$this->assertDateIntervalEquals($interval, $reverseTransformer->reverseTransform($input));
|
$this->assertDateIntervalEquals($interval, $reverseTransformer->reverseTransform($input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,14 +109,14 @@ class DateIntervalToStringTransformerTest extends DateIntervalTestCase
|
|||||||
public function testReverseTransformExpectsString()
|
public function testReverseTransformExpectsString()
|
||||||
{
|
{
|
||||||
$reverseTransformer = new DateIntervalToStringTransformer();
|
$reverseTransformer = new DateIntervalToStringTransformer();
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
|
$this->expectException(UnexpectedTypeException::class);
|
||||||
$reverseTransformer->reverseTransform(1234);
|
$reverseTransformer->reverseTransform(1234);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReverseTransformExpectsValidIntervalString()
|
public function testReverseTransformExpectsValidIntervalString()
|
||||||
{
|
{
|
||||||
$reverseTransformer = new DateIntervalToStringTransformer();
|
$reverseTransformer = new DateIntervalToStringTransformer();
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
|
$this->expectException(TransformationFailedException::class);
|
||||||
$reverseTransformer->reverseTransform('10Y');
|
$reverseTransformer->reverseTransform('10Y');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
|
|||||||
|
|
||||||
// HOW TO REPRODUCE?
|
// HOW TO REPRODUCE?
|
||||||
|
|
||||||
//$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
|
//$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
|
||||||
|
|
||||||
//$transformer->transform(1.5);
|
//$transformer->transform(1.5);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ class DateTimeToStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$transformer = new DateTimeToStringTransformer();
|
$transformer = new DateTimeToStringTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$transformer->transform('1234');
|
$transformer->transform('1234');
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ class DateTimeToStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$reverseTransformer = new DateTimeToStringTransformer();
|
$reverseTransformer = new DateTimeToStringTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$reverseTransformer->reverseTransform(1234);
|
$reverseTransformer->reverseTransform(1234);
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ class DateTimeToStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$reverseTransformer = new DateTimeToStringTransformer();
|
$reverseTransformer = new DateTimeToStringTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$reverseTransformer->reverseTransform('2010-2010-2010');
|
$reverseTransformer->reverseTransform('2010-2010-2010');
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ class DateTimeToStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$reverseTransformer = new DateTimeToStringTransformer();
|
$reverseTransformer = new DateTimeToStringTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$reverseTransformer->reverseTransform('2010-04-31');
|
$reverseTransformer->reverseTransform('2010-04-31');
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class DateTimeToTimestampTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$transformer = new DateTimeToTimestampTransformer();
|
$transformer = new DateTimeToTimestampTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$transformer->transform('1234');
|
$transformer->transform('1234');
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ class DateTimeToTimestampTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$reverseTransformer = new DateTimeToTimestampTransformer();
|
$reverseTransformer = new DateTimeToTimestampTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$reverseTransformer->reverseTransform('2010-2010-2010');
|
$reverseTransformer->reverseTransform('2010-2010-2010');
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$transformer->transform('abcd');
|
$transformer->transform('abcd');
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$transformer->reverseTransform(12345);
|
$transformer->reverseTransform(12345);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class PercentToLocalizedStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$transformer = new PercentToLocalizedStringTransformer();
|
$transformer = new PercentToLocalizedStringTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$transformer->transform('foo');
|
$transformer->transform('foo');
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ class PercentToLocalizedStringTransformerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$transformer = new PercentToLocalizedStringTransformer();
|
$transformer = new PercentToLocalizedStringTransformer();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
|
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
|
||||||
|
|
||||||
$transformer->reverseTransform(1);
|
$transformer->reverseTransform(1);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class CollectionTypeTest extends BaseTypeTest
|
|||||||
$form = $this->factory->create(static::TESTED_TYPE, null, array(
|
$form = $this->factory->create(static::TESTED_TYPE, null, array(
|
||||||
'entry_type' => TextTypeTest::TESTED_TYPE,
|
'entry_type' => TextTypeTest::TESTED_TYPE,
|
||||||
));
|
));
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
||||||
$form->setData(new \stdClass());
|
$form->setData(new \stdClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,13 +51,13 @@ class FormBuilderTest extends TestCase
|
|||||||
|
|
||||||
public function testAddNameNoStringAndNoInteger()
|
public function testAddNameNoStringAndNoInteger()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
||||||
$this->builder->add(true);
|
$this->builder->add(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddTypeNoString()
|
public function testAddTypeNoString()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
||||||
$this->builder->add('foo', 1234);
|
$this->builder->add('foo', 1234);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class FileTest extends TestCase
|
|||||||
|
|
||||||
public function testConstructWhenFileNotExists()
|
public function testConstructWhenFileNotExists()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
||||||
|
|
||||||
new File(__DIR__.'/Fixtures/not_here');
|
new File(__DIR__.'/Fixtures/not_here');
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class MimeTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testGuessImageWithDirectory()
|
public function testGuessImageWithDirectory()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
||||||
|
|
||||||
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
|
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class MimeTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testGuessWithIncorrectPath()
|
public function testGuessWithIncorrectPath()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
||||||
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
|
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class MimeTypeTest extends TestCase
|
|||||||
@chmod($path, 0333);
|
@chmod($path, 0333);
|
||||||
|
|
||||||
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
|
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
|
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
|
||||||
MimeTypeGuesser::getInstance()->guess($path);
|
MimeTypeGuesser::getInstance()->guess($path);
|
||||||
} else {
|
} else {
|
||||||
$this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');
|
$this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');
|
||||||
|
@ -33,7 +33,7 @@ class UploadedFileTest extends TestCase
|
|||||||
|
|
||||||
public function testConstructWhenFileNotExists()
|
public function testConstructWhenFileNotExists()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
||||||
|
|
||||||
new UploadedFile(
|
new UploadedFile(
|
||||||
__DIR__.'/Fixtures/not_here',
|
__DIR__.'/Fixtures/not_here',
|
||||||
|
@ -30,7 +30,7 @@ class FileLocatorTest extends TestCase
|
|||||||
$kernel
|
$kernel
|
||||||
->expects($this->never())
|
->expects($this->never())
|
||||||
->method('locateResource');
|
->method('locateResource');
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
|
$this->expectException('LogicException');
|
||||||
$locator->locate('/some/path');
|
$locator->locate('/some/path');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
|
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
|
$this->expectException($exceptionCode);
|
||||||
|
|
||||||
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
|
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
|
||||||
}
|
}
|
||||||
@ -712,7 +712,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
|
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
|
$this->expectException($exceptionCode);
|
||||||
|
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
||||||
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
|
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
|
||||||
@ -838,7 +838,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
|
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
|
$this->expectException($exceptionCode);
|
||||||
|
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
||||||
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);
|
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);
|
||||||
|
@ -74,7 +74,7 @@ class AdapterTest extends LdapTestCase
|
|||||||
public function testLdapQueryWithoutBind()
|
public function testLdapQueryWithoutBind()
|
||||||
{
|
{
|
||||||
$ldap = new Adapter($this->getLdapConfig());
|
$ldap = new Adapter($this->getLdapConfig());
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
|
$this->expectException(NotBoundException::class);
|
||||||
$query = $ldap->createQuery('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))', array());
|
$query = $ldap->createQuery('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))', array());
|
||||||
$query->execute();
|
$query->execute();
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
*/
|
*/
|
||||||
public function testLdapAddInvalidEntry()
|
public function testLdapAddInvalidEntry()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class);
|
$this->expectException(LdapException::class);
|
||||||
$this->executeSearchQuery(1);
|
$this->executeSearchQuery(1);
|
||||||
|
|
||||||
// The entry is missing a subject name
|
// The entry is missing a subject name
|
||||||
@ -107,7 +107,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
public function testLdapUnboundAdd()
|
public function testLdapUnboundAdd()
|
||||||
{
|
{
|
||||||
$this->adapter = new Adapter($this->getLdapConfig());
|
$this->adapter = new Adapter($this->getLdapConfig());
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
|
$this->expectException(NotBoundException::class);
|
||||||
$em = $this->adapter->getEntryManager();
|
$em = $this->adapter->getEntryManager();
|
||||||
$em->add(new Entry(''));
|
$em->add(new Entry(''));
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
public function testLdapUnboundRemove()
|
public function testLdapUnboundRemove()
|
||||||
{
|
{
|
||||||
$this->adapter = new Adapter($this->getLdapConfig());
|
$this->adapter = new Adapter($this->getLdapConfig());
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
|
$this->expectException(NotBoundException::class);
|
||||||
$em = $this->adapter->getEntryManager();
|
$em = $this->adapter->getEntryManager();
|
||||||
$em->remove(new Entry(''));
|
$em->remove(new Entry(''));
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
public function testLdapUnboundUpdate()
|
public function testLdapUnboundUpdate()
|
||||||
{
|
{
|
||||||
$this->adapter = new Adapter($this->getLdapConfig());
|
$this->adapter = new Adapter($this->getLdapConfig());
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
|
$this->expectException(NotBoundException::class);
|
||||||
$em = $this->adapter->getEntryManager();
|
$em = $this->adapter->getEntryManager();
|
||||||
$em->update(new Entry(''));
|
$em->update(new Entry(''));
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
$result = $this->executeSearchQuery(1);
|
$result = $this->executeSearchQuery(1);
|
||||||
$entry = $result[0];
|
$entry = $result[0];
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class);
|
$this->expectException(LdapException::class);
|
||||||
|
|
||||||
$entryManager->removeAttributeValues($entry, 'mail', array('fabpot@example.org'));
|
$entryManager->removeAttributeValues($entry, 'mail', array('fabpot@example.org'));
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
$result = $this->executeSearchQuery(1);
|
$result = $this->executeSearchQuery(1);
|
||||||
$entry = $result[0];
|
$entry = $result[0];
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class);
|
$this->expectException(LdapException::class);
|
||||||
|
|
||||||
$entryManager->addAttributeValues($entry, 'mail', $entry->getAttribute('mail'));
|
$entryManager->addAttributeValues($entry, 'mail', $entry->getAttribute('mail'));
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
$result = $this->executeSearchQuery(1);
|
$result = $this->executeSearchQuery(1);
|
||||||
$entry = $result[0];
|
$entry = $result[0];
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UpdateOperationException::class);
|
$this->expectException(UpdateOperationException::class);
|
||||||
|
|
||||||
$entryManager->applyOperations($entry->getDn(), array(new UpdateOperation(LDAP_MODIFY_BATCH_REMOVE_ALL, 'mail', array())));
|
$entryManager->applyOperations($entry->getDn(), array(new UpdateOperation(LDAP_MODIFY_BATCH_REMOVE_ALL, 'mail', array())));
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
$result = $this->executeSearchQuery(1);
|
$result = $this->executeSearchQuery(1);
|
||||||
$entry = $result[0];
|
$entry = $result[0];
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UpdateOperationException::class);
|
$this->expectException(UpdateOperationException::class);
|
||||||
|
|
||||||
$entryManager->applyOperations($entry->getDn(), array(new UpdateOperation(512, 'mail', array())));
|
$entryManager->applyOperations($entry->getDn(), array(new UpdateOperation(512, 'mail', array())));
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
$result = $this->executeSearchQuery(1);
|
$result = $this->executeSearchQuery(1);
|
||||||
$entry = $result[0];
|
$entry = $result[0];
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UpdateOperationException::class);
|
$this->expectException(UpdateOperationException::class);
|
||||||
|
|
||||||
$entryManager->applyOperations($entry->getDn(), $duplicateIterator);
|
$entryManager->applyOperations($entry->getDn(), $duplicateIterator);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class LdapTest extends TestCase
|
|||||||
|
|
||||||
public function testCreateWithInvalidAdapterName()
|
public function testCreateWithInvalidAdapterName()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(DriverNotFoundException::class);
|
$this->expectException(DriverNotFoundException::class);
|
||||||
Ldap::create('foo');
|
Ldap::create('foo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ class UrlGeneratorTest extends TestCase
|
|||||||
|
|
||||||
// The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything
|
// The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything
|
||||||
// and following optional variables like _format could never match.
|
// and following optional variables like _format could never match.
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException');
|
$this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException');
|
||||||
$generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml'));
|
$generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ class UrlMatcherTest extends TestCase
|
|||||||
$matcher = $this->getUrlMatcher($collection);
|
$matcher = $this->getUrlMatcher($collection);
|
||||||
|
|
||||||
$this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1'));
|
$this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1'));
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
||||||
$this->assertEquals(array(), $matcher->match('/foo'));
|
$this->assertEquals(array(), $matcher->match('/foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ class UrlMatcherTest extends TestCase
|
|||||||
// z and _format are optional.
|
// z and _format are optional.
|
||||||
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy'));
|
$this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy'));
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
||||||
$matcher->match('/wxy.html');
|
$matcher->match('/wxy.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ class UrlMatcherTest extends TestCase
|
|||||||
|
|
||||||
// Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match.
|
// Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match.
|
||||||
// But here the 't' in 'get' is not a separating character, so it makes no sense to match without it.
|
// But here the 't' in 'get' is not a separating character, so it makes no sense to match without it.
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
|
||||||
$matcher->match('/ge');
|
$matcher->match('/ge');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class PhpEngineTest extends TestCase
|
|||||||
$foo = new \Symfony\Component\Templating\Tests\Fixtures\SimpleHelper('foo');
|
$foo = new \Symfony\Component\Templating\Tests\Fixtures\SimpleHelper('foo');
|
||||||
$engine->set($foo);
|
$engine->set($foo);
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\LogicException');
|
$this->expectException('\LogicException');
|
||||||
|
|
||||||
unset($engine['foo']);
|
unset($engine['foo']);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ abstract class AbstractOperationTest extends TestCase
|
|||||||
|
|
||||||
public function testGetMessagesFromUnknownDomain()
|
public function testGetMessagesFromUnknownDomain()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$this->createOperation(
|
$this->createOperation(
|
||||||
new MessageCatalogue('en'),
|
new MessageCatalogue('en'),
|
||||||
new MessageCatalogue('en')
|
new MessageCatalogue('en')
|
||||||
|
@ -35,7 +35,7 @@ class ConstraintTest extends TestCase
|
|||||||
|
|
||||||
public function testSetNotExistingPropertyThrowsException()
|
public function testSetNotExistingPropertyThrowsException()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException');
|
$this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
|
||||||
|
|
||||||
new ConstraintA(array(
|
new ConstraintA(array(
|
||||||
'foo' => 'bar',
|
'foo' => 'bar',
|
||||||
@ -46,14 +46,14 @@ class ConstraintTest extends TestCase
|
|||||||
{
|
{
|
||||||
$constraint = new ConstraintA();
|
$constraint = new ConstraintA();
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException');
|
$this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
|
||||||
|
|
||||||
$constraint->foo = 'bar';
|
$constraint->foo = 'bar';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInvalidAndRequiredOptionsPassed()
|
public function testInvalidAndRequiredOptionsPassed()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException');
|
$this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException');
|
||||||
|
|
||||||
new ConstraintC(array(
|
new ConstraintC(array(
|
||||||
'option1' => 'default',
|
'option1' => 'default',
|
||||||
@ -101,14 +101,14 @@ class ConstraintTest extends TestCase
|
|||||||
|
|
||||||
public function testSetUndefinedDefaultProperty()
|
public function testSetUndefinedDefaultProperty()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||||
|
|
||||||
new ConstraintB('foo');
|
new ConstraintB('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequiredOptionsMustBeDefined()
|
public function testRequiredOptionsMustBeDefined()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\MissingOptionsException');
|
$this->expectException('Symfony\Component\Validator\Exception\MissingOptionsException');
|
||||||
|
|
||||||
new ConstraintC();
|
new ConstraintC();
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,14 @@ class ClassMetadataTest extends TestCase
|
|||||||
|
|
||||||
public function testAddConstraintDoesNotAcceptValid()
|
public function testAddConstraintDoesNotAcceptValid()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||||
|
|
||||||
$this->metadata->addConstraint(new Valid());
|
$this->metadata->addConstraint(new Valid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddConstraintRequiresClassConstraints()
|
public function testAddConstraintRequiresClassConstraints()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||||
|
|
||||||
$this->metadata->addConstraint(new PropertyConstraint());
|
$this->metadata->addConstraint(new PropertyConstraint());
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class GetterMetadataTest extends TestCase
|
|||||||
|
|
||||||
public function testInvalidPropertyName()
|
public function testInvalidPropertyName()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException');
|
$this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
|
||||||
|
|
||||||
new GetterMetadata(self::CLASSNAME, 'foobar');
|
new GetterMetadata(self::CLASSNAME, 'foobar');
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
$loader = new XmlFileLoader(__DIR__.'/withdoctype.xml');
|
$loader = new XmlFileLoader(__DIR__.'/withdoctype.xml');
|
||||||
$metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
|
$metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\Symfony\Component\Validator\Exception\MappingException');
|
$this->expectException('\Symfony\Component\Validator\Exception\MappingException');
|
||||||
$loader->loadClassMetadata($metadata);
|
$loader->loadClassMetadata($metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class XmlFileLoaderTest extends TestCase
|
|||||||
try {
|
try {
|
||||||
$loader->loadClassMetadata($metadata);
|
$loader->loadClassMetadata($metadata);
|
||||||
} catch (MappingException $e) {
|
} catch (MappingException $e) {
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\Symfony\Component\Validator\Exception\MappingException');
|
$this->expectException('\Symfony\Component\Validator\Exception\MappingException');
|
||||||
$loader->loadClassMetadata($metadata);
|
$loader->loadClassMetadata($metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class YamlFileLoaderTest extends TestCase
|
|||||||
$loader->loadClassMetadata($metadata);
|
$loader->loadClassMetadata($metadata);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
// Call again. Again an exception should be thrown
|
// Call again. Again an exception should be thrown
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\InvalidArgumentException');
|
$this->expectException('\InvalidArgumentException');
|
||||||
$loader->loadClassMetadata($metadata);
|
$loader->loadClassMetadata($metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class MemberMetadataTest extends TestCase
|
|||||||
|
|
||||||
public function testAddConstraintRequiresClassConstraints()
|
public function testAddConstraintRequiresClassConstraints()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
|
||||||
|
|
||||||
$this->metadata->addConstraint(new ClassConstraint());
|
$this->metadata->addConstraint(new ClassConstraint());
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class PropertyMetadataTest extends TestCase
|
|||||||
|
|
||||||
public function testInvalidPropertyName()
|
public function testInvalidPropertyName()
|
||||||
{
|
{
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException');
|
$this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
|
||||||
|
|
||||||
new PropertyMetadata(self::CLASSNAME, 'foobar');
|
new PropertyMetadata(self::CLASSNAME, 'foobar');
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ class PropertyMetadataTest extends TestCase
|
|||||||
$metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
|
$metadata = new PropertyMetadata(self::CLASSNAME, 'internal');
|
||||||
$metadata->name = 'test';
|
$metadata->name = 'test';
|
||||||
|
|
||||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException');
|
$this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
|
||||||
$metadata->getPropertyValue($entity);
|
$metadata->getPropertyValue($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user