0
votes

I updated my tests from Codeception 2.0.9 to 2.1.5.

Everything works fine except the PhpBrowser::grabAttributeFrom() method. I'll get a PHPUnit exception like this:

[PHPUnit_Framework_Exception] DOMDocument::loadXML(): Entity 'nbsp' not defined in Entity, line: 3

or

[PHPUnit_Framework_Exception] DOMDocument::loadXML(): Opening and ending tag mismatch: img line 141 and a in Entity, line: 142

It seems, that the grabAttributeFrom is very strict with HTML-DOM parsing. I googled the message and found, that the DOMDocument::loadHtml() is a bit less strict and would work.

http://php.net/manual/en/domdocument.loadhtml.php

How can I fix this grabAttributeFrom? I need the content of a href/src attribute of a HTML file.

1
Could you get the stacktrace? run this test with -vvv flag. - Naktibalda
Is the REST module enabled in the same suite? - Naktibalda
Oh. Yes, that seems the solution for this problem. REST Module and PhpBrowser doesn't work together anymore. :( I need the REST Bundle to check HTTP-Headers in this test. - rickroyce

1 Answers

1
votes

The hint of @Naktibalda guides myself to the resolution. It's a conflict of the modules REST and PhpBrowser. Both modules have implemented the function grabAttributeFrom. To get the right one, you have to change the order in the configuration, to get the one of PhpBrowser:

modules:
  enabled:
    - REST:
        depends: PhpBrowser
        url: 'http://www.domain.com'
    - PhpBrowser:
        url: 'http://www.domain.com'

This works for me, because PhpBrowser now overrules the method in the builded AcceptanceTester.php.