2011-03-12 2 views
2

나는 project1과 project2라는 두 개의 디렉토리가 있습니다. project1/tests에서 PHPUnit을 실행하면 정상적으로 작동합니다. project2/tests에서 실행할 때 코드 커버리지 보고서를 생성하지 않는다는 점만 제외하면 잘 작동합니다. phpunit.xml 설정 파일은 사실상 동일합니다. 각각 부름 부트 스트랩에는 약간의 차이가 있지만, 나는 이것이 중요하다고 생각하지 않습니다. (나는 경로를 체크 아웃하고 그들은 괜찮습니다).PHPUnit은 ZendFW로 코드 커버리지 보고서를 만들지 않습니다.

아이디어가 있으십니까? 이 문제를 진단하려면 어떻게해야합니까?

여기에 프로젝트 2/테스트에서 phpunit.xml입니다 :

<phpunit bootstrap="./TestBootstrap.php"> 
<testsuite name="OpenCompany"> 
    <directory>./</directory> 
</testsuite> 
<filter> 
    <whitelist> 
     <directory suffix=".php">..\library\</directory> 
     <directory suffix=".php">..\application\</directory> 
     <exclude> 
      <directory suffix=".phtml">..\application\</directory> 
     </exclude> 
    </whitelist> 
</filter> 
<logging> 
    <log type="coverage-html" target="./output/report" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/> 
    <log type="coverage-clover" target="./output/coverage.xml"/> 
    <log type="json" target="./output/logfile.json"/> 
    <log type="tap" target="./output/logfile.tap"/> 
    <log type="junit" target="./output/logfile.xml" logIncompleteSkipped="false"/> 
    <log type="testdox-html" target="./output/testdox.html"/> 
    <log type="testdox-text" target="./output/testdox.txt"/> 
</logging> 

그리고 여기 TestBootstrap.php는 다음과 같습니다

<?php 

// Adapted from tutorial by Matthew Weier O'Phinney 
// Tutorial is dated 11/09/2008 

// Set location 
date_default_timezone_set('Australia/Sydney'); 

// Set Error Reporting to All, Strict 
error_reporting(E_ALL | E_STRICT); 

// Sets include paths relative to location of TestBootstrap.php 
$root   = realpath(dirname(__FILE__).'/../'); // resolves to project directory 
$library  = $root.'/library'; 
$tests   = $root.'/tests'; 
$models   = $root.'/application/models'; 
$dbtables  = $root.'/application/models/DbTable'; 
$controllers = $root.'/application/controllers'; 

$path = array($models, $library, $dbtables, $tests, get_include_path()); 
set_include_path(implode(PATH_SEPARATOR, $path)); 

// Set Application Constants 
if (!defined('APPLICATION_PATH')) {define('APPLICATION_PATH', $root.'/application');} 
if (!defined('APPLICATION_ENV')) {define('APPLICATION_ENV', 'testing');} 

// Get Autoloading happening 
require_once 'Zend/Loader/Autoloader.php'; 
Zend_Loader_Autoloader::getInstance(); 

// Setup a default DB connection 
$db = Zend_Db::factory('Pdo_Mysql', array(
     'host'  => 'localhost', 
     'username' => 'root', 
     'password' => '', 
     'dbname' => 'openco_v1_0' 
     ) 
    ); 
Zend_Db_Table_Abstract::setDefaultAdapter($db); 

// Store some stuff in the registry 
// Zend_Registry::set('testRoot', $root); 
// Zend_Registry::set('testBootstrap', $root.'/application/bootstrap.php'); 

// Unset global variables that are no longer required 
unset($root, $library, $models, $dbtables, $controllers, $tests, $path); 

이 어떤 도움 감사합니다!

+0

xdebug 확장 프로그램이 설치되어 있습니까? – Marcin

답변

2

좋아, 이것을 정리했다. 모델에 오류가 있었기 때문에 (아마도 구문 분석 오류) PHPUnit은 테스트에서 다루어 진 금액을 결정하기 위해 코드를 이해할 수 없었습니다.

필자는 허용 목록에서/applications/models 테스트를 제외 시켰으므로 이제는 문제가 없습니다. 모델을 살펴보고 오류를 수정했으면 예외를 제거합니다.

관련 문제