【问题标题】:UnitTestCase not found in phalcon unit testing在 phalcon 单元测试中找不到 UnitTestCase
【发布时间】:2016-05-09 14:11:00
【问题描述】:

我正在运行示例 https://docs.phalconphp.com/en/latest/reference/unit-testing.html 我做了所有的配置,但我面临着

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

致命错误:在中找不到类“UnitTestCase” C:\xampp\htdocs\myproject\tests\Unit Test.php 第 16 行

第 16 行是

类 UnitTest 扩展 \UnitTestCase {

【问题讨论】:

    标签: php


    【解决方案1】:

    您需要在 tests 文件夹中运行您的测试。如该教程中所述:

    这将运行 tests/ 目录下的所有测试。

    从 PHPunit.xml 文件可以看出

    <?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>
    

    目录设置为当前目录&lt;directory&gt;./&lt;/directory&gt; 所以像这样运行测试:

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

    【讨论】:

    • 这是工作,但我再次面临“严格标准:UnitTestCase::setUp() 的声明应该与 Phalcon\Test\UnitTestCase::setUp(Phalcon\DiInterface $di = NULL, Phalcon \配置"
    • @illusionist 我不能肯定,我需要看代码
    猜你喜欢
    • 2013-09-22
    • 1970-01-01
    • 2016-12-02
    • 1970-01-01
    • 2018-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多