title: Disabling stack trace on PHPUnit exception
body: <p>I have no need for the stack trace below when an PHPUnit assert fails, just my custom message <code>("Type: R Expected: 333.33333333333 Actual: 345")</code> and PHPUnit's fail message <code>("Failed assert that false is true")</code>.</p>
  
  <p>Is there a way other than putting all my tests in try/catch blocks and stripping the stack trace from the exception message before displaying it?</p>
  
  <p>I don't really wish the stack trace to disappear for any exceptions other than PHPUnit_Framework_ExpectationFailedException, however if this is not possible, I could handle losing the stack trace during all PHPUnit tests.</p>
  
  <p>Other posts on SO seem to suggest solutions for the opposite problem, getting the stack trace back when xdebug turns it off.</p>
  
  <pre><code>PHPUnit_Framework_ExpectationFailedException : Type: R Expected: 333.33333333333 Actual: 345
  Failed asserting that false is true.
  #0 /usr/share/php/PHPUnit/Framework/Constraint.php(91): PHPUnit_Framework_Constraint-&gt;fail(false, 'Type: R Expecte...')
  #1 /usr/share/php/PHPUnit/Framework/Assert.php(2134): PHPUnit_Framework_Constraint-&gt;evaluate(false, 'Type: R Expecte...')
  #2 /usr/share/php/PHPUnit/Framework/Assert.php(888): PHPUnit_Framework_Assert::assertThat(false, Object(PHPUnit_Framework_Constraint_IsTrue), 'Type: R Expecte...')
  #3 /home/simon/Development/golfants/website/unit_tests/PostTest.php(33): PHPUnit_Framework_Assert::assertTrue(false, 'Type: R Expecte...')
  #4 [internal function]: PostTest-&gt;testRandomAntTypeSelected()
  #5 /usr/share/php/PHPUnit/Framework/TestCase.php(976): ReflectionMethod-&gt;invokeArgs(Object(PostTest), Array)
  #6 /usr/share/php/PHPUnit/Framework/TestCase.php(831): PHPUnit_Framework_TestCase-&gt;runTest()
  #7 /usr/share/php/PHPUnit/Framework/TestResult.php(648): PHPUnit_Framework_TestCase-&gt;runBare()
  #8 /usr/share/php/PHPUnit/Framework/TestCase.php(776): PHPUnit_Framework_TestResult-&gt;run(Object(PostTest))
  #9 /usr/share/php/PHPUnit/Framework/TestSuite.php(775): PHPUnit_Framework_TestCase-&gt;run(Object(PHPUnit_Framework_TestResult))
  #10 /usr/share/php/PHPUnit/Framework/TestSuite.php(745): PHPUnit_Framework_TestSuite-&gt;runTest(Object(PostTest), Object(PHPUnit_Framework_TestResult))
  #11 /usr/share/php/PHPUnit/TextUI/TestRunner.php(349): PHPUnit_Framework_TestSuite-&gt;run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
  #12 /usr/share/php/PHPUnit/TextUI/Command.php(176): PHPUnit_TextUI_TestRunner-&gt;doRun(Object(PHPUnit_Framework_TestSuite), Array)
  #13 /tmp/ide-phpunit.php(95): PHPUnit_TextUI_Command-&gt;run(Array, true)
  #14 /tmp/ide-phpunit.php(434): IDE_PHPUnit_TextUI_Command::main()
  #15 {main}
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>It appears this issue is caused by IDE (IntelliJ Idea and possibly PHPStorm) not calling PHPUnit directly when unit testing but via its own script, ide_phpunit.php. The problem doesn't occur directly invoking PHPUnit from a command line. This ide_phpunit.php script is created each time by the IDE so modification isn't easy, nor does it like being write protected against overwrite. There may be an easy solution but I put this one in the "not worth the effort" basket.</p>