From 36adc11f058404c78bf0d804d8fe5be6cfa6f515 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 22 Oct 2009 13:30:32 -0700 Subject: move the direct orm test to the users module. --- .../gallery/tests/No_Direct_ORM_Access_Test.php | 77 ---------------------- 1 file changed, 77 deletions(-) delete mode 100644 modules/gallery/tests/No_Direct_ORM_Access_Test.php (limited to 'modules/gallery/tests') diff --git a/modules/gallery/tests/No_Direct_ORM_Access_Test.php b/modules/gallery/tests/No_Direct_ORM_Access_Test.php deleted file mode 100644 index 440321fa..00000000 --- a/modules/gallery/tests/No_Direct_ORM_Access_Test.php +++ /dev/null @@ -1,77 +0,0 @@ - $line) { - if (preg_match('/ORM::factory\\(\"user\"/', $line)) { - $errors[] = "$file($l) => $line"; - } - } - } - $file_as_string = null; - } - if ($errors) { - $this->assert_false(true, "Direct access to the users table found:\n" . join("\n", $errors)); - } - } - - public function no_access_to_groups_table_test() { - $dir = new UserModuleFilterIterator( - new PhpCodeFilterIterator( - new GalleryCodeFilterIterator( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator(DOCROOT))))); - $errors = array(); - foreach ($dir as $file) { - $file_as_string = file_get_contents($file); - if (preg_match("/ORM::factory\\(\"group\"/", $file_as_string)) { - foreach (split("\n", $file_as_string) as $l => $line) { - if (preg_match('/ORM::factory\\(\"group\"/', $line)) { - $errors[] = "$file($l) => $line"; - } - } - } - $file_as_string = null; - } - if ($errors) { - $this->assert_false(true, "Direct access to the groups table found:\n" . join("\n", $errors)); - } - } - -} - -class UserModuleFilterIterator extends FilterIterator { - public function accept() { - $path_name = $this->getInnerIterator()->getPathName(); - return strpos($path_name, "/modules/user") === false; - } -} -- cgit v1.2.3