douguwo2275
2016-02-01 07:40
浏览 68
已采纳

在phalcon单元测试中找不到UnitTestCase

I am running the example from https://docs.phalconphp.com/en/latest/reference/unit-testing.html I did all configuration but I am facing with

C:\xampp\htdocs\myproject>phpunit tests/UnitTest.php

Fatal error: Class 'UnitTestCase' not found in C:\xampp\htdocs\myproject\tests\Unit Test.php on line 16

Line 16 is

class UnitTest extends \UnitTestCase {

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duan1933 2016-02-01 07:45
    已采纳

    You need to run your test inside tests folder. As mentioned in that tutorial:

    This will run any tests under the tests/ directory.

    As you can see from PHPunit.xml file

    <?xml version="1.0" encoding="UTF-8"?>
    <phpunit bootstrap="./TestHelper.php"
             backupGlobals="false"
             backupStaticAttributes="false"
             verbose="true"
             colors="false"
             convertErrorsToExceptions="true"
             convertNoticesToExceptions="true"
             convertWarningsToExceptions="true"
             processIsolation="false"
             stopOnFailure="false"
             syntaxCheck="true">
        <testsuite name="Phalcon - Testsuite">
            <directory>./</directory>
        </testsuite>
    </phpunit>
    

    Directory is set to current one <directory>./</directory> So run tests like this:

    C:\xampp\htdocs\myproject\tests>phpunit UnitTest.php
    
    点赞 打赏 评论

相关推荐 更多相似问题