[SOAP] improve error of grabTextContentFrom when xpath not found #3426

Merged
merged 1 commit into from Aug 10, 2016

Conversation

Projects
None yet
2 participants
@eXorus
Contributor

eXorus commented Aug 10, 2016

Hello,

$this->grabTextContentFrom("//*[local-name() = 'login']");

If [login] doesn't exist in the SOAP response you will have:

There was 1 error:
---------
1) soapCest: test
 Test  tests/api/soapCest.php:test

  [PHPUnit_Framework_Exception] Trying to get property of non-object

We don't know the name of property not found ... that's bad.

After the fix you will have:

There was 1 failure:
---------
1) soapCest: test
 Test  tests/api/soapCest.php:test
 Step  Grab Text Content From
 Fail   element with '//*[local-name() = 'login']' was not found.

It's better I think.

The fix was just because query return always a DOMNodeList but empty.
http://php.net/manual/en/domxpath.query.php

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Aug 10, 2016

Member

Yes, this is much better. Thanks

Member

DavertMik commented Aug 10, 2016

Yes, this is much better. Thanks

@DavertMik DavertMik merged commit 2ff0235 into Codeception:2.2 Aug 10, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment