Tengo un proyecto de Zend Framework, y quiero usar pruebas unitarias para probarlo.phpunit throws Excepción no detectada 'PHPUnit_Framework_Exception
En la carpeta de pruebas, tengo el phpunit.xml
de la siguiente manera;
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Application Test Suite">
<directory>./</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application/</directory>
<exclude>
<directory suffix=".phtml">../application/</directory>
<file>../application/Bootstrap.php</file>
<file>../application/controllers/ErrorController.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/reprot" charset="UTP-8"
yui="true" highlight = "true" lowUpoerBound="50" highLowerBound="80"/>
<log type="textdox" target="./log/testdox.html" />
</logging>
Y tengo bootstrap.php
en/pruebas carpeta/aplicación de la siguiente manera:
<?php
error_reporting(E_ALL | E_STRICT);
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
require_once 'Zend/Loader/Autoloader.php';
require_once 'controllers/ControllerTestCase.php';
Zend_Loader_Autoloader::getInstance();
cuando voy a la línea de comandos, ejecute el siguiente comando
phpunit --configuration phpunit.xml
arroja la excepción:
PHP Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "Application Test Suite.php" nor "Application Test Suite.php" could be opened.' in D:\PHP\php5\PEAR\PHPUnit\Util\Skeleton\Test.php:102 Stack trace: #0 D:\PHP\php5\PEAR\PHPUnit\TextUI\Command.php(157): PHPUnit_Util_Skeleton_Test- >__construct('Application Tes...', '') #1 D:\PHP\php5\PEAR\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run (Array, true) #2 D:\PHP\php5\phpunit(53): PHPUnit_TextUI_Command::main() #3 {main} thrown in D:\PHP\php5\PEAR\PHPUnit\Util\Skeleton\Test.php on line 102
¿Cómo podría solucionarlo?
que añadir el siguiente código en la carpeta que contiene Bootstrap.php Php require_once 'PHPUnit/Framework.php?'; // ... MiApl clase extiende PHPUnit_Framework_TestSuite { salón de actos públicos static() { $ = suite de nuevo PHPUnit_Framework_TestSuite ('MiApl'); $ suite-> addTestSuite ('MyApp'); // ... return $ suite; } } y sigue siendo el mismo error –
¿Cambió el nombre que proporcionó en usted XML? Esto debe corresponder directamente con el nombre de archivo de la clase del conjunto de pruebas menos la extensión. Entonces, si el código que acaba de publicar está en 'MyApp.php', entonces su xml debería verse así:' 'a diferencia de' ' –
prodigitalson
sí, yo Ya cambió el nombre en el archivo xml, el error es el mismo –