From c034303bb3d9bce20b4f395c4afe4c3933b929d2 Mon Sep 17 00:00:00 2001 From: catch Date: Tue, 29 May 2012 13:29:45 +0900 Subject: [PATCH] Issue #1593402 by Rob Loach, aspilicious: Convert php tests to PSR-0. --- .../lib/Drupal/php/Tests/PhpAccessTest.php | 39 ++++++ .../lib/Drupal/php/Tests/PhpFilterTest.php | 49 +++++++ .../php/lib/Drupal/php/Tests/PhpTestBase.php | 55 ++++++++ core/modules/php/php.info | 1 - core/modules/php/php.test | 125 ------------------ 5 files changed, 143 insertions(+), 126 deletions(-) create mode 100644 core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php create mode 100644 core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php create mode 100644 core/modules/php/lib/Drupal/php/Tests/PhpTestBase.php delete mode 100644 core/modules/php/php.test diff --git a/core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php b/core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php new file mode 100644 index 0000000000..ec7f740d39 --- /dev/null +++ b/core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php @@ -0,0 +1,39 @@ + 'PHP filter access check', + 'description' => 'Make sure that users who don\'t have access to the PHP filter can\'t see it.', + 'group' => 'PHP', + ); + } + + /** + * Makes sure that the user can't use the PHP filter when not given access. + */ + function testNoPrivileges() { + // Create node with PHP filter enabled. + $web_user = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content')); + $this->drupalLogin($web_user); + $node = $this->createNodeWithCode(); + + // Make sure that the PHP code shows up as text. + $this->drupalGet('node/' . $node->nid); + $this->assertText('print', t('PHP code was not evaluated.')); + + // Make sure that user doesn't have access to filter. + $this->drupalGet('node/' . $node->nid . '/edit'); + $this->assertNoRaw('