PHPUnit Error details

When I run PHP unit from the command line, I get output like the following:

SessionTest::testDisplayInfo
Login matches
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'rpeters'
+'jdell'

/var/www/html/crr_rpeters/tests/acceptance/SessionTest.php:37


But when I run them in PHPStorm, it spits out:

PHPUnit_Framework_ExpectationFailedException : Login matches
Failed asserting that two strings are equal.
#0 /usr/share/pear/PHPUnit/Framework/Assert.php(2100): evaluate()
#1 /usr/share/pear/PHPUnit/Framework/Assert.php(441): assertThat()
#2 /var/www/html/crr_rpeters/tests/acceptance/SessionTest.php(37): assertEquals()
#3 /usr/share/pear/PHPUnit/Framework/TestCase.php(940): invokeArgs()
#4 /usr/share/pear/PHPUnit/Framework/TestCase.php(802): runTest()
#5 /usr/share/pear/PHPUnit/Framework/TestResult.php(649): runBare()
#6 /usr/share/pear/PHPUnit/Framework/TestCase.php(749): run()
#7 /usr/share/pear/PHPUnit/Framework/TestSuite.php(772): run()
#8 /usr/share/pear/PHPUnit/Framework/TestSuite.php(745): runTest()
#9 /usr/share/pear/PHPUnit/TextUI/TestRunner.php(325): run()
#10 /var/www/html/crr_rpeters/tests/_intellij_phpunit_launcher.php(524): doRun()
#11 /var/www/html/crr_rpeters/tests/_intellij_phpunit_launcher.php(842): runTest()
#12 /var/www/html/crr_rpeters/tests/_intellij_phpunit_launcher.php(938): main()


This doesn't give me the important details of what the two strings actually were, making debugging the failure much harder.

Is there an option to turn on this extra detail?

7 comments
Comment actions Permalink

No, but you could do that yourself in the test (third parameter for assertEquals());

0
Comment actions Permalink

Hello Ryan,

The issue is fixed in PhpStorm 3.0.
click_to_see_difference.png


Thank you for feedback!

0
Comment actions Permalink

I'm running 3.0.1. Are you saying this will be fixed in a later release?

Maybe it's relevant, so I should mention I'm running PHPUnit on Server.

0
Comment actions Permalink

Hi Ryan,

It works OK for me in 111.150 EAP build (previous build, current one is 111.217), local execution (Windows 7).

It would be good if you can create very simple test and run it locally to confirm for yourself that this is remote execution issue (not supported by PHPUnit on Server config type).

0
Comment actions Permalink

Specifically I'm using 111.217. And I don't have PHP installed locally, nor do I want to install the whole LAMP stack just to test this.

0
Comment actions Permalink

You only need PHPUnit & PHP for a simple test.

In any case: it was only a suggestion.

0
Comment actions Permalink

Ryan,

Fixed for 'PHPUnit' run configuration only, but you are using 'PHPUnit On Server' run configuration.

Thank you for feedback!

0

Please sign in to leave a comment.