在CakePHP 2中创建phpunit.xml

时间:2014-05-06 07:32:01

标签: cakephp phpunit

如何在CakePHP2.4中制作phpunit.xml?


我做了:

<phpunit backupGlobals="true"
     backupStaticAttributes="false"
     colors="true"
     convertErrorsToExceptions="true"
     convertNoticesToExceptions="true"
     convertWarningsToExceptions="true"
     processIsolation="false"
     stopOnFailure="false"
     syntaxCheck="false"
     testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
<testsuites>
    <testsuite name="Application Test Suite">
        <directory>./app/Test/Case</directory>
    </testsuite>
</testsuites>
</phpunit>

并且

  

cd / Project / phpunit

并收到错误

  

致命错误:找不到类'CakeTestSuite'   第36行的PROJECT_NAME \ app \ Test \ Case \ AllTestsTest.php

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

这不是使用Cake 2.x进行测试的方式,请参阅Cookbook

http://book.cakephp.org/2.0/en/development/testing.html

Cake 2.x附带图形测试运行器和测试shell。两者都包含PHPUnit的使用,以便自动加载和其他CakePHP特定的东西在测试环境中正常工作。

说到自动加载,这就是你收到错误的原因,Cake自动加载器不可用,并且包含缺少的测试套件类的类也不是。

长话短说,使用shell,一切都应该没问题:Console/cake test app AllTests