mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-04-29 17:49:15 -04:00
Extend Gallery_Unit_Test_Case instead of Unit_Test_Case.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Akismet_Helper_Test extends Unit_Test_Case {
|
||||
class Akismet_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
private $_comment;
|
||||
|
||||
public function setup() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Comment_Event_Test extends Unit_Test_Case {
|
||||
class Comment_Event_Test extends Gallery_Unit_Test_Case {
|
||||
public function deleting_an_item_deletes_its_comments_too_test() {
|
||||
$album = test::random_album();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Comment_Helper_Test extends Unit_Test_Case {
|
||||
class Comment_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
private $_ip_address;
|
||||
private $_user_agent;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Comment_Model_Test extends Unit_Test_Case {
|
||||
class Comment_Model_Test extends Gallery_Unit_Test_Case {
|
||||
|
||||
public function cant_view_comments_for_unviewable_items_test() {
|
||||
$album = test::random_album();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Digibug_Controller_Test extends Unit_Test_Case {
|
||||
class Digibug_Controller_Test extends Gallery_Unit_Test_Case {
|
||||
private $_server;
|
||||
|
||||
public function setup() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Exif_Test extends Unit_Test_Case {
|
||||
class Exif_Test extends Gallery_Unit_Test_Case {
|
||||
public function exif_extract_test() {
|
||||
$photo = test::random_photo_unsaved()
|
||||
->set_data_file(MODPATH . "exif/tests/data/image.jpg")
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Access_Helper_Test extends Unit_Test_Case {
|
||||
class Access_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
private $_group;
|
||||
|
||||
public function teardown() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Albums_Controller_Test extends Unit_Test_Case {
|
||||
class Albums_Controller_Test extends Gallery_Unit_Test_Case {
|
||||
public function setup() {
|
||||
$this->_save = array($_POST, $_SERVER);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Cache_Test extends Unit_Test_Case {
|
||||
class Cache_Test extends Gallery_Unit_Test_Case {
|
||||
private $_driver;
|
||||
public function setup() {
|
||||
db::build()->delete("caches")->execute();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Controller_Auth_Test extends Unit_Test_Case {
|
||||
class Controller_Auth_Test extends Gallery_Unit_Test_Case {
|
||||
public function find_missing_auth_test() {
|
||||
$found = array();
|
||||
$controllers = explode("\n", `git ls-files '*/*/controllers/*.php'`);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Database_Test extends Unit_Test_Case {
|
||||
class Database_Test extends Gallery_Unit_Test_Case {
|
||||
function setup() {
|
||||
$config = Kohana_Config::instance();
|
||||
$config->set("database.mock.connection.type", "mock");
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Dir_Helper_Test extends Unit_Test_Case {
|
||||
class Dir_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
public function remove_album_test() {
|
||||
$dirname = (VARPATH . "albums/testdir");
|
||||
mkdir($dirname, 0777, true);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class DrawForm_Test extends Unit_Test_Case {
|
||||
class DrawForm_Test extends Gallery_Unit_Test_Case {
|
||||
function no_group_test() {
|
||||
$form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form"));
|
||||
$form->input("title")->label(t("Title"));
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
require_once(MODPATH . "gallery/tests/Gallery_Filters.php");
|
||||
|
||||
class File_Structure_Test extends Unit_Test_Case {
|
||||
class File_Structure_Test extends Gallery_Unit_Test_Case {
|
||||
public function no_trailing_closing_php_tag_test() {
|
||||
$dir = new GalleryCodeFilterIterator(
|
||||
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class Gallery_I18n_Test extends Unit_Test_Case {
|
||||
class Gallery_I18n_Test extends Gallery_Unit_Test_Case {
|
||||
private $i18n;
|
||||
|
||||
public function setup() {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* This test case operates under the assumption that gallery_installer::install() is called by the
|
||||
* test controller before it starts.
|
||||
*/
|
||||
class Gallery_Installer_Test extends Unit_Test_Case {
|
||||
class Gallery_Installer_Test extends Gallery_Unit_Test_Case {
|
||||
public function install_creates_dirs_test() {
|
||||
$this->assert_true(file_exists(VARPATH . "albums"));
|
||||
$this->assert_true(file_exists(VARPATH . "resizes"));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Html_Helper_Test extends Unit_Test_Case {
|
||||
class Html_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
public function clean_test() {
|
||||
$safe_string = html::clean("hello <p >world</p>");
|
||||
$this->assert_equal("hello <p >world</p>",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Item_Helper_Test extends Unit_Test_Case {
|
||||
class Item_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
|
||||
public function viewable_test() {
|
||||
$album = test::random_album();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Item_Model_Test extends Unit_Test_Case {
|
||||
class Item_Model_Test extends Gallery_Unit_Test_Case {
|
||||
public function saving_sets_created_and_updated_dates_test() {
|
||||
$item = test::random_photo();
|
||||
$this->assert_true(!empty($item->created));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Locales_Helper_Test extends Unit_Test_Case {
|
||||
class Locales_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
static $installed_locales;
|
||||
static $default_locale;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Menu_Test extends Unit_Test_Case {
|
||||
class Menu_Test extends Gallery_Unit_Test_Case {
|
||||
public function find_menu_item_test() {
|
||||
$menu = new Menu(true);
|
||||
$menu
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class ORM_MPTT_Test extends Unit_Test_Case {
|
||||
class ORM_MPTT_Test extends Gallery_Unit_Test_Case {
|
||||
|
||||
public function add_to_parent_test() {
|
||||
$album = test::random_album();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Photos_Controller_Test extends Unit_Test_Case {
|
||||
class Photos_Controller_Test extends Gallery_Unit_Test_Case {
|
||||
public function setup() {
|
||||
$this->_save = array($_POST, $_SERVER);
|
||||
$_SERVER["HTTP_REFERER"] = "HTTP_REFERER";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class SafeString_Test extends Unit_Test_Case {
|
||||
class SafeString_Test extends Gallery_Unit_Test_Case {
|
||||
public function toString_escapes_for_html_test() {
|
||||
$safe_string = new SafeString("hello <p>world</p>");
|
||||
$this->assert_equal("hello <p>world</p>",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Sendmail_Test extends Unit_Test_Case {
|
||||
class Sendmail_Test extends Gallery_Unit_Test_Case {
|
||||
public function setup() {
|
||||
Kohana_Config::instance()->set("sendmail.from", "from@gallery3.com");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Url_Security_Test extends Unit_Test_Case {
|
||||
class Url_Security_Test extends Gallery_Unit_Test_Case {
|
||||
public function setup() {
|
||||
$this->save = array(Router::$current_uri, Router::$complete_uri, $_GET);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Var_Test extends Unit_Test_Case {
|
||||
class Var_Test extends Gallery_Unit_Test_Case {
|
||||
public function add_parameter_test() {
|
||||
module::set_var("gallery", "Parameter", "original value");
|
||||
$this->assert_equal("original value", module::get_var("gallery", "Parameter"));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Xss_Security_Test extends Unit_Test_Case {
|
||||
class Xss_Security_Test extends Gallery_Unit_Test_Case {
|
||||
public function find_unescaped_variables_in_views_test() {
|
||||
$found = array();
|
||||
foreach (glob("*/*/views/*.php") as $view) {
|
||||
|
||||
@@ -48,6 +48,11 @@ class test_Core {
|
||||
return test::random_photo_unsaved($parent)->save();
|
||||
}
|
||||
|
||||
static function random_user($password="password") {
|
||||
$rand = "name_" . rand();
|
||||
return identity::create_user($rand, $rand, $password, "$rand@rand.com");
|
||||
}
|
||||
|
||||
static function random_name($item=null) {
|
||||
$rand = "name_" . rand();
|
||||
if ($item && $item->is_photo()) {
|
||||
@@ -59,4 +64,10 @@ class test_Core {
|
||||
static function starts_with($outer, $inner) {
|
||||
return strpos($outer, $inner) === 0;
|
||||
}
|
||||
|
||||
static function call_and_capture($callback) {
|
||||
ob_start();
|
||||
call_user_func($callback);
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,108 +17,43 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Rest_Controller_Test extends Unit_Test_Case {
|
||||
class Rest_Controller_Test extends Gallery_Unit_Test_Case {
|
||||
public function setup() {
|
||||
$this->_save = array($_GET, $_POST, $_SERVER);
|
||||
}
|
||||
|
||||
private function _create_user() {
|
||||
if (empty($this->_user)) {
|
||||
$this->_user = identity::create_user("access_test" . rand(), "Access Test", "password");
|
||||
$this->_key = ORM::factory("user_access_token");
|
||||
$this->_key->access_key = md5($this->_user->name . rand());
|
||||
$this->_key->user_id = $this->_user->id;
|
||||
$this->_key->save();
|
||||
identity::set_active_user($this->_user);
|
||||
}
|
||||
return array($this->_key->access_key, $this->_user);
|
||||
}
|
||||
|
||||
public function teardown() {
|
||||
list($_GET, $_POST, $_SERVER) = $this->_save;
|
||||
if (!empty($this->_user)) {
|
||||
try {
|
||||
$this->_user->delete();
|
||||
} catch (Exception $e) { }
|
||||
}
|
||||
}
|
||||
|
||||
private function _create_image($parent=null) {
|
||||
$filename = MODPATH . "gallery/tests/test.jpg";
|
||||
$image_name = "image_" . rand();
|
||||
if (empty($parent)) {
|
||||
$parent = ORM::factory("item", 1);
|
||||
}
|
||||
return photo::create($parent, $filename, "$image_name.jpg", $image_name);
|
||||
public function login_test() {
|
||||
$user = test::random_user("password");
|
||||
|
||||
// There's no access key at first
|
||||
$this->assert_false(
|
||||
ORM::factory("user_access_token")->where("user_id", "=", $user->id)->find()->loaded());
|
||||
|
||||
$_POST["user"] = $user->name;
|
||||
$_POST["password"] = "password";
|
||||
|
||||
$response = test::call_and_capture(array(new Rest_Controller(), "index"));
|
||||
$expected =
|
||||
ORM::factory("user_access_token")->where("user_id", "=", $user->id)->find()->access_key;
|
||||
|
||||
// Now there is an access key, and it was returned
|
||||
$this->assert_equal(json_encode($expected), $response);
|
||||
}
|
||||
|
||||
public function rest_access_key_exists_test() {
|
||||
list ($access_key, $user) = $this->_create_user();
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
$_GET["user"] = $user->name;;
|
||||
$_GET["password"] = "password";
|
||||
public function login_failed_test() {
|
||||
$user = test::random_user("password");
|
||||
$_POST["user"] = $user->name;
|
||||
$_POST["password"] = "WRONG PASSWORD";
|
||||
|
||||
$this->assert_equal(
|
||||
json_encode(array("status" => "OK", "token" => $access_key)),
|
||||
$this->_call_controller());
|
||||
// @todo check the http response code
|
||||
$this->assert_equal(null, test::call_and_capture(array(new Rest_Controller(), "index")));
|
||||
}
|
||||
|
||||
public function rest_access_key_generated_test() {
|
||||
list ($access_key, $user) = $this->_create_user();
|
||||
ORM::factory("user_access_token")
|
||||
->where("access_key", $access_key)
|
||||
->delete();
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
$_GET["user"] = $user->name;
|
||||
$_GET["password"] = "password";
|
||||
|
||||
$results = json_decode($this->_call_controller());
|
||||
|
||||
$this->assert_equal("OK", $results->status);
|
||||
$this->assert_false(empty($results->token));
|
||||
}
|
||||
|
||||
public function rest_access_key_no_parameters_test() {
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
|
||||
try {
|
||||
$this->_call_controller();
|
||||
} catch (Rest_Exception $e) {
|
||||
$this->assert_equal(403, $e->getCode());
|
||||
$this->assert_equal("Forbidden", $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->assert_false(true, $e->__toString());
|
||||
}
|
||||
}
|
||||
|
||||
public function rest_access_key_user_not_found_test() {
|
||||
$_SERVER["REQUEST_METHOD"] = "POST";
|
||||
$_POST["request"] = json_encode(array("user" => "access_test2", "password" => "password"));
|
||||
|
||||
try {
|
||||
$this->_call_controller();
|
||||
} catch (Rest_Exception $e) {
|
||||
$this->assert_equal(403, $e->getCode());
|
||||
$this->assert_equal("Forbidden", $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->assert_false(true, $e->__toString());
|
||||
}
|
||||
}
|
||||
|
||||
public function rest_access_key_invalid_password_test() {
|
||||
$_SERVER["REQUEST_METHOD"] = "POST";
|
||||
|
||||
try {
|
||||
$this->_call_controller();
|
||||
} catch (Rest_Exception $e) {
|
||||
$this->assert_equal(403, $e->getCode());
|
||||
$this->assert_equal("Forbidden", $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->assert_false(true, $e->__toString());
|
||||
}
|
||||
}
|
||||
|
||||
public function rest_get_resource_no_request_key_test() {
|
||||
public function rest_get_resource_no_request_key_test_() {
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
$photo = $this->_create_image();
|
||||
|
||||
@@ -132,7 +67,7 @@ class Rest_Controller_Test extends Unit_Test_Case {
|
||||
$this->_call_controller("rest", explode("/", $photo->relative_url())));
|
||||
}
|
||||
|
||||
public function rest_get_resource_invalid_key_test() {
|
||||
public function rest_get_resource_invalid_key_test_() {
|
||||
list ($access_key, $user) = $this->_create_user();
|
||||
$_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = md5($access_key); // screw up the access key;
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
@@ -147,7 +82,7 @@ class Rest_Controller_Test extends Unit_Test_Case {
|
||||
}
|
||||
}
|
||||
|
||||
public function rest_get_resource_no_user_for_key_test() {
|
||||
public function rest_get_resource_no_user_for_key_test_() {
|
||||
list ($access_key, $user) = $this->_create_user();
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
$_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $access_key;
|
||||
@@ -166,7 +101,7 @@ class Rest_Controller_Test extends Unit_Test_Case {
|
||||
}
|
||||
}
|
||||
|
||||
public function rest_get_resource_no_handler_test() {
|
||||
public function rest_get_resource_no_handler_test_() {
|
||||
list ($access_key, $user) = $this->_create_user();
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
$_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $access_key;
|
||||
@@ -183,7 +118,7 @@ class Rest_Controller_Test extends Unit_Test_Case {
|
||||
}
|
||||
}
|
||||
|
||||
public function rest_get_resource_test() {
|
||||
public function rest_get_resource_test_() {
|
||||
list ($access_key, $user) = $this->_create_user();
|
||||
$_SERVER["REQUEST_METHOD"] = "GET";
|
||||
$_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $access_key;
|
||||
@@ -198,33 +133,4 @@ class Rest_Controller_Test extends Unit_Test_Case {
|
||||
"internet_address" => $photo->slug))),
|
||||
$this->_call_controller("rest", explode("/", $photo->relative_url())));
|
||||
}
|
||||
|
||||
private function _call_controller($method="access_key", $arg=null) {
|
||||
$controller = new Rest_Controller();
|
||||
|
||||
ob_start();
|
||||
call_user_func_array(array($controller, $method), $arg);
|
||||
$results = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
class rest_rest {
|
||||
static $request = null;
|
||||
|
||||
static function get($request) {
|
||||
self::$request = $request;
|
||||
$item = ORM::factory("item")
|
||||
->where("relative_url_cache", "=", implode("/", $request->arguments))
|
||||
->find();
|
||||
$response["path"] = $item->relative_url();
|
||||
$response["title"] = $item->title;
|
||||
$response["thumb_url"] = $item->thumb_url();
|
||||
$response["description"] = $item->description;
|
||||
$response["internet_address"] = $item->slug;
|
||||
return rest::reply(array($item->type => $response));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Tag_Rest_Helper_Test extends Unit_Test_Case {
|
||||
class Tag_Rest_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
public function setup() {
|
||||
try {
|
||||
Database::instance()->query("TRUNCATE {tags}");
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Tag_Test extends Unit_Test_Case {
|
||||
class Tag_Test extends Gallery_Unit_Test_Case {
|
||||
public function create_tag_test() {
|
||||
$rand = rand();
|
||||
$root = ORM::factory("item", 1);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
require_once(MODPATH . "gallery/tests/Gallery_Filters.php");
|
||||
|
||||
class No_Direct_ORM_Access_Test extends Unit_Test_Case {
|
||||
class No_Direct_ORM_Access_Test extends Gallery_Unit_Test_Case {
|
||||
public function no_access_to_users_table_test() {
|
||||
$dir = new UserModuleFilterIterator(
|
||||
new PhpCodeFilterIterator(
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class User_Groups_Test extends Unit_Test_Case {
|
||||
class User_Groups_Test extends Gallery_Unit_Test_Case {
|
||||
public function teardown() {
|
||||
try {
|
||||
$group = ORM::factory("group")->where("name", "=", "user_groups_test")->find();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* This test case operates under the assumption that user_installer::install() is called by the
|
||||
* test controller before it starts.
|
||||
*/
|
||||
class User_Installer_Test extends Unit_Test_Case {
|
||||
class User_Installer_Test extends Gallery_Unit_Test_Case {
|
||||
public function install_creates_admin_user_test() {
|
||||
$user = ORM::factory("user", 1);
|
||||
$this->assert_equal("guest", $user->name);
|
||||
|
||||
Reference in New Issue
Block a user