function CoderReviewUpgrade7xTest::testPermissions7x in Coder 7
Same name and namespace in other branches
- 7.2 coder_review/tests/coder_review_7x.test \CoderReviewUpgrade7xTest::testPermissions7x()
File
- coder_review/
tests/ coder_review_7x.test, line 160
Class
Code
function testPermissions7x() {
// N/A - in system http://drupal.org/node/224333#moved_statistics_settings
// N/A - http://drupal.org/node/224333#user-roles-api
// N/A - http://drupal.org/node/224333#permissions_restrict_access
// N/A - http://drupal.org/node/224333#node_access_alter_hooks
// Rolled back - http://drupal.org/node/224333#system_admin_menu_block_access
// UNCLEAR - http://drupal.org/node/224333#hook_node_access_records
// UNCLEAR - http://drupal.org/node/224333#bypass_node_access
// http://drupal.org/node/224333#descriptions_permissions
$this
->assertCoderReviewFail(" function mymodule_permission() {\n return array('administer mymodule');\n }");
$this
->assertCoderReviewFail(" function mymodule_permission() {\n return array('administer mymodule', 'access foo');\n }");
$this
->assertCoderReviewPass(" function mymodule_permission() {\n return array('administer mymodule' => array('title' => t('Administer mymodule'), 'description' => t('foo')));\n }");
// http://drupal.org/node/224333#sorting_permissions
// http://drupal.org/node/224333#permission_tables
$this
->assertCoderReviewPass(' db_query("SELECT * FROM {role_permission}");');
$this
->assertCoderReviewFail(' db_query("SELECT * FROM {permission}");');
$this
->assertCoderReviewFail(' db_query("DELETE FROM {permission}");');
// http://drupal.org/node/224333#hook_permission
$this
->assertCoderReviewFail(" function mymodule_perm() {\n}");
$this
->assertCoderReviewPass(" function mymodule_permission() {\n}");
// http://drupal.org/node/224333#php_permissions
$this
->assertCoderReviewFail(" \$permission = 'use PHP for block visibility';");
$this
->assertCoderReviewFail(' $permission = "use PHP for block visibility";');
$this
->assertCoderReviewFail(" return array('use PHP for block visibility');");
// http://drupal.org/node/224333#hook_node_access
$this
->assertCoderReviewFail(" function mymodule_access() {\n}");
$this
->assertCoderReviewPass(" function mymodule_node_access() {\n}");
}