Take the 2-minute tour ×

I am writing a component test in cakephp here is my code

  class PermissionTestCase extends CakeTestCase {
   var $fixtures = array('Org');  
   function testsetPermission() { 
      $this->PermissionComponentTest = new PermissionComponent(); <---- line 5

I get this error - Fatal error: Class 'PermissionComponent' not found in /Sites/php/cake/Demo_Code/perm/app/tests/cases/components/permission.test.php on line 5

Why is it looking for the component in tests/cases ? Also I tried moving the component into this directory and it didnt work.



share|improve this question

1 Answer 1

up vote 2 down vote accepted

You have to include the component manually with App::import():

App::import('Component', 'Permission');
share|improve this answer
Thanks, That worked! I tried, var $components = array('Permission'); –  Alex Oct 1 '10 at 9:34

Your Answer


