8000 minor #29899 Simplify PHPUnit exception expectations (fabpot) · symfony/symfony@18fb7f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 18fb7f8

Browse files
committed
minor #29899 Simplify PHPUnit exception expectations (fabpot)
This PR was merged into the 4.3-dev branch. Discussion ---------- Simplify PHPUnit exception expectations | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a <!-- Write a short README entry for your feature/bugfix here (replace this comment block.) This will help people understand your PR and can be used as a start of the Doc PR. Additionally: - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> Commits ------- eb75781 simplified PHPUnit exception expectations
2 parents ba7e68f + eb75781 commit 18fb7f8

36 files changed

+72
-72
lines changed

src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testRefreshUserRequiresId()
105105
$user1 = new User(null, null, 'user1');
106106
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
107107

108-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
108+
$this->expectException(
109109
'InvalidArgumentException',
110110
'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'
111111
);
@@ -125,7 +125,7 @@ public function testRefreshInvalidUser()
125125
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
126126

127127
$user2 = new User(1, 2, 'user2');
128-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
128+
$this->expectException(
129129
'Symfony\Component\Security\Core\Exception\UsernameNotFoundException',
130130
'User with id {"id1":1,"id2":2} not found'
131131
);

src/Symfony/Component/BrowserKit/Tests/CookieTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testFromStringWithUrl()
103103

104104
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
105105
{
106-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
106+
$this->expectException('InvalidArgumentException');
107107
Cookie::fromString('foo');
108108
}
109109

@@ -116,7 +116,7 @@ public function testFromStringIgnoresInvalidExpiresDate()
116116

117117
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
118118
{
119-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
119+
$this->expectException('InvalidArgumentException');
120120
Cookie::fromString('foo=bar', 'foobar');
121121
}
122122

src/Symfony/Component/Console/Tests/Command/CommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function testGetSetAliases()
188188
public function testSetAliasesNull()
189189
{
190190
$command = new \TestCommand();
191-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
191+
$this->expectException('InvalidArgumentException');
192192
$command->setAliases(null);
193193
}
194194

src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testForeground()
4141
$style->setForeground('default');
4242
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
4343

44-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
44+
$this->expectException('InvalidArgumentException');
4545
$style->setForeground('undefined-color');
4646
}
4747

@@ -58,7 +58,7 @@ public function testBackground()
5858
$style->setBackground('default');
5959
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
6060

61-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
61+
$this->expectException('InvalidArgumentException');
6262
$style->setBackground('undefined-color');
6363
}
6464

src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testParseSeriesException($series)
8989

9090
/** @var FunctionNode $function */
9191
$function = $selectors[0]->getTree();
92-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
92+
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
9393
Parser::parseSeries($function->getArguments());
9494
}
9595

src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testGetNextIdentifier()
5353

5454
public function testFailToGetNextIdentifier()
5555
{
56-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
56+
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
5757

5858
$stream = new TokenStream();
5959
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -73,7 +73,7 @@ public function testGetNextIdentifierOrStar()
7373

7474
public function testFailToGetNextIdentifierOrStar()
7575
{
76-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
76+
$this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
7777

7878
$stream = new TokenStream();
7979
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ public function testExtension()
10081008
$container->registerExtension($extension = new \ProjectExtension());
10091009
$this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension');
10101010

1011-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
1011+
$this->expectException('LogicException');
10121012
$container->getExtension('no_registered');
10131013
}
10141014

src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testOffsetGet()
9292
$this->assertEquals('Event', $this->event['name']);
9393

9494
// test getting invalid arg
95-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
95+
$this->expectException('InvalidArgumentException');
9696
$this->assertFalse($this->event['nameNotExist']);
9797
}
9898

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ public function testReverseTransformRequiresDateTime()
176176
{
177177
$transformer = new DateIntervalToArrayTransformer();
178178
$this->assertNull($transformer->reverseTransform(null));
179-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
179+
$this->expectException(UnexpectedTypeException::class);
180180
$transformer->reverseTransform('12345');
181181
}
182182

183183
public function testReverseTransformWithUnsetFields()
184184
{
185185
$transformer = new DateIntervalToArrayTransformer();
186186
$input = array('years' => '1');
187-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
187+
$this->expectException(TransformationFailedException::class);
188188
$transformer->reverseTransform($input);
189189
}
190190

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testTransformEmpty()
7575
public function testTransformExpectsDateTime()
7676
{
7777
$transformer = new DateIntervalToStringTransformer();
78-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
78+
$this->expectException(UnexpectedTypeException::class);
7979
$transformer->transform('1234');
8080
}
8181

@@ -96,7 +96,7 @@ public function testReverseTransformDateString($format, $input, $output)
9696
{
9797
$reverseTransformer = new DateIntervalToStringTransformer($format, true);
9898
$interval = new \DateInterval($output);
99-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
99+
$this->expectException(TransformationFailedException::class);
100100
$this->assertDateIntervalEquals($interval, $reverseTransformer->reverseTransform($input));
101101
}
102102

@@ -109,14 +109,14 @@ public function testReverseTransformEmpty()
109109
public function testReverseTransformExpectsString()
110110
{
111111
$reverseTransformer = new DateIntervalToStringTransformer();
112-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class);
112+
$this->expectException(UnexpectedTypeException::class);
113113
$reverseTransformer->reverseTransform(1234);
114114
}
115115

116116
public function testReverseTransformExpectsValidIntervalString()
117117
{
118118
$reverseTransformer = new DateIntervalToStringTransformer();
119-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class);
119+
$this->expectException(TransformationFailedException::class);
120120
$reverseTransformer->reverseTransform('10Y');
121121
}
122122
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function testTransformWrapsIntlErrors()
196196

