Issue Type: Bug Created: 2011-10-19T09:46:00.000+0000 Last Updated: 2013-02-11T19:36:46.000+0000 Status: Closed Fix version(s): Reporter: Vladas Dirzys (funkyfly) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Test_PHPUnit
Related issues: - ZF-11871
Declaration of Zend_Test_PHPUnit_Constraint_DomQuery::evaluate() should be compatible with that of PHPUnit_Framework_Constraint::evaluate()
Posted by Adam Lundrigan (adamlundrigan) on 2011-10-27T18:48:29.000+0000
PHPUnit 3.6 PHPUnit_Framework_Constraint::evaluate (See here)
<pre class="highlight"> public function evaluate($other, $description = '', $returnResult = FALSE)
<pre class="highlight"> public function evaluate($other, $assertType = null)
@[~matthew] What is the policy on PHPUnit compatibility in ZFv1?
Posted by Adam Lundrigan (adamlundrigan) on 2011-10-27T19:05:50.000+0000
Another consideration related to this issue is that assertType, which is used extensively in ZFv1's test suite, will be removed in PHPUnit v3.6.
Posted by Adam Lundrigan (adamlundrigan) on 2011-11-04T18:02:40.000+0000
The supported branch of PHPUnit for Zend Framework v1 is v3.4.x. There are no plans to update ZFv1 to any newer version of PHPUnit.
On a side note, I've been using various releases of 3.5 without any obvious negative side-effects (beside the flood of deprecation notices). YMMV, though.
Posted by Till Klampaeckel (till) on 2011-11-08T16:01:00.000+0000
I'd like to re-open this.
I can provide a patch for this, but please don't make us run an older version of PHPUnit.
Posted by Michelangelo van Dam (dragonbe) on 2011-11-14T14:26:10.000+0000
As being responsible for many QA tasks for several customers I cannot imagine ZF1 cannot be modified to support PHPUnit v.3.6.x. ZF is an industry leading framework used in projects with a lifetime over 5 years. PHPUnit is a not-to-be-neglected tool alongside ZF.
As I'm facing these issues myself now (our server admins upgraded all servers to PHPUnit 3.6.x) I need to solve this issue. So I can modify my changes to Zend_Test to support both PHPUnit 3.x and 3.6 versions and submit them to ZF trunk. Just want to see some more votes for this update.
Posted by Matthew Weier O'Phinney (matthew) on 2011-11-14T14:50:03.000+0000
Mike -- the problem is that PHPUnit has broken BC both from 3.4 to 3.5 and from 3.5 to 3.6. Add into this the fact that we have folks with a variety of different PHPUnit versions, and this becomes a game of whack-a-mole to support -- and takes time away from actual maintenance of the framework. (As an example, updating the unit test suite in ZF2 to use PHPUnit 3.5 took 40 hours of time.) Additionally, we either end up saying, "install the latest PHPUnit" (which may not be possible or easy for many, and which means if testing with an older version that there will be fatal errors due to unknown assertion methods), or we end up adding conditional logic to test for PHP versions in order to determine what assertions to run (or whether or not AllTests suites are enabled). Either way, we end up with a lot of work, and a lot of developer education.
I think time might be better spent creating a phar with PHPUnit 3.4 that we can include in the ZF1 repo to make it easier for maintainers to run tests under that version -- I suspect this would only take an hour or two tops to achieve.
Posted by Michelangelo van Dam (dragonbe) on 2011-11-14T18:25:06.000+0000
Hey Matthew. Yeah I know the difficulties PHPUnit powered applications are struggling with, and I know there should be more protection against sysadmins that just upgrade PEAR packages without knowing what the side effects will be of their actions. Trust me, getting a call at 2am because CI barfs out nothing but errors because SysAdmin upgraded the servers at 1am is not funny. Especially when discovering what truly happened at 6am, makes a nice guy homicidal...
Using Phar is indeed a very good idea (why haven't I come up with this?!?). This allows us to execute PHPUnit straight from the library or wherever the Phar will be placed.
Let me play a little with it as I have way too many setups on which I can test it and I'll get back to you on this.
Posted by Adam Lundrigan (adamlundrigan) on 2012-03-09T17:40:03.000+0000
I've worked around the problem by following the instructions here: http://tech.vg.no/2011/11/… Then setting the PHPUNIT environment variable prior to invoking tests:
<pre class="highlight"> $ export PHPUNIT=/usr/share/phpunit34/usr/local/bin/phpunit $ ./runtests.sh
Posted by Adam Lundrigan (adamlundrigan) on 2012-03-16T17:42:40.000+0000
I've been working on the PHAR idea again, and have made some progress. What I have done is strip the include calls from the PHPUnit source and added a simple autoloader to the PHAR manifest. Seems to avoid the problems I blogged about back in November but does introduce new problems: * Now getting plenty of these:
<pre class="highlight"> PHP Warning: array_flip(): Can only flip STRING and INTEGER values! in phar:///path/to/phpunit.phar/PHPUnit/Util/GlobalState.php on line 192
A slightly different result between the using PHAR and not:
3.4.16 PHAR: Tests: 15844, Assertions: 49727, Failures: 277, Errors: 116, Incomplete: 20, Skipped: 599 3.4.16 Standalone: Tests: 15844, Assertions: 49742, Failures: 279, Errors: 107, Incomplete: 20, Skipped: 599.
Oh, and with the PHAR I get a fatal error like this:
<pre class="highlight"> Fatal error: Cannot redeclare class SampleClass in /tmp/UnitFileiHNOCw on line 4 (require_once'd from tests/Zend/CodeGenerator/Php/FileTest.php:104)
Posted by Adam Lundrigan (adamlundrigan) on 2012-03-20T23:44:03.000+0000
Closing as won't fix due to a collection of reasons:
Posted by Anthony Thompson (athompson9) on 2013-02-11T19:36:46.000+0000
I'm running Zend Studio 9.0.4 and encountered the same error - and the only version of PHPUnit I was using was the one that came with Zend Studio, 3.6.10
I had to do two few things to make this work.
To do this I had to right-click on my project, then: Include Path -> Configure Include Path -> Add Library -> Zend Framework 1.x -> Next -> Finish
Instead, do the following: Include Path -> Configure Include Path -> Add Library -> User Library -> Next -> New -> User library name: PHPUnit 3.5.14 (check "Add to environment") -> OK -> Add External Folder -> navigate to C:\Program Files\Zend\Zend Studio 9.0.4\plugins\com.zend.php.phpunit_220.127.116.11210081806\resources\library\3.5.14 and OK -> Finish
Then Projects -> Clean -> Clean All Projects -> OK, and File -> Restart
I based this on the "Zend Studio - Update PHPUnit video" I found at http://www.youtube.com/watch?v=t0-kz3Ctk_4
Have you found an issue?
See the Overview section for more details.