开发者

Handle deny all in testing web interface through Yii

开发者 https://www.devze.com 2023-01-14 07:13 出处:网络
I have a controller with the following access rules: array(\'deny\',// deny all users \'users\'=>array(\'*\'),

I have a controller with the following access rules:

array('deny',  // deny all users
    'users'=>array('*'),
),

I want to test that code (every user authorized or not can't access to 开发者_JAVA百科this controller via the web) and have the following:

public function testShow()
{
  $this->open('?r=link');
}

But I get the following error in my console:

1) LinkTest::testShow

PHPUnit_Framework_Exception: Response from Selenium RC server for testComplete().

XHR ERROR: URL = http://127.0.0.1/url/index-test.php/?r=link Response_Code = 403 Error_Message = >

CHttpException.

I want to make a test where I can ensure that link controller not visible via web.


Well the 403 response is a permission denied error. So it seems as though it's working correctly. Perhaps you just need to configure Selenium. See this question for some help.

0

精彩评论

暂无评论...
验证码 换一张
取 消