0
votes

I'm new to PHP and I got existing CakePHP project but I cannot start it from PHP Storm. Every time I want to run app it shows error:

PHP Fatal error: Uncaught Error: Class 'CakeTestSuite' not found in C:\xampp\htdocs\dummy\dummy_app\Plugin\AclExtras\Test\Case\AllTestsTest.php:16

AllTestsTest.php file:

require_once 'PHPUnit/Autoload.php';

class AllTestsTest extends PHPUnit_Framework_TestSuite {


    public static function suite() {
        $suite = new CakeTestSuite('All Tests');
        $suite->addTestDirectoryRecursive(App::pluginPath('AclExtras') . 'Test' . DS . 'Case' . DS);

        return $suite;
    }
}

Error is set to: $suite = new CakeTestSuite('All Tests');

Any ideas why or how to fix this?

1
The most common reason fr that error is that the class you try to instantiate hasn't been included. Try to include() or require() the file that contains the class if you haven't yet.ksjohn
Thank you @ksjohndamatano
or could include the namespace Path\File\CakeTestSuitejjoselon

1 Answers

0
votes

CakePHP 2.x testsuites cannot be run directly via PHPUnit, it requires CakePHPs custom autoloader and uses a custom test runner. You have to use the CakePHP test shell instead.

./Console/cake test AclExtras

See also