2011-12-05 3 views
12

Estoy intentando probar mi unidad Zend Framework usando PHPUnit 3.6.4. Me sale el siguiente error cuando intento este comando en mi símbolo del sistema.Declaración de Zend_Test_PHPUnit_Constraint_DomQuery :: evaluate() debería ser compatible con la de PHPUnit_Framework_Constraint :: evaluate()

C:\xampp\htdocs\testsample\tests>phpunit --configuration phpunit.xml 
PHPUnit 3.6.4 by Sebastian Bergmann. 

Configuration read from C:\xampp\htdocs\testsample\tests\phpunit.xml 

←[31;1mE←[0m←[31;1mE←[0m.. 

Time: 0 seconds, Memory: 10.00Mb 

There were 2 errors: 

1) IndexControllerTest::testIndexWithMessageAction 
Declaration of Zend_Test_PHPUnit_Constraint_DomQuery::evaluate() should be compatible   
with that of PHPUnit_Framework_Constraint::evaluate() 

C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\Constraint\DomQuery.php:40 
C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\ControllerTestCase.php:512 
C:\xampp\htdocs\testsample\tests\application\controllers\IndexControllerTest.php 
:14 
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:925 
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:787 
C:\xampp\php\PEAR\PHPUnit\Framework\TestResult.php:649 
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:734 
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:772 
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:745 
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:705 
C:\xampp\php\PEAR\PHPUnit\TextUI\TestRunner.php:325 
C:\xampp\php\PEAR\PHPUnit\TextUI\Command.php:187 
C:\xampp\php\PEAR\PHPUnit\TextUI\Command.php:125 
C:\xampp\php\phpunit:44 

2) IndexControllerTest::testIndexNoMessageAction 
Declaration of Zend_Test_PHPUnit_Constraint_ResponseHeader::evaluate() should be 
compatible with that of PHPUnit_Framework_Constraint::evaluate() 

C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\Constraint\ResponseHeader.php:400 

C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\ControllerTestCase.php:769 
C:\xampp\htdocs\hive\library\Zend\Test\PHPUnit\ControllerTestCase.php:769 
C:\xampp\htdocs\testsample\tests\application\controllers\IndexControllerTest.php 
:22 
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:925 
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:787 
C:\xampp\php\PEAR\PHPUnit\Framework\TestResult.php:649 
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:734 
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:772 
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:745 
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:705 
C:\xampp\php\PEAR\PHPUnit\TextUI\TestRunner.php:325 
C:\xampp\php\PEAR\PHPUnit\TextUI\Command.php:187 
C:\xampp\php\PEAR\PHPUnit\TextUI\Command.php:125 
C:\xampp\php\phpunit:44 

←[37;41m←[2KFAILURES! 
←[0m←[37;41m←[2KTests: 4, Assertions: 10, Errors: 2. 
←[0m←[2K 
Generating code coverage report, this may take a moment. 

¿Por qué me sale este error? ¿Qué es lo que he hecho mal? Por favor, ayúdenme

Respuesta

19

Zend Framework 1 aplicaciones actualmente, y posiblemente durante bastante tiempo, solo funcionan correctamente utilizando PHPUnit 3.5.x.

Consulte cómo cambiar a 3.5 en downgrade phpunit 3.6 to 3.5.15.

Zend Framework 2 admitirá la versión actual de PHPUnit nuevamente.

+0

su agradecimiento de trabajo :) – Srivathsa

+2

ver este [tema] (http: //framework.zend. com/issues/browse/ZF-11828) en el ZF Bugtracker. –

+0

Resolución: No se soluciona – max4ever

2

Nunca pensé que iba a responder una publicación de 2 años, encontré el mismo problema y encontré el sitio this de un caballero que modificó la biblioteca de Zend y me funcionó (no pude degradar ...) Espero que ayudará a alguien :-)

4

puede suprimir el error de incompatibilidad de versiones con el phpdoc @expectedException comando:

/** 
* test bad url 
* @requires PHPUnit 3.5.15 
* @expectedException PHPUnit_Framework_Error_Notice 
* // Zend Framework 1.X cannot use anything greater than PHPUnit 3.5.15 
* */ 
public function test_InvalidUrl_wrong_action() 
{ 
    $this->dispatch('/index/fake'); 
    $this->assertController('error','should be the error controller'); 
    $this->assertAction('error','should be the error action'); 
    $this->assertResponseCode(200); 
} 
Cuestiones relacionadas