atoum / AtoumBundle

This bundle provides a simple integration of atoum into Symfony 2.
MIT License
44 stars 25 forks source link

AtoumBundle doesn't work with Symfony 2.3.0 #36

Closed MickaelGuyot closed 11 years ago

MickaelGuyot commented 11 years ago

There is a problem with the new version of Symfony and the AtoumBundle.

When I tried to launch a basic functional test, I had the following error :

==> Error CATCHABLE FATAL ERROR in /home/mguyot/workspace/stockway/src/Front/HomeBundle/Tests/Controller/AtoumControllerTest.php on unknown line, generated by file /home/mguyot/workspace/stockway/vendor/atoum/atoum-bundle/atoum/AtoumBundle/Test/Asserters/Element.php on line 100:
Argument 1 passed to atoum\AtoumBundle\Test\Asserters\Element::atoum\AtoumBundle\Test\Asserters\{closure}() must be an instance of DOMNode, instance of Symfony\Component\DomCrawler\Crawler given, called in /home/mguyot/workspace/stockway/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Crawler.php on line 318 and defined

The class Element from atoum/AtoumBundle/Test/Asserters doesn't work with the new file symfony/Component/DomCrawler/Crawler.php

To make it works, I tried to replace, in the file Element.php on lines 100 and 101 (function hasContent() ) :

            function(\DOMNode $node) {
                return ($node->nodeValue != '');

by :

            function(DOMCrawler $node) {
                return ($node->text() != '');

I did the same thing in the function filterContent() (lines 116 and 117) because I had the same problem, and now my test works.

jubianchi commented 11 years ago

Too bad there is such a break between 2.2- and 2.3.

I'll try to do something to support both version with the same code. Thanks for the report

jubianchi commented 11 years ago

My previous PR does not fully fix the problem with SF 2.3. On on a better implementation which will fully handle the BC break introduced with 2.3 DomCrawler.