8000 [Tests] Change to willThrowException · Firehed/symfony@0695834 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0695834

Browse files
gmponosfabpot
authored andcommitted
[Tests] Change to willThrowException
1 parent 2437d70 commit 0695834

25 files changed

+52
-52
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testDebugInvalidDirectory()
103103
$kernel->expects($this->once())
104104
->method('getBundle')
105105
->with($this->equalTo('dir'))
106-
->will($this->throwException(new \InvalidArgumentException()));
106+
->willThrowException(new \InvalidArgumentException());
107107

108108
$tester = $this->createCommandTester(array(), array(), $kernel);
109109
$tester->execute(array('locale' => 'en', 'bundle' => 'dir'));

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testThrowsExceptionWhenTemplateNotFound()
6060
$fileLocator
6161
->expects($this->once())
6262
->method('locate')
63-
->will($this->throwException(new \InvalidArgumentException($errorMessage)))
63+
->willThrowException(new \InvalidArgumentException($errorMessage))
6464
;
6565

6666
$locator = new TemplateLocator($fileLocator);

src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testTwigErrorIfLocatorThrowsInvalid()
6868
$locator
6969
->expects($this->once())
7070
->method('locate')
71-
->will($this->throwException(new \InvalidArgumentException('Unable to find template "NonExistent".')))
71+
->willThrowException(new \InvalidArgumentException('Unable to find template "NonExistent".'))
7272
;
7373

7474
$loader = new FilesystemLoader($locator, $parser);

src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function testThrowingUrlGenerator()
252252
->expects($this->once())
253253
->method('generate')
254254
->with('_profiler', array('token' => 'xxxxxxxx'))
255-
->will($this->throwException(new \Exception('foo')))
255+
->willThrowException(new \Exception('foo'))
256256
;
257257

258258
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
@@ -273,7 +273,7 @@ public function testThrowingErrorCleanup()
273273
->expects($this->once())
274274
->method('generate')
275275
->with('_profiler', array('token' => 'xxxxxxxx'))
276-
->will($this->throwException(new \Exception("This\nmultiline\r\ntabbed text should\tcome out\r on\n \ta single plain\r\nline")))
276+
->willThrowException(new \Exception("This\nmultiline\r\ntabbed text should\tcome out\r on\n \ta single plain\r\nline"))
277277
;
278278

279279
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ public function testRunReturnsIntegerExitCode()
919919
$application->setAutoExit(false);
920920
$application->expects($this->once())
921921
->method('doRun')
922-
->will($this->throwException($exception));
922+
->willThrowException($exception);
923923

924924
$exitCode = $application->run(new ArrayInput(array()), new NullOutput());
925925

@@ -958,7 +958,7 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero()
958958
$application->setAutoExit(false);
959959
$application->expects($this->once())
960960
->method('doRun')
961-
->will($this->throwException($exception));
961+
->willThrowException($exception);
962962

963963
$exitCode = $application->run(new ArrayInput(array()), new NullOutput());
964964

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ public function testNotSynchronizedIfViewReverseTransformationFailed()
629629
$transformer = $this->getDataTransformer();
630630
$transformer->expects($this->once())
631631
->method('reverseTransform')
632-
->will($this->throwException(new TransformationFailedException()));
632+
->willThrowException(new TransformationFailedException());
633633

634634
$form = $this->getBuilder()
635635
->addViewTransformer($transformer)
@@ -645,7 +645,7 @@ public function testNotSynchronizedIfModelReverseTransformationFailed()
645645
$transformer = $this->getDataTransformer();
646646
$transformer->expects($this->once())
647647
->method('reverseTransform')
648-
->will($this->throwException(new TransformationFailedException()));
648+
->willThrowException(new TransformationFailedException());
649649

650650
$form = $this->getBuilder()
651651
->addModelTransformer($transformer)

src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest()
4747
$this->translator
4848
->expects($this->at(0))
4949
->method('setLocale')
50-
->will($this->throwException(new \InvalidArgumentException()));
50+
->willThrowException(new \InvalidArgumentException());
5151
$this->translator
5252
->expects($this->at(1))
5353
->method('setLocale')
@@ -84,7 +84,7 @@ public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest()
8484
$this->translator
8585
->expects($this->at(0))
8686
->method('setLocale')
87-
->will($this->throwException(new \InvalidArgumentException()));
87+
->willThrowException(new \InvalidArgumentException());
8888
$this->translator
8989
->expects($this->at(1))
9090
->method('setLocale')

src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testRenderWithDefaultText()
8080
$engine->expects($this->once())
8181
->method('exists')
8282
->with('default')
83-
->will($this->throwException(new \InvalidArgumentException()));
83+
->willThrowException(new \InvalidArgumentException());
8484

8585
// only default
8686
$strategy = new HIncludeFragmentRenderer($engine);
@@ -93,7 +93,7 @@ public function testRenderWithEngineAndDefaultText()
9393
$engine->expects($this->once())
9494
->method('exists')
9595
->with('loading...')
96-
->will($this->throwException(new \RuntimeException()));
96+
->willThrowException(new \RuntimeException());
9797

9898
// only default
9999
$strategy = new HIncludeFragmentRenderer($engine);

src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function testFallbackIfLocaleDoesNotExist()
148148
$this->readerImpl->expects($this->at(0))
149149
->method('read')
150150
->with(self::RES_DIR, 'en_GB')
151-
->will($this->throwException(new ResourceBundleNotFoundException()));
151+
->willThrowException(new ResourceBundleNotFoundException());
152152

153153
$this->readerImpl->expects($this->at(1))
154154
->method('read')
@@ -166,7 +166,7 @@ public function testDontFallbackIfLocaleDoesNotExistAndFallbackDisabled()
166166
$this->readerImpl->expects($this->once())
167167
->method('read')
168168
->with(self::RES_DIR, 'en_GB')
169-
->will($this->throwException(new ResourceBundleNotFoundException()));
169+
->willThrowException(new ResourceBundleNotFoundException());
170170

171171
$this->reader->readEntry(self::RES_DIR, 'en_GB', array('Entries', 'Bam'), false);
172172
}

src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ protected function getAuthenticationProvider($supports, $token = null, $exceptio
188188
} elseif (null !== $exception) {
189189
$provider->expects($this->once())
190190
->method('authenticate')
191-
->will($this->throwException($this->getMockBuilder($exception)->setMethods(null)->getMock()))
191+
->willThrowException($this->getMockBuilder($exception)->setMethods(null)->getMock())
192192
;
193193
}
194194

0 commit comments

Comments
 (0)
0