Foros del Web » Programando para Internet » PHP » Zend »

Testear librerías propias

Estas en el tema de Testear librerías propias en el foro de Zend en Foros del Web. Hola, tengo montado un proyecto en Zend con la siguiente estructura Código: /application /docs /library /library/My /library/My/Helper /public /tests /tests/application /tests/library /tests/library/My /tests/library/My/Helper Mi fichero ...
  #1 (permalink)  
Antiguo 27/05/2011, 03:39
Avatar de jerkan  
Fecha de Ingreso: septiembre-2005
Mensajes: 1.607
Antigüedad: 18 años, 7 meses
Puntos: 19
Testear librerías propias

Hola,

tengo montado un proyecto en Zend con la siguiente estructura
Código:
/application
/docs
/library
/library/My
/library/My/Helper
/public
/tests
/tests/application
/tests/library
/tests/library/My
/tests/library/My/Helper
Mi fichero phpunit.xml tiene la siguiente pinta
Código XML:
Ver original
  1. <phpunit bootstrap="./application/bootstrap.php" colors="true" processIsolation="true">
  2.     <testsuite name="myname">
  3.         <directory>./</directory>
  4.     </testsuite>
  5.    
  6.     <filter>
  7.         <whitelist>
  8.             <directory suffix=".php">../application/</directory>
  9.             <directory suffix=".php">../library/My/</directory>
  10.             <exclude>
  11.                 <directory suffix=".phtml">../application/</directory>
  12.                 <file>../application/Bootstrap.php</file>
  13.                 <file>../application/controllers/ErrorController.php</file>
  14.             </exclude>
  15.         </whitelist>
  16.     </filter>
  17.    
  18.     <logging>
  19.         <log type="coverage-html" target="./log/report" charset="UTF-8"
  20.        yui="true" highlight="true" lowUpperBound="50" highUpperBound="80" />
  21.         <log type="testdox-html" target="./log/testdox.html" />
  22.     </logging>
  23. </phpunit>
Justo he añadido la línea
Código XML:
Ver original
  1. <directory suffix=".php">../library/My/</directory>
e intento ejecutar el siguient test sobre una librería propia y no encuentra ningún test
Código PHP:
Ver original
  1. <?php
  2. // tests/library/My/Registry
  3. /**
  4.  * test class for the registry helper
  5.  */
  6. class My_Helper_Registry_Test
  7.     extends ControllerTestCase
  8. {
  9.     /**
  10.      * saves a register
  11.      *
  12.      * @group libraries
  13.      * @group library-helpers
  14.      * @group library-helper-registry
  15.      */
  16.     public function testSave()
  17.     {
  18.         $this->assertTrue(true);
  19.     }    
  20. }
La línea de comando que ejecuto es
Código:
phpunit --debug --verbose --group library-helper-registry
y el resultado es
Código:
OK (0 tests, 0 assertions)
Teniendo en cuenta que el resto de tests que cuelgan de /application se ejecutan bien, no entiendo por qué los tests de librerías no se ejecutan

¿Alguna idea?

Gracias
  #2 (permalink)  
Antiguo 28/05/2011, 06:48
Avatar de jerkan  
Fecha de Ingreso: septiembre-2005
Mensajes: 1.607
Antigüedad: 18 años, 7 meses
Puntos: 19
Respuesta: Testear librerías propias

Solucionado.

El problema era que el fichero de test no acababa en Test.

Es decir, en vez de 'Registry.php' debía llamarse 'RegistryTest.php'

Etiquetas: frameworks-y-php-orientado-a-objetos, librerías, phpunit, tests
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:29.