dongying7847 2014-09-10 14:56
浏览 65


I tried to run an example from here:

I created composer file:

    "require": {
        "phalcon/incubator": "dev-master"

After composer installation I've tried to run phpunit and got an error:

PHP Fatal error:  Class 'Codeception\TestCase\Test' not found in /www/tests/vendor/phalcon/incubator/codeception/unit/Phalcon/Validation/Validator/Db/UniquenessTest.php on line 9

I added new dependency:

composer require "codeception/codeception:*"

It added many dependencies.

After that I got another error:

PHP Warning:  require_once(tests/data/app/data.php): failed to open stream: No such file or directory in www/tests/vendor/codeception/codeception/tests/unit/Codeception/Module/FacebookTest.php on line 3

I changed



require_once(__DIR__ . '/../../../../tests/data/app/data.php')

in follow follow files:


Ok. Phpunit running...I've got next error:

PHP Fatal error:  Class 'WebDriverTestCase' not found in `www/tests/vendor/facebook/webdriver/tests/functional/BaseTest.php on line 16`

Ok.. I tried to include:

require_once __DIR__ . '/WebDriverTestCase.php';



Now I have following error which I cannot fix:

PHP Fatal error:  Uncaught exception 'PHPUnit_Framework_Exception' with message 'Class "PHPUnit_Extensions_RepeatedTest" does not extend PHPUnit_Framework_TestCase.' in www/tests/vendor/phpunit/phpunit/src/Framework/TestSuite.php:195
Stack trace:
#0 /www/tests/vendor/phpunit/phpunit/src/Framework/TestSuite.php(324): PHPUnit_Framework_TestSuite->__construct(Object(ReflectionClass))
#1 /www/tests/vendor/phpunit/phpunit/src/Framework/TestSuite.php(409): PHPUnit_Framework_TestSuite->addTestSuite(Object(ReflectionClass))
#2 /www/tests/vendor/phpunit/phpunit/src/Framework/TestSuite.php(435): PHPUnit_Framework_TestSuite->addTestFile('/Users/anthony/...')
#3 phar:///usr/local/zend/bin/phpunit/phpunit/Util/Configuration.php(911): PHPUnit_Framework_TestSuite->addTestFiles(Array)
#4 phar:///usr/local/zend/bin/phpunit/phpunit/Util/Configuration.php(825): PHPUnit_Util_Configura in /www/tests/UnitTestCase.php on line 61

I thought composer should make your life easer by it seems doesn't. Is it ok I have to change some code in vendor libraries?!... where I'm doing wrong? I just need to use phpunit in phalcon...

  • 写回答

1条回答 默认 最新

  • duankuaizhe8257 2014-09-10 15:33

    By the time I finished reading the question I was expecting to see "Ok… I took a gun and shoot twice in a stomach…" I am a little uncertain if you are trying to run tests from incubator or Phalcon, or your own. I am assuming your own.

    First of all incubator is an interesting repository, but it's probably the last thing you need to use in your project. It's meant to make your life easier, but most stuff are experimental there and act more as an inspiration rather than a solution (imho). It's supported by less involved people and the reason why it doesn't work might also be the difference in PHPUnit versions (incubator uses 3.7, the rest of the contemporary world uses 4.2, which have some incompatibilities).

    Phalcon works perfectly fine with PHPUnit out of the box. To run basic tests all you need is to install and configure PHPUnit as per documentation. The simplest phpunit.xml can look like this:

    <phpunit bootstrap="../../public/bootstrap.php">
        <testsuite name="Default">

    I suggest get rid of incubator (at least for your tests until you successfully configure PHPUnit) and follow the standard documentation.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 qt msvc qmake qtcreat
  • ¥15 c#直接使用C++ 写的class 后续
  • ¥15 为何显示keyerror fruit
  • ¥15 关于#stm32#的问题:/* User can add his own implementation to report the HAL error return state */
  • ¥15 imageware粗糙度表面
  • ¥15 python使用pulp线性优化时报错
  • ¥15 为什么我的uibot导入py模块出错呀。py文件放在了uibot里对应的python文件夹了,卸了重安也不行
  • ¥15 开源或低价数据中台哪个最好
  • ¥15 arduino编程出现字符串疑似覆盖现象
  • ¥15 我的b站在没有碰到屏幕的情况下偶尔会自动跳出进度条,就像在屏幕上点了一下一样,但我并没有点。而且视频进度并没有变。这可能是什么原因造成的?