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

在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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 小贝360-4 配二个 华772S 设置WⅰFi5G 连接
  • ¥15 vs2022的QT报错,好像是缺少winextras
  • ¥15 怎么看 cst中一个面的功率分布图
  • ¥15 c语言数据结构求9999
  • ¥15 Fiddler无法对部分小程序抓包
  • ¥60 Python代码 ip首部检验和计算代码 版本协议 首部长度 源地址 目的地址 存活时间
  • ¥18 微机原理汇编的综合实验
  • ¥15 LD衰减图用R语言对其可视化
  • ¥15 Mermaid语法生成的svg在Axure无法编辑
  • ¥15 Windchill二次开发