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.

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



  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?