197197
// HOW TO REPRODUCE?
198198
199-
//$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
199+
//$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
200200

201201
//$transformer->transform(1.5);
202202
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function testTransformExpectsDateTime()
111111
{
112112
$transformer = new DateTimeToStringTransformer();
113113

114-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
114+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
115115

116116
$transformer->transform('1234');
117117
}
@@ -150,7 +150,7 @@ public function testReverseTransformExpectsString()
150150
{
151151
$reverseTransformer = new DateTimeToStringTransformer();
152152

153-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
153+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
154154

155155
$reverseTransformer->reverseTransform(1234);
156156
}
@@ -159,7 +159,7 @@ public function testReverseTransformExpectsValidDateString()
159159
{
160160
$reverseTransformer = new DateTimeToStringTransformer();
161161

162-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
162+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
163163

164164
$reverseTransformer->reverseTransform('2010-2010-2010');
165165
}
@@ -168,7 +168,7 @@ public function testReverseTransformWithNonExistingDate()
168168
{
169169
$reverseTransformer = new DateTimeToStringTransformer();
170170

171-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
171+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
172172

173173
$reverseTransformer->reverseTransform('2010-04-31');
174174
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testTransformExpectsDateTime()
7272
{
7373
$transformer = new DateTimeToTimestampTransformer();
7474

75-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
75+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
7676

7777
$transformer->transform('1234');
7878
}
@@ -109,7 +109,7 @@ public function testReverseTransformExpectsValidTimestamp()
109109
{
110110
$reverseTransformer = new DateTimeToTimestampTransformer();
111111

112-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
112+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
113113

114114
$reverseTransformer->reverseTransform('2010-2010-2010');
115115
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testTransformExpectsNumeric()
3333
{
3434
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
3535

36-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
36+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
3737

3838
$transformer->transform('abcd');
3939
}
@@ -61,7 +61,7 @@ public function testReverseTransformExpectsString()
6161
{
6262
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
6363

64-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
64+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
6565

6666
$transformer->reverseTransform(12345);
6767
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function testTransformExpectsNumeric()
106106
{
107107
$transformer = new PercentToLocalizedStringTransformer();
108108

109-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
109+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
110110

111111
$transformer->transform('foo');
112112
}
@@ -115,7 +115,7 @@ public function testReverseTransformExpectsString()
115115
{
116116
$transformer = new PercentToLocalizedStringTransformer();
117117

118-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException');
118+
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
119119

120120
$transformer->reverseTransform(1);
121121
}

src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testThrowsExceptionIfObjectIsNotTraversable()
6161
$form = $this->factory->create(static::TESTED_TYPE, null, array(
6262
'entry_type' => TextTypeTest::TESTED_TYPE,
6363
));
64-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
64+
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
6565
$form->setData(new \stdClass());
6666
}
6767

src/Symfony/Component/Form/Tests/FormBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public function testNoSetName()
5151

5252
public function testAddNameNoStringAndNoInteger()
5353
{
54-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
54+
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
5555
$this->builder->add(true);
5656
}
5757

5858
public function testAddTypeNoString()
5959
{
60-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException');
60+
$this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');
6161
$this->builder->add('foo', 1234);
6262
}
6363

src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testGuessExtensionWithReset()
6464

6565
public function testConstructWhenFileNotExists()
6666
{
67-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
67+
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
6868

6969
new File(__DIR__.'/Fixtures/not_here');
7070
}

src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testGuessImageWithoutExtension()
2929

3030
public function testGuessImageWithDirectory()
3131
{
32-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
32+
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
3333

3434
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
3535
}
@@ -53,7 +53,7 @@ public function testGuessFileWithUnknownExtension()
5353

5454
public function testGuessWithIncorrectPath()
5555
{
56-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
56+
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
5757
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
5858
}
5959

@@ -72,7 +72,7 @@ public function testGuessWithNonReadablePath()
7272
@chmod($path, 0333);
7373

7474
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
75-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
75+
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
7676
MimeTypeGuesser::getInstance()->guess($path);
7777
} else {
7878
$this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');

src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function setUp()
3333

3434
public function testConstructWhenFileNotExists()
3535
{
36-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
36+
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
3737

3838
new UploadedFile(
3939
__DIR__.'/Fixtures/not_here',

src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testLocate()
3030
$kernel
3131
->expects($this->never())
3232
->method('locateResource');
33-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
33+
$this->expectException('LogicException');
3434
$locator->locate('/some/path');
3535
}
3636

src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function testFormatTypeCurrency($formatter, $value)
329329
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
330330
}
331331

332-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
332+
$this->expectException($exceptionCode);
333333

334334
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
335335
}
@@ -712,7 +712,7 @@ public function testParseTypeDefault()
712712
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
713713
}
714714

715-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
715+
$this->expectException($exceptionCode);
716716

717717
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
718718
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
@@ -838,7 +838,7 @@ public function testParseTypeCurrency()
838838
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
839839
}
840840

841-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
841+
$this->expectException($exceptionCode);
842842

843843
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
844844
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);

src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testLdapQueryIterator()
7474
public function testLdapQueryWithoutBind()
7575
{
7676
$ldap = new Adapter($this->getLdapConfig());
77-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class);
77+
$this->expectException(NotBoundException::class);
7878
$query = $ldap->createQuery('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))', array());
7979
$query->execute();
8080
}

0 commit comments

Comments
 (0)
0