GianniGianni's avatar

[L5.1] Test fails but it's ok using the browser

I've written the following test

http://pastebin.com/sL0u8Ztn

The test fails with:

Failed asserting that '[HTML code of the page]' matches PCRE pattern "/My first post/i".

Further details Obviously string My first post does not appear in '[HTML code of the page]' message but if I do the same operation by hand with the browser the string appears and everything works.

and obviously phpunit manages to save the status into the DB successfully

Can you help me?

0 likes
5 replies
devinfd's avatar

What is the failure message that you are getting?

devinfd's avatar

Sorry, what I meant to say is what is the content of the page at that point? Ie: what is php unit seeing?

GianniGianni's avatar

The only difference between the HTM I see in the browser and the HTML printed out by phpunit is the presence of the string My first post.

It's becoming more and more weird :(

GianniGianni's avatar

The /statuses page display only the statuses posted by the user logged-in If I make the page displaying all the statuses by all the users the test turns green.

Seems that after posting the status phpunit does a logout or refresh the database. But why?

Please or to participate in this conversation.