On 10/24/10 6:22 PM, Matthias Nothhaft wrote:
Line 3 in your test code: defaults: { _controller:
FooGetTest:indexAction }
Does this really work? imho _controller must be something like
FooBundle:GetTest:index
It's legal:
a:b:c is the usual shortcut notation
a:b is method "b" from service id "a"
a::b is method "b" from class "a"
Fabien
But I suppose it's only example code, isn't it?
regards,
Matthias
On 24 Okt., 01:25, Lukas Kahwe Smith<[email protected]> wrote:
On 23.10.2010, at 21:33, Fabien Potencier wrote:
On 10/23/10 9:02 PM, Lukas Kahwe Smith wrote:
On 23.10.2010, at 17:21, Fabien Potencier<[email protected]>
wrote:
On 10/23/10 10:54 AM, Lukas Kahwe Smith wrote:
Hi,
I am trying to create a functional test to a controller and pass a GET
parameter along:
$client = $this->createClient(array('environment' => 'test'));
$client->request('GET', '/foo?ding=dong');
$this->assertContains('dong, $client->getResponse()->getContent());
However when I then do something like the following in my controller:
$content = $this->request->query->get('foo', 'nofoo');
$this->response->setContent($content);
return $this->response;
That's weird. I have just tested this code:
$client->request('GET', '/foo?foo=bar');
die(var_export($client->getRequest()->query->all()));
And the output is:
RuntimeException: array (
'foo' => 'bar',
)
as expected.
yeah. but my testing showed that un the controller the request parameter is not available
even though i am using the "request" service
Do you use a recent version of Symfony2? Because I have fixed a bug a week or
two ago that should have fixed your problem.
i should be fairly uptodate. but just to be sure, i just switched to
git://github.com/fabpot/symfony.git symfony and i still have the same issue.
note that of course the controller works just fine when i call it from a web
browser. not sure if this is relevant, but i also changed my index_dev.php to
use the test env when running things in the browser and it still worked fine.
here is the code i am using to test:http://pastie.org/1243929
regards,
Lukas Kahwe Smith
[email protected]
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en