Closed jubianchi closed 11 years ago
:+1:
Uses of a library like guzzle
would be great.
Yeah ! I use something like that in my pro projects but without the fluent interface.
Why Guzzle ? Symfony crawler is quite good for testing API.
@FlorianLB you are right, let's stay on symfony context, i used guzzle and i found this library very useful but crawler will be sufficient.
The crawler could also be abstracted to let the end user choose which one he wants to use.
:+1: @jubianchi
This is really nice. Since it's a Symfony bundle, the hard requirement of the Symfony crawler is okay. Yet we could enhance this later with an Interface Requirement or something like that :)
Good job.
I added a gist (https://gist.github.com/4336789) where I'll put updated examples while I'm working on this PR.
I updated the gist linked in my previous comment with some cool stuff.
As I did in another PR on atoum (https://github.com/atoum/atoum/pull/151), I had to rely on an end
keyword to trigger assertions. I am not a big fan of this but it's really difficult to avoid using something like this and keep the navigation in the DOM tree easy.
At the moment, I don't know how to do things without this keyword. In some cases, the end
keyword can be omitted but, again, I don't like this because it breaks an atoum's principle : intuitive.
What do you think of this end
thing ?
Another thing that can be omitted : you can avoid typing the exactly
assertion if you expect to find only one element.
IMO end
keyworld should not be a problem ... It looks like a tree, end
is useful for us and for user to easily see which node is related.
Awesome work @jubianchi ;)
There is a BC ($kernel
in Test\Units\WebTestCase
) but i guess we can deal with it with a tag.
Nice job, ready to merge ?
@FlorianLB I think it's good to merge but it's missing an asserter on the headers. I'll write it ASAP.
By the way, if you want to merge this as is, ou can but I think it would be better to give it a try by checking ou the branch locally and using it in some tests.
and a review of the code would also be really nice too ;)
My previous comment is wrong : after reviewing my commit I saw I already wrote the missing headers asserter.
Sorry, I'm a bit confused as I'm tired and sick :s
Awesome work ! :+1:
I did some review/tests, looks fine. It can be improved to be extend more easily (add new HTTP verbs, use a custom response asserter, etc) but can be done in a second time.
I will try to add some docs tonight.
Go merge ?
ok go :)
Let's go \o/
Thank you @jubianchi ;)
Nice work ;-)
Nice one @jubianchi
What do you think of something like that ?
https://github.com/jubianchi/AtoumBundle/tree/custom-asserters#test-a-controller