In this new post from Mike Purcell shares a solution to an error he came across in his unit testing - a "Constant already defined" message - and how he fixed it.
When upgrading the unit tests I had no problem, it was only when I was trying to integrate into CruiseControl that this was happening. Well after some time, I finally figured out the issue was the "ant" command to execute the unit tests was passing the -process-isolation flag to phpunit.
He found that when he called it with that flag, it was executed twice, resulting in the "already defined" message the second time. He fixed it by removing the extra flag. Another alternative is to wrap your constant definitions (and anything that dosen't need to be called/created again) in an "is defined" check.
没有评论:
发表评论