Skip to content
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

Improve DOM tree navigation #15

Open
jubianchi opened this issue Jan 9, 2013 · 0 comments
Open

Improve DOM tree navigation #15

jubianchi opened this issue Jan 9, 2013 · 0 comments

Comments

@jubianchi
Copy link
Member

Since cfef991, AtoumBundle provides a nice fluent API to write tests. This API has some requirements that may be improved : actually, we need to add several calls to ->end() to get the right scope in assertions. This can be improved and I would like to propose a better syntax : https://gist.github.com/4336789#file-controllertest-php-L54-L83 (Two test method are implemented, one with actual API and one with the proposed one)

In the previous Gist, you'll see that quite every call to ->end() have been removed. This makes the test shorter and perhaps easier to write :

  • It provides us a shorter way to put simple assertions on child nodes of an element
  • Calls to ->end() are useless : the asserters would be able to manage scope by themselves.

To me, this snippet is cleaner but this modification has a cost : it introduces a BC break with current tests has some assertions will not work the same way :

  • To do complex assertions on child nodes, we'll have to use a crawler
  • end will be removed and also replaced by parentwhich seems to be more expressive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant