2

How to make phpunit.xml in CakePHP2.4?


I made:

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

And

cd /Project/ phpunit

And got an error

Fatal error: Class 'CakeTestSuite' not found in PROJECT_NAME\app\Test\Case\AllTestsTest.php on line 36

Thanks for any help.

1 Answer 1

2

That's not how testing with Cake 2.x works, please refer to the Cookbook

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

Cake 2.x ships with a graphical test runner, as well as a test shell. Both wrap the usage of PHPUnit, so that autoloading and other CakePHP specific stuff works properly in the testing environment.

Speaking of autoloading, that's why you are receiving the error, the Cake autoloader isn't available, and the classes that would include the missing test suite class aren't either.

Long story short, use the shell and everything should be fine: Console/cake test app AllTests

Sign up to request clarification or add additional context in comments.

1 Comment

Or Console/cake test Path/to/File.php or Console/cake test Test/Case/Path/To/Test.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.