10000 Merge branch '2.8' into 3.0 · symfony/symfony@239d546 · GitHub
[go: up one dir, main page]

Skip to content

Commit 239d546

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: move test methods to test case class
2 parents 96eacb4 + d2b0ebc commit 239d546

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -261,44 +261,6 @@ public function testIsCsrfTokenValid()
261261

262262
$this->assertTrue($controller->isCsrfTokenValid('foo', 'bar'));
263263
}
264-
}
265-
266-
class TestController extends Controller
267-
{
268-
public function forward($controller, array $path = array(), array $query = array())
269-
{
270-
return parent::forward($controller, $path, $query);
271-
}
272-
273-
public function getUser()
274-
{
275-
return parent::getUser();
276-
}
277-
278-
public function isGranted($attributes, $object = null)
279-
{
280-
return parent::isGranted($attributes, $object);
281-
}
282-
283-
public function denyAccessUnlessGranted($attributes, $object = null, $message = 'Access Denied.')
284-
{
285-
parent::denyAccessUnlessGranted($attributes, $object, $message);
286-
}
287-
288-
public function redirectToRoute($route, array $parameters = array(), $status = 302)
289-
{
290-
return parent::redirectToRoute($route, $parameters, $status);
291-
}
292-
293-
public function addFlash($type, $message)
294-
{
295-
parent::addFlash($type, $message);
296-
}
297-
298-
public function isCsrfTokenValid($id, $token)
299-
{
300-
return parent::isCsrfTokenValid($id, $token);
301-
}
302264

303265
public function testGenerateUrl()
304266
{
@@ -330,7 +292,8 @@ public function testRenderViewTemplating()
330292
$templating->expects($this->once())->method('render')->willReturn('bar');
331293

332294
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
333-
$container->expects($this->at(0))->method('get')->will($this->returnValue($templating));
295+
$container->expects($this->at(0))->method('has')->willReturn(true);
296+
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
334297

335298
$controller = new Controller();
336299
$controller->setContainer($container);
@@ -344,7 +307,8 @@ public function testRenderTemplating()
344307
$templating->expects($this->once())->method('renderResponse')->willReturn(new Response('bar'));
345308

346309
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
347-
$container->expects($this->at(0))->method('get')->will($this->returnValue($templating));
310+
$container->expects($this->at(0))->method('has')->willReturn(true);
311+
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
348312

349313
$controller = new Controller();
350314
$controller->setContainer($container);
@@ -357,7 +321,8 @@ public function testStreamTemplating()
357321
$templating = $this->getMock('Symfony\Component\Routing\RouterInterface');
358322

359323
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
360-
$container->expects($this->at(0))->method('get')->will($this->returnValue($templating));
324+
$container->expects($this->at(0))->method('has')->willReturn(true);
325+
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
361326

362327
$controller = new Controller();
363328
$controller->setContainer($container);
@@ -418,3 +383,41 @@ public function testGetDoctrine()
418383
$this->assertEquals($doctrine, $controller->getDoctrine());
419384
}
420385
}
386+
387+
class TestController extends Controller
388+
{
389+
public function forward($controller, array $path = array(), array $query = array())
390+
{
391+
return parent::forward($controller, $path, $query);
392+
}
393+
394+
public function getUser()
395+
{
396+
return parent::getUser();
397+
}
398+
399+
public function isGranted($attributes, $object = null)
400+
{
401+
return parent::isGranted($attributes, $object);
402+
}
403+
404+
public function denyAccessUnlessGranted($attributes, $object = null, $message = 'Access Denied.')
405+
{
406+
parent::denyAccessUnlessGranted($attributes, $object, $message);
407+
}
408+
409+
public function redirectToRoute($route, array $parameters = array(), $status = 302)
410+
{
411+
return parent::redirectToRoute($route, $parameters, $status);
412+
}
413+
414+
public function addFlash($type, $message)
415+
{
416+
parent::addFlash($type, $message);
417+
}
418+
419+
public function isCsrfTokenValid($id, $token)
420+
{
421+
return parent::isCsrfTokenValid($id, $token);
422+
}
423+
}

0 commit comments

Comments
 (0)
0