Interesting find tonight while playing with the test suite. If you use
testAction() and have the Auth component loading (in the controller or
in your App Controller), and don't explicitly Auth->allow() the action
set in testAction(), then testAction() will fail silenty as it
redirects to the Auth->loginAction. (I had a similar issue with
requireSecure() and testing through a non-SSL URL.)

For now (so I can play with the testAction() function), I put this in
the top of my App Controller's beforeFilter():

function beforeFilter () {

        // Let tests skip Auth and requireSecure
        if ( basename(env('SCRIPT_NAME')) == 'test.php' ) {
                $this->Auth->allow();
                return true;
        }

}


I'm sure there is a better way to determine if we're running a test or
not, and I figure there has to be a better way to let testing through.
Is there a way to tell testAction() to simulate a user login? Is the
best way to override the CakeTestCase::startController method and
login a fixtured user?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to