diff --git a/modules/authcache_field/authcache_field.test b/modules/authcache_field/authcache_field.test index c75d05e..91f9a0d 100644 --- a/modules/authcache_field/authcache_field.test +++ b/modules/authcache_field/authcache_field.test @@ -213,7 +213,7 @@ class AuthcacheFieldTest extends DrupalWebTestCase { $this->assertTrue($url); $result = $this->drupalGetAJAX($GLOBALS['base_root'] . $url['path'], $url['options'], array('X-Authcache: 1')); - $this->assertResponse(403); + $this->assertResponse(200); $this->assertFalse($result); } } diff --git a/modules/authcache_flag/authcache_flag.test b/modules/authcache_flag/authcache_flag.test index fd22ab3..f1a85e3 100644 --- a/modules/authcache_flag/authcache_flag.test +++ b/modules/authcache_flag/authcache_flag.test @@ -491,7 +491,7 @@ class AuthcacheFlagTest extends DrupalWebTestCase { $this->assertTrue($url); $result = $this->drupalGetAJAX($GLOBALS['base_root'] . $url['path'], $url['options'], array('X-Authcache: 1')); - $this->assertResponse(403); + $this->assertResponse(200); $this->assertFalse($result); } } diff --git a/modules/authcache_p13n/includes/AuthcacheP13nFragmentAssemblyBuilder.inc b/modules/authcache_p13n/includes/AuthcacheP13nFragmentAssemblyBuilder.inc index 243aff4..2285a98 100644 --- a/modules/authcache_p13n/includes/AuthcacheP13nFragmentAssemblyBuilder.inc +++ b/modules/authcache_p13n/includes/AuthcacheP13nFragmentAssemblyBuilder.inc @@ -65,15 +65,18 @@ class AuthcacheP13nFragmentAssemblyBuilder implements AuthcacheP13nContentBuilde // Run loader. if (!empty($partial['loader'])) { - $params = $partial['loader']->load($params, $context); + try { + $params = $partial['loader']->load($params, $context); + } + catch (AuthcacheP13nRequestNotFound $e) { + unset($e); + continue; + } } foreach ($params as $key => $subject) { // Run access check. - if (!empty($partial['access']) && !$partial['access']->check($user, $key, $subject, $context)) { - throw new AuthcacheP13nRequestAccessDenied(); - } - else { + if (empty($partial['access']) || $partial['access']->check($user, $key, $subject, $context)) { $result[$paramname][$key] = $partial['renderer']->render($key, $subject, $context); } } diff --git a/modules/authcache_p13n/tests/authcache_p13n.request-handler.test b/modules/authcache_p13n/tests/authcache_p13n.request-handler.test index 05e7831..ae3202a 100644 --- a/modules/authcache_p13n/tests/authcache_p13n.request-handler.test +++ b/modules/authcache_p13n/tests/authcache_p13n.request-handler.test @@ -607,27 +607,22 @@ class AuthcacheP13nTestFragmentAssemblyBuilder extends DrupalUnitTestCase { ); $builder = new AuthcacheP13nFragmentAssemblyBuilder($partials); + $expected = array( + 'param_1' => array( + 'account' => array('key' => 'account', 'subject' => $fake_user), + ), + ); + $user = $fake_user; $input = array('a' => array('param_1' => array('account' => $fake_user))); - try { - $builder->build($input, array()); - $this->pass('AuthcacheP13nFragmentAssemblyBuilder should not throw an AuthcacheP13nRequestAccessDenied when access check succeeds'); - } - catch (AuthcacheP13nRequestAccessDenied $e) { - unset($e); - $this->fail('AuthcacheP13nFragmentAssemblyBuilder should not throw an AuthcacheP13nRequestAccessDenied when access check succeeds'); - } + $result = $builder->build($input, array()); + $this->assertEqual($result, $expected); $user = $orig_user; $user = $fake_user; $input = array('a' => array('param_1' => array('account' => FALSE))); - try { - $builder->build($input, array()); - $this->fail('AuthcacheP13nFragmentAssemblyBuilder should throw an AuthcacheP13nRequestAccessDenied when access check fails'); - } - catch (AuthcacheP13nRequestAccessDenied $e) { - $this->pass('AuthcacheP13nFragmentAssemblyBuilder should throw an AuthcacheP13nRequestAccessDenied when access check fails'); - } + $result = $builder->build($input, array()); + $this->assertFalse($result); $user = $orig_user; } @@ -650,14 +645,8 @@ class AuthcacheP13nTestFragmentAssemblyBuilder extends DrupalUnitTestCase { $this->assertEqual($expect, $output); $input = array('a' => array('param_1' => array('load missing' => 'load missing'))); - try { - $builder->build($input, array()); - $this->fail('AuthcacheP13nFragmentAssemblyBuilder should throw an AuthcacheP13nRequestNotFound when loading fails'); - } - catch (AuthcacheP13nRequestNotFound $e) { - unset($e); - $this->pass('AuthcacheP13nFragmentAssemblyBuilder should throw an AuthcacheP13nRequestNotFound when loading fails'); - } + $result = $builder->build($input, array()); + $this->assertFalse($result); } }