Skip to content
Permalink
Browse files

Log errors instead of calling trigger_error()

  • Loading branch information...
rchavik committed Jan 29, 2014
1 parent d8134bd commit b83b59a9d7d21c35a512182ab923a586c7c6bb6b
Showing with 8 additions and 16 deletions.
  1. +4 −4 lib/Cake/Model/Permission.php
  2. +4 −12 lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
@@ -83,7 +83,7 @@ public function check($aro, $aco, $action = '*') {
$acoPath = $this->Aco->node($aco);
if (!$aroPath || !$acoPath) {
trigger_error(__d('cake_dev',
$this->log(__d('cake_dev',
"%s - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s",
'DbAcl::check()',
print_r($aro, true),
@@ -94,7 +94,7 @@ public function check($aro, $aco, $action = '*') {
}
if (!$acoPath) {
trigger_error(__d('cake_dev',
$this->log(__d('cake_dev',
"%s - Failed ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s",
'DbAcl::check()',
print_r($aro, true),
@@ -105,7 +105,7 @@ public function check($aro, $aco, $action = '*') {
}
if ($action !== '*' && !in_array('_' . $action, $permKeys)) {
trigger_error(__d('cake_dev', "ACO permissions key %s does not exist in %s", $action, 'DbAcl::check()'), E_USER_NOTICE);
$this->log(__d('cake_dev', "ACO permissions key %s does not exist in %s", $action, 'DbAcl::check()'), E_USER_NOTICE);
return false;
}
@@ -176,7 +176,7 @@ public function allow($aro, $aco, $actions = '*', $value = 1) {
$save = array();
if (!$perms) {
trigger_error(__d('cake_dev', '%s - Invalid node', 'DbAcl::allow()'), E_USER_WARNING);
$this->log(__d('cake_dev', '%s - Invalid node', 'DbAcl::allow()'), E_USER_WARNING);
return false;
}
if (isset($perms[0])) {
@@ -256,7 +256,6 @@ public function testCreateWithParent() {
/**
* testDbAclAllow method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testAllow() {
@@ -297,17 +296,16 @@ public function testAllow() {
* @return void
*/
public function testAllowInvalidPermission() {
$this->Acl->allow('Micheal', 'tpsReports', 'derp');
$this->assertFalse($this->Acl->allow('Micheal', 'tpsReports', 'derp'));
}
/**
* testAllowInvalidNode method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testAllowInvalidNode() {
$this->Acl->allow('Homer', 'tpsReports', 'create');
$this->assertFalse($this->Acl->allow('Homer', 'tpsReports', 'create'));
}
/**
@@ -333,7 +331,6 @@ public function testCheck() {
/**
* testCheckInvalidNode method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testCheckInvalidNode() {
@@ -343,21 +340,19 @@ public function testCheckInvalidNode() {
/**
* testCheckInvalidPermission method
*
* @expectedException PHPUnit_Framework_Error_Notice
* @return void
*/
public function testCheckInvalidPermission() {
$this->Acl->check('Lumbergh', 'smash', 'foobar');
$this->assertFalse($this->Acl->check('Lumbergh', 'smash', 'foobar'));
}
/**
* testCheckMissingPermission method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testCheckMissingPermission() {
$this->Acl->check('users', 'NonExistent', 'read');
$this->assertFalse($this->Acl->check('users', 'NonExistent', 'read'));
}
/**
@@ -380,7 +375,6 @@ public function testAclCascadingDeny() {
/**
* testDbAclDeny method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testDeny() {
@@ -450,7 +444,6 @@ public function testInherit() {
/**
* testDbGrant method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testGrant() {
@@ -471,7 +464,6 @@ public function testGrant() {
/**
* testDbRevoke method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testRevoke() {

0 comments on commit b83b59a

Please sign in to comment.
You can’t perform that action at this time.