0
votes

How can I do CakePHP unit testing for views that is password protected?

I see an article about admin controller but not views http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way

So basically right now my assert is failing because of the password page.

$this->get($this->baseurl . '/admin/items');
$this->assertText('Title');

Thanks,
Tee

1
I had the same problem, check the answer here: [how can I test view where authentication is required, with cakePHP and SimpleTest][1] [1]: stackoverflow.com/questions/5337934/…kaklon

1 Answers

0
votes

You may have to mock or stub the authcomponent for your tests to always authenticate users. A bit of googling turns this up

Real-world testing of CakePHP controllers?