summaryrefslogtreecommitdiff
path: root/core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/Album_Test.php22
-rw-r--r--core/tests/Core_Installer_Test.php7
-rw-r--r--core/tests/Photo_Test.php20
3 files changed, 35 insertions, 14 deletions
diff --git a/core/tests/Album_Test.php b/core/tests/Album_Test.php
index 5a41a08a..a2ab1c48 100644
--- a/core/tests/Album_Test.php
+++ b/core/tests/Album_Test.php
@@ -22,12 +22,12 @@ class Album_Test extends Unit_Test_Case {
$rand = rand();
$album = album::create(1, $rand, $rand, $rand);
- $this->assert_equal(VARPATH . "albums/$rand", $album->path());
- $this->assert_equal(VARPATH . "thumbnails/$rand", $album->thumbnail_path());
- $this->assert_equal(VARPATH . "thumbnails/$rand", $album->resize_path());
+ $this->assert_equal(VARPATH . "albums/$rand", $album->file_path());
+ $this->assert_equal(VARPATH . "resizes/$rand/.thumb.jpg", $album->thumbnail_path());
+ $this->assert_true(is_dir(VARPATH . "resizes/$rand"), "missing thumbnail dir");
- $this->assert_true(is_dir($album->path()), "missing path: {$album->path()}");
- $this->assert_true(is_dir($album->resize_path()), "missing path: {$album->resize_path()}");
+ // It's unclear that a resize makes sense for an album. But we have one.
+ $this->assert_equal(VARPATH . "resizes/$rand/.resize.jpg", $album->resize_path());
$this->assert_equal(1, $album->parent_id); // MPTT tests will cover other hierarchy checks
$this->assert_equal($rand, $album->name);
@@ -41,4 +41,16 @@ class Album_Test extends Unit_Test_Case {
$album2 = album::create(1, $rand, $rand, $rand);
$this->assert_true($album1->name != $album2->name);
}
+
+ public function thumbnail_url_test() {
+ $rand = rand();
+ $album = album::create(1, $rand, $rand, $rand);
+ $this->assert_equal("http://./var/resizes/$rand/.thumb.jpg", $album->thumbnail_url());
+ }
+
+ public function resize_url_test() {
+ $rand = rand();
+ $album = album::create(1, $rand, $rand, $rand);
+ $this->assert_equal("http://./var/resizes/$rand/.resize.jpg", $album->resize_url());
+ }
}
diff --git a/core/tests/Core_Installer_Test.php b/core/tests/Core_Installer_Test.php
index 4903805b..1cfd09cb 100644
--- a/core/tests/Core_Installer_Test.php
+++ b/core/tests/Core_Installer_Test.php
@@ -23,12 +23,9 @@
* test controller before it starts.
*/
class Core_Installer_Test extends Unit_Test_Case {
- public function install_creates_albums_dir_test() {
+ public function install_creates_dirs_test() {
$this->assert_true(file_exists(VARPATH . "albums"));
- }
-
- public function install_creates_thumbnails_dir_test() {
- $this->assert_true(file_exists(VARPATH . "thumbnails"));
+ $this->assert_true(file_exists(VARPATH . "resizes"));
}
public function install_registers_core_module_test() {
diff --git a/core/tests/Photo_Test.php b/core/tests/Photo_Test.php
index 8b0a48cc..0980a187 100644
--- a/core/tests/Photo_Test.php
+++ b/core/tests/Photo_Test.php
@@ -22,11 +22,11 @@ class Photo_Test extends Unit_Test_Case {
$rand = rand();
$photo = photo::create(1, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand);
- $this->assert_equal(VARPATH . "albums/$rand.jpg", $photo->path());
- $this->assert_equal(VARPATH . "thumbnails/{$rand}_thumb.jpg", $photo->thumbnail_path());
- $this->assert_equal(VARPATH . "thumbnails/{$rand}_resize.jpg", $photo->resize_path());
+ $this->assert_equal(VARPATH . "albums/$rand.jpg", $photo->file_path());
+ $this->assert_equal(VARPATH . "resizes/{$rand}.thumb.jpg", $photo->thumbnail_path());
+ $this->assert_equal(VARPATH . "resizes/{$rand}.resize.jpg", $photo->resize_path());
- $this->assert_true(is_file($photo->path()), "missing: {$photo->path()}");
+ $this->assert_true(is_file($photo->file_path()), "missing: {$photo->file_path()}");
$this->assert_true(is_file($photo->resize_path()), "missing: {$photo->resize_path()}");
$this->assert_true(is_file($photo->thumbnail_path()), "missing: {$photo->thumbnail_path()}");
@@ -54,4 +54,16 @@ class Photo_Test extends Unit_Test_Case {
// pass
}
}
+
+ public function thumbnail_url_test() {
+ $rand = rand();
+ $photo = photo::create(1, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand);
+ $this->assert_equal("http://./var/resizes/{$rand}.thumb.jpg", $photo->thumbnail_url());
+ }
+
+ public function resize_url_test() {
+ $rand = rand();
+ $photo = photo::create(1, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand);
+ $this->assert_equal("http://./var/resizes/{$rand}.resize.jpg", $photo->resize_url());
+ }
}