Re: test case cannot find component class

2009-11-30 Thread Angie
OK, so I fixed the mod_rewrite problem, but I still cannot run my test
case. Does anyone have any ideas?

Thanks!

On Nov 30, 6:37 am, Angie angelina.tal...@linmark.com wrote:
 I am very new to CakePHP and am trying to write a component for an
 existing application. I have written a few lines of component code and
 wanted to test them to be sure my setup and general syntax/code is
 correct. But, my test case can't find my component class. I get the
 following error through the web page:

 Fatal error: Class 'FormActionComponent' not found in /var/www/cake/
 app/tests/cases/components/form_action.test.php on line 8

 The FormActionComponent class is defined in
 /var/www/cake/app/controllers/components
 /form_action.php and the source is below. Further, the test case is
 defined in /var/www/cake/app/tests/cases/components/
 form_action.test.php and is also below. Am I missing something?

 Also, as a side note, I can only seem to run test.php from a URL 
 likehttp://myIpAddress/cake/app/webroot/test.phpand none of the images or
 stylesheets are working. Could that be related?

 Thanks!

 FormActionComponent class:

 ?php
 class FormActionComponent extends Object {
         var $name = 'FormAction';

         //called before Controller::beforeFilter()
         function initialize($controller, $settings = array()) {
                 // saving the controller reference for later use
                 $this-controller = $controller;
         }

         function approveForm($form_metadata_id) {
                 $chainInstance = ClassRegistry::init
 ('ApprovalChainInstance');
                 $chain = $chainInstance-findByFormMetadataId
 ($form_metadata_id);
                 $this-log('chain id '.$chain-id, LOG_DEBUG);
         }

 }

 ?

 FormActionTestCase class:
 ?php
 class FormActionTestCase extends CakeTestCase {
         var $fixtures = array
 ('form_metadata','approval_chain_instance','approval_chain_entry_instance')­;

         var $components = array('Session', 'FormAction');
         function testApproveForm() {
                 $this-FormActionComponentTest = new
 FormActionComponent();
                 $controller = new FakeFormController();
                 $controller-FormMetadata = new FormActionTest();
                 $this-FormAcdtionComponentTest-startup(
 $controller);

                 $result = $this-FormActionComponentTest-approveForm
 (1);
                 $this-assertEqual($result,true);
         }
  }
 ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


test case cannot find component class

2009-11-29 Thread Angie
I am very new to CakePHP and am trying to write a component for an
existing application. I have written a few lines of component code and
wanted to test them to be sure my setup and general syntax/code is
correct. But, my test case can't find my component class. I get the
following error through the web page:

Fatal error: Class 'FormActionComponent' not found in /var/www/cake/
app/tests/cases/components/form_action.test.php on line 8


The FormActionComponent class is defined in
/var/www/cake/app/controllers/components
/form_action.php and the source is below. Further, the test case is
defined in /var/www/cake/app/tests/cases/components/
form_action.test.php and is also below. Am I missing something?

Also, as a side note, I can only seem to run test.php from a URL like
http://myIpAddress/cake/app/webroot/test.php and none of the images or
stylesheets are working. Could that be related?

Thanks!

FormActionComponent class:

?php
class FormActionComponent extends Object {
var $name = 'FormAction';

//called before Controller::beforeFilter()
function initialize($controller, $settings = array()) {
// saving the controller reference for later use
$this-controller = $controller;
}

function approveForm($form_metadata_id) {
$chainInstance = ClassRegistry::init
('ApprovalChainInstance');
$chain = $chainInstance-findByFormMetadataId
($form_metadata_id);
$this-log('chain id '.$chain-id, LOG_DEBUG);
}

}
?

FormActionTestCase class:
?php
class FormActionTestCase extends CakeTestCase {
var $fixtures = array
('form_metadata','approval_chain_instance','approval_chain_entry_instance');

var $components = array('Session', 'FormAction');
function testApproveForm() {
$this-FormActionComponentTest = new
FormActionComponent();
$controller = new FakeFormController();
$controller-FormMetadata = new FormActionTest();
$this-FormAcdtionComponentTest-startup(
$controller);

$result = $this-FormActionComponentTest-approveForm
(1);
$this-assertEqual($result,true);
}
 }
?


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en