English 中文(简体)
phpunit Bulls 例外 PHPUnit_Framework_Exception
原标题:phpunit throws Uncaught exception PHPUnit_Framework_Exception

我有一个“Zentd Framework”项目,希望利用单位测试测试。

在测试夹中,我有<编码>phpunit.xml:

<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Application Test Suite">
    <directory>./</directory>
</testsuite>

<filter>
    <whitelist>
        <directory suffix=".php">../application/</directory>
        <exclude>
            <directory suffix=".phtml">../application/</directory>
            <file>../application/Bootstrap.php</file>
            <file>../application/controllers/ErrorController.php</file>
        </exclude>
    </whitelist>
</filter>

<logging>
    <log type="coverage-html" target="./log/reprot" charset="UTP-8"
    yui="true" highlight = "true" lowUpoerBound="50" highLowerBound="80"/>
    <log type="textdox" target="./log/testdox.html" />
</logging>

我有<条码>boot锁.php,载于/测试/应用文件夹如下:

    <?php
error_reporting(E_ALL | E_STRICT);

// Define path to application directory
defined( APPLICATION_PATH )
    || define( APPLICATION_PATH , realpath(dirname(__FILE__) .  /../../application ));

// Define application environment
defined( APPLICATION_ENV )
    || define( APPLICATION_ENV , (getenv( APPLICATION_ENV ) ? getenv( APPLICATION_ENV ) :  testing ));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH .  /../library ),
    get_include_path(),
)));

require_once  Zend/Loader/Autoloader.php ;

require_once  controllers/ControllerTestCase.php ;
Zend_Loader_Autoloader::getInstance();

当我去指挥线时,指挥线如下:

phpunit --configuration phpunit.xml

it throws the exception:

PHP Fatal error:  Uncaught exception  PHPUnit_Framework_Exception  with message
 Neither "Application Test Suite.php" nor "Application Test Suite.php" could be
opened.  in D:PHPphp5PEARPHPUnitUtilSkeletonTest.php:102
Stack trace:
#0 D:PHPphp5PEARPHPUnitTextUICommand.php(157): PHPUnit_Util_Skeleton_Test-
>__construct( Application Tes... ,   )
#1 D:PHPphp5PEARPHPUnitTextUICommand.php(129): PHPUnit_TextUI_Command->run
(Array, true)
#2 D:PHPphp5phpunit(53): PHPUnit_TextUI_Command::main()
#3 {main}
  thrown in D:PHPphp5PEARPHPUnitUtilSkeletonTest.php on line 102

我怎么能够确定这一点?

最佳回答

您注意到它放弃了这一例外情况,因为你在寻找与<代码><> 姓名/代码”相同的档案时,规定了你的测试程序。 您实际上需要写一个测试套,然后向您的召集人提供这一试验套的名称:

问题回答

我的同一结构也存在同样的问题。 根据我的理解,最近几版PHPUnit需要至少一次实际测试才能适当进行。 在进行简单测试之后,它发挥了作用。

my Project/tests/application/Demo Test.php

<?php
class DemoTest extends ControllerTestCase
{
    public function setUp() {
        parent::setUp();
    }

    public function testCanDoUnitTest() {
        $this->assertTrue(true);
    }
}

我注意到,你没有使用<代码><test ad>,其中载有<的多种发生地;test ad>

这里是我的Candunit.xml,为Zend Framework项目进行罚款:

<testsuites>
  <testsuite name="UnitTests">
    <directory>./library</directory>
  </testsuite>
  <testsuite name="ApplicationTests">
    <directory>./application</directory>
  </testsuite>
</testsuites>




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签