diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php b/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php index 5e59690..6a6a9a5 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Access/CategoriesAccessCheck.php @@ -46,8 +46,6 @@ public function appliesTo() { * {@inheritdoc} */ public function access(Route $route, Request $request, AccountInterface $account) { - // @todo Replace user_access() with a correctly injected and session-using - // alternative. return $account->hasPermission('access news feeds') && (bool) $this->database->queryRange('SELECT 1 FROM {aggregator_category}', 0, 1)->fetchField() ? static::ALLOW : static::DENY; } diff --git a/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityAccessCheckTest.php b/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityAccessCheckTest.php index db39512..284f400 100644 --- a/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityAccessCheckTest.php +++ b/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityAccessCheckTest.php @@ -119,7 +119,7 @@ public function testAccess(EntityInterface $entity, $expected_result) { $request->attributes->set('entity', $entity); $request->attributes->set('entity_type', 'test_entity'); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $access = $this->editAccessCheck->access($route, $request, $account); $this->assertSame($expected_result, $access); } @@ -139,7 +139,7 @@ public function testAccessWithUndefinedEntityType() { ->with('non_valid') ->will($this->returnValue(NULL)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } @@ -164,7 +164,7 @@ public function testAccessWithNotExistingEntity() { ->with(1) ->will($this->returnValue(NULL)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } diff --git a/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityFieldAccessCheckTest.php b/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityFieldAccessCheckTest.php index 50912a6..148e4bf 100644 --- a/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityFieldAccessCheckTest.php +++ b/core/modules/edit/tests/Drupal/edit/Tests/Access/EditEntityFieldAccessCheckTest.php @@ -164,7 +164,7 @@ public function testAccess(EntityInterface $entity, FieldInterface $field = NULL ) ))); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $access = $this->editAccessCheck->access($route, $request, $account); $this->assertSame($expected_result, $access); } @@ -184,7 +184,7 @@ public function testAccessWithUndefinedEntityType() { ->with('non_valid') ->will($this->returnValue(NULL)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } @@ -209,7 +209,7 @@ public function testAccessWithNotExistingEntity() { ->with(1) ->will($this->returnValue(NULL)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } @@ -229,7 +229,7 @@ public function testAccessWithNotPassedFieldName() { $request->attributes->set('entity', $entity); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } @@ -261,7 +261,7 @@ public function testAccessWithNonExistingField() { ->with('entity_test', 'test_bundle', 'not_valid') ->will($this->returnValue(NULL)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } @@ -290,7 +290,7 @@ public function testAccessWithNotPassedLanguage() { ->method('getInstance') ->will($this->returnValue($field)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } @@ -320,7 +320,7 @@ public function testAccessWithInvalidLanguage() { ->method('getInstance') ->will($this->returnValue($field)); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->editAccessCheck->access($route, $request, $account); } diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php index cefcb19..1f44b70 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php @@ -94,7 +94,7 @@ public function testUserNameApi() { /** * Tests using the user interface. */ - public function ptestAdminUserInterface() { + public function testAdminUserInterface() { $admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration')); $this->drupalLogin($admin_user); @@ -137,7 +137,7 @@ public function ptestAdminUserInterface() { /** * Tests exposed filters. */ - public function ptestExposedFilter() { + public function testExposedFilter() { $path = 'test_user_name'; $options = array(); diff --git a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php index ac31d43..7a5676b 100644 --- a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php @@ -94,7 +94,7 @@ public function testAccess() { ->will($this->returnValue(array('parameter' => 'TRUE'))); $route = new Route('/test-route', array(), array('_custom_access' => '\Drupal\Tests\Core\Access\TestController::accessDeny')); - $account = $this->getAccountStub(); + $account = $this->getMock('Drupal\Core\Session\AccountInterface'); $this->assertNull($this->accessChecker->access($route, $request, $account)); $route = new Route('/test-route', array(), array('_custom_access' => '\Drupal\Tests\Core\Access\TestController::accessAllow')); diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php index 783aa00..2f91aaa 100644 --- a/core/tests/Drupal/Tests/UnitTestCase.php +++ b/core/tests/Drupal/Tests/UnitTestCase.php @@ -181,13 +181,4 @@ public function getStringTranslationStub() { return $translation; } - /** - * Mocks an account object. - * - * @return \Drupal\Core\Session\AccountInterface||PHPUnit_Framework_MockObject_MockObject - */ - public function getAccountStub() { - return $this->getMock('Drupal\Core\Session\AccountInterface'); - } - }