summaryrefslogtreecommitdiff
path: root/modules/gallery/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r--modules/gallery/tests/Access_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Albums_Controller_Test.php2
-rw-r--r--modules/gallery/tests/Breadcrumb_Test.php2
-rw-r--r--modules/gallery/tests/Cache_Test.php2
-rw-r--r--modules/gallery/tests/Controller_Auth_Test.php2
-rw-r--r--modules/gallery/tests/Data_Rest_Helper_Test.php102
-rw-r--r--modules/gallery/tests/Database_Test.php2
-rw-r--r--modules/gallery/tests/Dir_Helper_Test.php2
-rw-r--r--modules/gallery/tests/DrawForm_Test.php2
-rw-r--r--modules/gallery/tests/File_Proxy_Controller_Test.php130
-rw-r--r--modules/gallery/tests/File_Structure_Test.php4
-rw-r--r--modules/gallery/tests/Gallery_Filters.php2
-rw-r--r--modules/gallery/tests/Gallery_I18n_Test.php2
-rw-r--r--modules/gallery/tests/Gallery_Installer_Test.php2
-rw-r--r--modules/gallery/tests/Html_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Input_Library_Test.php2
-rw-r--r--modules/gallery/tests/Item_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Item_Model_Test.php50
-rw-r--r--modules/gallery/tests/Item_Rest_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Items_Rest_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Kohana_Exception_Test.php2
-rw-r--r--modules/gallery/tests/Legal_File_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Locales_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Menu_Test.php2
-rw-r--r--modules/gallery/tests/Movie_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Num_Helper_Test.php2
-rw-r--r--modules/gallery/tests/ORM_MPTT_Test.php2
-rw-r--r--modules/gallery/tests/Photos_Controller_Test.php2
-rw-r--r--modules/gallery/tests/SafeString_Test.php2
-rw-r--r--modules/gallery/tests/Sendmail_Test.php2
-rw-r--r--modules/gallery/tests/System_Helper_Test.php2
-rw-r--r--modules/gallery/tests/Url_Security_Test.php2
-rw-r--r--modules/gallery/tests/Valid_Test.php2
-rw-r--r--modules/gallery/tests/Var_Test.php2
-rw-r--r--modules/gallery/tests/Xss_Security_Test.php2
35 files changed, 290 insertions, 58 deletions
diff --git a/modules/gallery/tests/Access_Helper_Test.php b/modules/gallery/tests/Access_Helper_Test.php
index df7de595..ffb62d98 100644
--- a/modules/gallery/tests/Access_Helper_Test.php
+++ b/modules/gallery/tests/Access_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Albums_Controller_Test.php b/modules/gallery/tests/Albums_Controller_Test.php
index 625d9525..6fdc9df3 100644
--- a/modules/gallery/tests/Albums_Controller_Test.php
+++ b/modules/gallery/tests/Albums_Controller_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Breadcrumb_Test.php b/modules/gallery/tests/Breadcrumb_Test.php
index 65a853a8..b7667594 100644
--- a/modules/gallery/tests/Breadcrumb_Test.php
+++ b/modules/gallery/tests/Breadcrumb_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Cache_Test.php b/modules/gallery/tests/Cache_Test.php
index ce91ebae..b1f56d7f 100644
--- a/modules/gallery/tests/Cache_Test.php
+++ b/modules/gallery/tests/Cache_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php
index 76027cf6..e1ca0a7b 100644
--- a/modules/gallery/tests/Controller_Auth_Test.php
+++ b/modules/gallery/tests/Controller_Auth_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Data_Rest_Helper_Test.php b/modules/gallery/tests/Data_Rest_Helper_Test.php
new file mode 100644
index 00000000..69d17997
--- /dev/null
+++ b/modules/gallery/tests/Data_Rest_Helper_Test.php
@@ -0,0 +1,102 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Data_Rest_Helper_Test extends Gallery_Unit_Test_Case {
+ public function teardown() {
+ identity::set_active_user(identity::admin_user());
+ }
+
+ public function resolve_test() {
+ $photo = test::random_photo();
+ $resolved = rest::resolve(rest::url("data", $photo, 640));
+ $this->assert_equal($photo->id, $resolved->id);
+ }
+
+ public function resolve_needs_permission_test() {
+ $album = test::random_album();
+ $photo = test::random_photo($album);
+ $album->reload(); // new photo changed the album in the db
+
+ access::deny(identity::everybody(), "view", $album);
+ identity::set_active_user(identity::guest());
+
+ try {
+ data_rest::resolve($photo->id);
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ // pass
+ }
+ }
+
+ public function basic_get_test() {
+ $photo = test::random_photo();
+
+ $request = new stdClass();
+ $request->url = rest::url("data", $photo, "thumb");
+ $request->params = new stdClass();
+
+ $request->params->size = "thumb";
+ $this->assert_same($photo->thumb_path(), data_rest::get($request));
+
+ $request->params->size = "resize";
+ $this->assert_same($photo->resize_path(), data_rest::get($request));
+
+ $request->params->size = "full";
+ $this->assert_same($photo->file_path(), data_rest::get($request));
+ }
+
+ public function illegal_access_test() {
+ $album = test::random_album();
+ $photo = test::random_photo($album);
+ $album->reload();
+
+ access::deny(identity::everybody(), "view", $album);
+ identity::set_active_user(identity::guest());
+
+ $request = new stdClass();
+ $request->url = rest::url("data", $photo, "thumb");
+ $request->params = new stdClass();
+ $request->params->size = "thumb";
+
+ try {
+ data_rest::get($request);
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ // pass
+ }
+ }
+
+ public function missing_file_test() {
+ $photo = test::random_photo();
+
+ $request = new stdClass();
+ $request->url = rest::url("data", $photo, "thumb");
+ $request->params = new stdClass();
+ $request->params->size = "thumb";
+
+ unlink($photo->thumb_path()); // oops!
+
+ try {
+ data_rest::get($request);
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ // pass
+ }
+ }
+}
diff --git a/modules/gallery/tests/Database_Test.php b/modules/gallery/tests/Database_Test.php
index fa9e5370..ab3290a9 100644
--- a/modules/gallery/tests/Database_Test.php
+++ b/modules/gallery/tests/Database_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Dir_Helper_Test.php b/modules/gallery/tests/Dir_Helper_Test.php
index a9decb88..228b5c21 100644
--- a/modules/gallery/tests/Dir_Helper_Test.php
+++ b/modules/gallery/tests/Dir_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/DrawForm_Test.php b/modules/gallery/tests/DrawForm_Test.php
index 04163525..19177a3a 100644
--- a/modules/gallery/tests/DrawForm_Test.php
+++ b/modules/gallery/tests/DrawForm_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/File_Proxy_Controller_Test.php b/modules/gallery/tests/File_Proxy_Controller_Test.php
new file mode 100644
index 00000000..562100e4
--- /dev/null
+++ b/modules/gallery/tests/File_Proxy_Controller_Test.php
@@ -0,0 +1,130 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2013 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class File_Proxy_Controller_Test extends Gallery_Unit_Test_Case {
+ public function setup() {
+ $this->_save = array($_SERVER);
+ }
+
+ public function teardown() {
+ list($_SERVER) = $this->_save;
+ identity::set_active_user(identity::admin_user());
+ }
+
+ public function basic_test() {
+ $photo = test::random_photo();
+ $_SERVER["REQUEST_URI"] = url::file("var/albums/{$photo->name}");
+ $controller = new File_Proxy_Controller();
+ $this->assert_same($photo->file_path(), $controller->__call("", array()));
+ }
+
+ public function query_params_are_ignored_test() {
+ $photo = test::random_photo();
+ $_SERVER["REQUEST_URI"] = url::file("var/albums/{$photo->name}?a=1&b=2");
+ $controller = new File_Proxy_Controller();
+ $this->assert_same($photo->file_path(), $controller->__call("", array()));
+ }
+
+ public function file_must_be_in_var_test() {
+ $_SERVER["REQUEST_URI"] = url::file("index.php");
+ $controller = new File_Proxy_Controller();
+ try {
+ $controller->__call("", array());
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ $this->assert_same(1, $e->test_fail_code);
+ }
+ }
+
+ public function file_must_be_in_albums_thumbs_or_resizes_test() {
+ $_SERVER["REQUEST_URI"] = url::file("var/test/var/uploads/.htaccess");
+ $controller = new File_Proxy_Controller();
+ try {
+ $controller->__call("", array());
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ $this->assert_same(2, $e->test_fail_code);
+ }
+ }
+
+ public function movie_thumbnails_are_jpgs_test() {
+ $movie = test::random_movie();
+ $name = legal_file::change_extension($movie->name, "jpg");
+ $_SERVER["REQUEST_URI"] = url::file("var/thumbs/{$movie->name}");
+ $controller = new File_Proxy_Controller();
+ $this->assert_same($movie->thumb_path(), $controller->__call("", array()));
+ }
+
+ public function invalid_item_test() {
+ $photo = test::random_photo();
+ $_SERVER["REQUEST_URI"] = url::file("var/albums/x_{$photo->name}");
+ $controller = new File_Proxy_Controller();
+ try {
+ $controller->__call("", array());
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ $this->assert_same(3, $e->test_fail_code);
+ }
+ }
+
+ public function need_view_full_permission_to_view_original_test() {
+ $album = test::random_album();
+ $photo = test::random_photo($album);
+ $album = $album->reload(); // adding the photo changed the album in the db
+ $_SERVER["REQUEST_URI"] = url::file("var/albums/{$album->name}/{$photo->name}");
+ $controller = new File_Proxy_Controller();
+
+ access::deny(identity::everybody(), "view_full", $album);
+ identity::set_active_user(identity::guest());
+
+ try {
+ $controller->__call("", array());
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ $this->assert_same(5, $e->test_fail_code);
+ }
+ }
+
+ public function cant_proxy_an_album_test() {
+ $album = test::random_album();
+ $_SERVER["REQUEST_URI"] = url::file("var/albums/{$album->name}");
+ $controller = new File_Proxy_Controller();
+
+ try {
+ $controller->__call("", array());
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ $this->assert_same(6, $e->test_fail_code);
+ }
+ }
+
+ public function missing_file_test() {
+ $photo = test::random_photo();
+ $_SERVER["REQUEST_URI"] = url::file("var/albums/{$photo->name}");
+ unlink($photo->file_path());
+ $controller = new File_Proxy_Controller();
+
+ try {
+ $controller->__call("", array());
+ $this->assert_true(false);
+ } catch (Kohana_404_Exception $e) {
+ $this->assert_same(7, $e->test_fail_code);
+ }
+ }
+} \ No newline at end of file
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 3d2079e5..8f6e480c 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -132,7 +132,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
"<?php defined(\"SYSPATH\") or die(\"No direct script access.\");",
"/**",
" * Gallery - a web based photo album viewer and editor",
- " * Copyright (C) 2000-2012 Bharat Mediratta",
+ " * Copyright (C) 2000-2013 Bharat Mediratta",
" *",
" * This program is free software; you can redistribute it and/or modify",
" * it under the terms of the GNU General Public License as published by",
diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php
index 73bc6284..7209bc93 100644
--- a/modules/gallery/tests/Gallery_Filters.php
+++ b/modules/gallery/tests/Gallery_Filters.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Gallery_I18n_Test.php b/modules/gallery/tests/Gallery_I18n_Test.php
index c54f324f..e255c4b9 100644
--- a/modules/gallery/tests/Gallery_I18n_Test.php
+++ b/modules/gallery/tests/Gallery_I18n_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Gallery_Installer_Test.php b/modules/gallery/tests/Gallery_Installer_Test.php
index f5043fb0..0764a4fa 100644
--- a/modules/gallery/tests/Gallery_Installer_Test.php
+++ b/modules/gallery/tests/Gallery_Installer_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Html_Helper_Test.php b/modules/gallery/tests/Html_Helper_Test.php
index 09168e41..476faa5a 100644
--- a/modules/gallery/tests/Html_Helper_Test.php
+++ b/modules/gallery/tests/Html_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Input_Library_Test.php b/modules/gallery/tests/Input_Library_Test.php
index 135c6647..039644ad 100644
--- a/modules/gallery/tests/Input_Library_Test.php
+++ b/modules/gallery/tests/Input_Library_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Item_Helper_Test.php b/modules/gallery/tests/Item_Helper_Test.php
index 818c9a73..0c08d1af 100644
--- a/modules/gallery/tests/Item_Helper_Test.php
+++ b/modules/gallery/tests/Item_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index a3929e62..dc4432a6 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,9 +69,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$item = test::random_photo();
$original_name = $item->name;
- file_put_contents($item->thumb_path(), "thumb");
- file_put_contents($item->resize_path(), "resize");
- file_put_contents($item->file_path(), "file");
+ $thumb_file = file_get_contents($item->thumb_path());
+ $resize_file = file_get_contents($item->resize_path());
+ $fullsize_file = file_get_contents($item->file_path());
// Now rename it
$item->name = ($new_name = test::random_name($item));
@@ -82,9 +82,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$this->assert_equal($new_name, basename($item->file_path()));
$this->assert_equal($new_name, basename($item->thumb_path()));
$this->assert_equal($new_name, basename($item->resize_path()));
- $this->assert_equal("thumb", file_get_contents($item->thumb_path()));
- $this->assert_equal("resize", file_get_contents($item->resize_path()));
- $this->assert_equal("file", file_get_contents($item->file_path()));
+ $this->assert_equal($thumb_file, file_get_contents($item->thumb_path()));
+ $this->assert_equal($resize_file, file_get_contents($item->resize_path()));
+ $this->assert_equal($fullsize_file, file_get_contents($item->file_path()));
}
public function rename_album_test() {
@@ -92,9 +92,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$photo = test::random_photo($album);
$album->reload();
- file_put_contents($photo->thumb_path(), "thumb");
- file_put_contents($photo->resize_path(), "resize");
- file_put_contents($photo->file_path(), "file");
+ $thumb_file = file_get_contents($photo->thumb_path());
+ $resize_file = file_get_contents($photo->resize_path());
+ $fullsize_file = file_get_contents($photo->file_path());
$original_album_name = $album->name;
$original_photo_name = $photo->name;
@@ -119,9 +119,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$this->assert_true(test::starts_with($photo->thumb_path(), dirname($album->thumb_path())));
$this->assert_true(test::starts_with($photo->resize_path(), dirname($album->resize_path())));
- $this->assert_equal("thumb", file_get_contents($photo->thumb_path()));
- $this->assert_equal("resize", file_get_contents($photo->resize_path()));
- $this->assert_equal("file", file_get_contents($photo->file_path()));
+ $this->assert_equal($thumb_file, file_get_contents($photo->thumb_path()));
+ $this->assert_equal($resize_file, file_get_contents($photo->resize_path()));
+ $this->assert_equal($fullsize_file, file_get_contents($photo->file_path()));
}
public function item_rename_wont_accept_slash_test() {
@@ -154,9 +154,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album($album2);
$photo = test::random_photo($album1);
- file_put_contents($photo->thumb_path(), "thumb");
- file_put_contents($photo->resize_path(), "resize");
- file_put_contents($photo->file_path(), "file");
+ $thumb_file = file_get_contents($photo->thumb_path());
+ $resize_file = file_get_contents($photo->resize_path());
+ $fullsize_file = file_get_contents($photo->file_path());
// Now move the album
$album1->parent_id = item::root()->id;
@@ -173,9 +173,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$this->assert_true(test::starts_with($photo->thumb_path(), dirname($album1->thumb_path())));
$this->assert_true(test::starts_with($photo->resize_path(), dirname($album1->resize_path())));
- $this->assert_equal("thumb", file_get_contents($photo->thumb_path()));
- $this->assert_equal("resize", file_get_contents($photo->resize_path()));
- $this->assert_equal("file", file_get_contents($photo->file_path()));
+ $this->assert_equal($thumb_file, file_get_contents($photo->thumb_path()));
+ $this->assert_equal($resize_file, file_get_contents($photo->resize_path()));
+ $this->assert_equal($fullsize_file, file_get_contents($photo->file_path()));
}
public function move_photo_test() {
@@ -184,9 +184,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$album2 = test::random_album();
- file_put_contents($photo->thumb_path(), "thumb");
- file_put_contents($photo->resize_path(), "resize");
- file_put_contents($photo->file_path(), "file");
+ $thumb_file = file_get_contents($photo->thumb_path());
+ $resize_file = file_get_contents($photo->resize_path());
+ $fullsize_file = file_get_contents($photo->file_path());
// Now move the photo
$photo->parent_id = $album2->id;
@@ -200,9 +200,9 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$this->assert_true(test::starts_with($photo->thumb_path(), dirname($album2->thumb_path())));
$this->assert_true(test::starts_with($photo->resize_path(), dirname($album2->resize_path())));
- $this->assert_equal("thumb", file_get_contents($photo->thumb_path()));
- $this->assert_equal("resize", file_get_contents($photo->resize_path()));
- $this->assert_equal("file", file_get_contents($photo->file_path()));
+ $this->assert_equal($thumb_file, file_get_contents($photo->thumb_path()));
+ $this->assert_equal($resize_file, file_get_contents($photo->resize_path()));
+ $this->assert_equal($fullsize_file, file_get_contents($photo->file_path()));
}
public function move_album_with_conflicting_target_gets_uniqified_test() {
diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php
index 376f5c81..1823420b 100644
--- a/modules/gallery/tests/Item_Rest_Helper_Test.php
+++ b/modules/gallery/tests/Item_Rest_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Items_Rest_Helper_Test.php b/modules/gallery/tests/Items_Rest_Helper_Test.php
index a719db70..9d8ee8a5 100644
--- a/modules/gallery/tests/Items_Rest_Helper_Test.php
+++ b/modules/gallery/tests/Items_Rest_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Kohana_Exception_Test.php b/modules/gallery/tests/Kohana_Exception_Test.php
index f8a89c0f..4836d0dd 100644
--- a/modules/gallery/tests/Kohana_Exception_Test.php
+++ b/modules/gallery/tests/Kohana_Exception_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Legal_File_Helper_Test.php b/modules/gallery/tests/Legal_File_Helper_Test.php
index 041c5d1f..5db99935 100644
--- a/modules/gallery/tests/Legal_File_Helper_Test.php
+++ b/modules/gallery/tests/Legal_File_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Locales_Helper_Test.php b/modules/gallery/tests/Locales_Helper_Test.php
index 1d27312e..ff5b05d4 100644
--- a/modules/gallery/tests/Locales_Helper_Test.php
+++ b/modules/gallery/tests/Locales_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Menu_Test.php b/modules/gallery/tests/Menu_Test.php
index 85ada63b..1e251c1f 100644
--- a/modules/gallery/tests/Menu_Test.php
+++ b/modules/gallery/tests/Menu_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Movie_Helper_Test.php b/modules/gallery/tests/Movie_Helper_Test.php
index 78ac21a1..ff7f798c 100644
--- a/modules/gallery/tests/Movie_Helper_Test.php
+++ b/modules/gallery/tests/Movie_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Num_Helper_Test.php b/modules/gallery/tests/Num_Helper_Test.php
index a12e3fa3..2158d231 100644
--- a/modules/gallery/tests/Num_Helper_Test.php
+++ b/modules/gallery/tests/Num_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/ORM_MPTT_Test.php b/modules/gallery/tests/ORM_MPTT_Test.php
index 8f4e9fb1..7547f2a7 100644
--- a/modules/gallery/tests/ORM_MPTT_Test.php
+++ b/modules/gallery/tests/ORM_MPTT_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Photos_Controller_Test.php b/modules/gallery/tests/Photos_Controller_Test.php
index 1587ebd7..a9c6a152 100644
--- a/modules/gallery/tests/Photos_Controller_Test.php
+++ b/modules/gallery/tests/Photos_Controller_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/SafeString_Test.php b/modules/gallery/tests/SafeString_Test.php
index fb4180e4..946410d4 100644
--- a/modules/gallery/tests/SafeString_Test.php
+++ b/modules/gallery/tests/SafeString_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Sendmail_Test.php b/modules/gallery/tests/Sendmail_Test.php
index 84d24083..9a687602 100644
--- a/modules/gallery/tests/Sendmail_Test.php
+++ b/modules/gallery/tests/Sendmail_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/System_Helper_Test.php b/modules/gallery/tests/System_Helper_Test.php
index d3295008..4ac12fde 100644
--- a/modules/gallery/tests/System_Helper_Test.php
+++ b/modules/gallery/tests/System_Helper_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Url_Security_Test.php b/modules/gallery/tests/Url_Security_Test.php
index ad07191b..3eb6276c 100644
--- a/modules/gallery/tests/Url_Security_Test.php
+++ b/modules/gallery/tests/Url_Security_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Valid_Test.php b/modules/gallery/tests/Valid_Test.php
index 82001b94..fc54547f 100644
--- a/modules/gallery/tests/Valid_Test.php
+++ b/modules/gallery/tests/Valid_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Var_Test.php b/modules/gallery/tests/Var_Test.php
index 6b050be6..97bccc35 100644
--- a/modules/gallery/tests/Var_Test.php
+++ b/modules/gallery/tests/Var_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php
index 4420b40c..6f78bb6f 100644
--- a/modules/gallery/tests/Xss_Security_Test.php
+++ b/modules/gallery/tests/Xss_Security_Test.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by