-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle]: use __invoke function if no method is defined in r… #31367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,24 @@ | |
|
||
class ControllerResolverTest extends ContainerControllerResolverTest | ||
{ | ||
public function testGetControllerWithServiceWithoutMethod() | ||
{ | ||
class_exists(AbstractControllerTest::class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the reason for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No specific reason. Think it's better to remove it but since I have to start from master branch, I should rework the entire new code |
||
|
||
$dummyController = new DummyController(); | ||
$container = new Container(); | ||
$container->set('app.index_controller', $dummyController); | ||
|
||
$resolver = $this->createControllerResolver(null, $container); | ||
$request = Request::create('/'); | ||
$request->attributes->set('_controller', 'app.index_controller'); | ||
|
||
$controller = $resolver->getController($request); | ||
|
||
$this->assertSame($container, $controller[0]->getContainer()); | ||
$this->assertSame('__invoke', $controller[1]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rjwebdev I would follow the same logic as in $this->assertInstanceOf('Symfony\Bundle\FrameworkBundle\Tests\Controller\DummyController', $controller);
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $controller->getContainer()); |
||
} | ||
|
||
public function testGetControllerOnContainerAware() | ||
{ | ||
$resolver = $this->createControllerResolver(); | ||
|
@@ -230,6 +248,10 @@ public function getContainer() | |
return $this->container; | ||
} | ||
|
||
public function __invoke() | ||
{ | ||
} | ||
|
||
public function fooAction() | ||
{ | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.