Skip to content

Commit 14dfaa5

Browse files
Fix more bad tests
1 parent 9bd8ba4 commit 14dfaa5

File tree

3 files changed

+28
-35
lines changed

3 files changed

+28
-35
lines changed

Tests/Controller/AbstractControllerTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ public function testMissingParameterBag()
8181

8282
class TestAbstractController extends AbstractController
8383
{
84-
use TestControllerTrait;
85-
8684
private $throwOnUnexpectedService;
8785

8886
public function __construct($throwOnUnexpectedService = true)
8987
{
9088
$this->throwOnUnexpectedService = $throwOnUnexpectedService;
9189
}
9290

91+
public function __call(string $method, array $arguments)
92+
{
93+
return $this->$method(...$arguments);
94+
}
95+
9396
public function setContainer(ContainerInterface $container)
9497
{
9598
if (!$this->throwOnUnexpectedService) {
@@ -114,11 +117,6 @@ public function setContainer(ContainerInterface $container)
114117
return parent::setContainer($container);
115118
}
116119

117-
public function getParameter(string $name)
118-
{
119-
return parent::getParameter($name);
120-
}
121-
122120
public function fooAction()
123121
{
124122
}

Tests/Controller/ControllerTraitTest.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
1313

1414
use Fig\Link\Link;
15-
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
1615
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1716
use Symfony\Component\DependencyInjection\Container;
1817
use Symfony\Component\Form\Form;
@@ -550,29 +549,3 @@ public function testAddLink()
550549
$this->assertContains($link2, $links);
551550
}
552551
}
553-
554-
trait TestControllerTrait
555-
{
556-
use ControllerTrait {
557-
generateUrl as public;
558-
redirect as public;
559-
forward as public;
560-
getUser as public;
561-
json as public;
562-
file as public;
563-
isGranted as public;
564-
denyAccessUnlessGranted as public;
565-
redirectToRoute as public;
566-
addFlash as public;
567-
isCsrfTokenValid as public;
568-
renderView as public;
569-
render as public;
570-
stream as public;
571-
createNotFoundException as public;
572-
createAccessDeniedException as public;
573-
createForm as public;
574-
createFormBuilder as public;
575-
getDoctrine as public;
576-
addLink as public;
577-
}
578-
}

Tests/Controller/TestController.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,30 @@
33
namespace Symfony\Bundle\FrameworkBundle\Tests\Controller;
44

55
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6+
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
67

78
class TestController extends Controller
89
{
9-
use TestControllerTrait;
10+
use ControllerTrait {
11+
generateUrl as public;
12+
redirect as public;
13+
forward as public;
14+
getUser as public;
15+
json as public;
16+
file as public;
17+
isGranted as public;
18+
denyAccessUnlessGranted as public;
19+
redirectToRoute as public;
20+
addFlash as public;
21+
isCsrfTokenValid as public;
22+
renderView as public;
23+
render as public;
24+
stream as public;
25+
createNotFoundException as public;
26+
createAccessDeniedException as public;
27+
createForm as public;
28+
createFormBuilder as public;
29+
getDoctrine as public;
30+
addLink as public;
31+
}
1032
}

0 commit comments

Comments
 (0)