Reduce processing load in test assertAPIFailure
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 23 Feb 2023 00:52:10 +0000 (13:52 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 23 Feb 2023 00:54:35 +0000 (13:54 +1300)
commitcc7ed47d9f0b515d7ec829a0dd8bb4d321c53df5
treeaa0ef8fce011cba8d73c5af7d26db0565427657e
parentd2980aac097e672e943a77d6f64bd4b95305eedb
Reduce processing load in test assertAPIFailure

In trying to figure out why adding 'too much' (an exception) to the
return caused a memory out I realised that the print_r here is
realised regardless of whether it is needed. This fixes to only
resolve if it is going to be displayed. Arguably this would have
been a case where an inline function would have made sense - but
at the cost of readability - ie it's more helpful
to add code comments to explain the if than to make the codd hard to
follow. The only downside is the hypothetical
possibility of is_error being something other than 1,'1',TRUE - I
think if we thought that was a remote possibilty we would add
a unit test to add it - not cover it in an assertion
Civi/Test/Api3TestTrait.php