2010-11-30 5 views
6

방금 ​​내 코드에 대한 단위 테스트를 다시 만들었습니다. 나는 과거에 PHPUnit을 사용해 왔지만 오늘날에는 공을 가지고 있지 않습니다. 새로운 테스트를 만들기 전에 필자는 오래된 테스트를 실행하여 유효한지 확인했지만 PHPUnit 자체에서 치명적인 오류가 발생했습니다. 우분투의 CLI에서 PHPUnit을 실행합니다.phpUnit 치명적 오류

phpunit TestCaseFile 

PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/imap.ini on line 1 in Unknown on line 0 
PHP Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0 

Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0 

Warning: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0 

Fatal error: Class 'PHPUnit_Framework_MockObject_Matcher_InvokedRecorder' not found in /usr/share/php/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php on line 60 

Call Stack: 
    0.0002  651688 1. {main}() /usr/bin/phpunit:0 
    0.0031 1173168 2. require('/usr/share/php/PHPUnit/TextUI/Command.php') /usr/bin/phpunit:48 
    0.0046 1485456 3. require_once('/usr/share/php/PHPUnit/TextUI/TestRunner.php') /usr/share/php/PHPUnit/TextUI/Command.php:47 
    0.0047 1503344 4. require_once('/usr/share/php/PHPUnit/Framework.php') /usr/share/php/PHPUnit/TextUI/TestRunner.php:47 
    0.0168 3848688 5. require('/usr/share/php/PHPUnit/Framework/TestCase.php') /usr/share/php/PHPUnit/Framework.php:68 
    0.0178 4091880 6. require_once('/usr/share/php/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php') /usr/share/php/PHPUnit/Framework/TestCase.php:49 

나는 파일 경로 등은 정확하지만 난 정말 그 사람이 도움이 될 수 있습니다 고정 대해 이동하는 방법을 알고하지 않는 것이, 파일이 존재하는지 확인하기 위해 검사?

답변

3

아무런 걱정없이 사람들이 고칠 수 있습니다.

내가 다음

apt-get remove phpunit

를 실행

apt-get install phpunit

를 설치 다시 나에게 최신 버전을 얻었다 처음 phpunit을 설치할 때 내가 APT와 함께 설치 밝혀 모두 잘 작동합니다. 희망이 비슷한 문제를 가진 다른 사람들을 도와줍니다.

22

OSX에서이 문제가 발생했습니다. PEAR을 통해 phpunit을 제거하고 ez 구성 요소 채널을 다시 추가 한 다음 phpunit을 다시 설치해야했습니다.

$ phpunit 
PHP Fatal error: Class 'PHPUnit_Framework_MockObject_Matcher_InvokedRecorder' not found in /usr/lib/php/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php on line 60 
$ sudo pear uninstall phpunit/PHPUnit 
uninstall ok: channel://pear.phpunit.de/PHPUnit-3.4.11 
$ sudo pear install phpunit/PHPUnit 
Unknown remote channel: components.ez.no 
Unknown remote channel: components.ez.no 
phpunit/PHPUnit can optionally use PHP extension "dbus" 
phpunit/PHP_CodeCoverage requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6) 
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5) 
phpunit/PHPUnit requires package "phpunit/PHP_CodeCoverage" (version >= 1.0.2) 
phpunit/PHP_TokenStream requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6) 
No valid packages found 
install failed 
$ sudo pear channel-discover components.ez.no 
Adding Channel "components.ez.no" succeeded 
Discovery of channel "components.ez.no" succeeded 
$ sudo pear update-channels 
.... 
$ sudo pear install phpunit/PHPUnit 
phpunit/PHPUnit can optionally use PHP extension "dbus" 
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5) 
downloading PHPUnit-3.5.10.tgz ... 
.... 
install ok: channel://components.ez.no/Base-1.8 
install ok: channel://components.ez.no/ConsoleTools-1.6.1 
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.0.1 
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.0.3 
install ok: channel://pear.phpunit.de/PHPUnit-3.5.10 
$ phpunit 
PHPUnit 3.5.10 by Sebastian Bergmann. 

.

배/XML_RPC2은 PHP 확장을 필요로 "컬"

그래서 나는 우분투 소프트웨어 센터를 통해 PHP5-컬을 설치 :

+1

수정 사항은 Windows에서도 잘 작동합니다. 단지'sudo' 부분 만 제거하면됩니다. –

+0

Excellent. 감사합니다 :) –

+0

완벽! 감사합니다 – Quentin

2

우선 나는이 문제를 가지고 있었다.

알 원격 채널 : components.ez.no

이 종속성 때문에 설치할 수없는

는이 문제가 있었다. 이 일 후 :

sudo는 배 components.ez.no

모든 것이 잘 작동 채널 발견 할 수 있습니다.

관련 문제