Permalink
Browse files

added test for ticket #469

Signed-off-by: Mark Story <mark@mark-story.com>
  • Loading branch information...
1 parent 0cc1e4c commit 6d13f0d3d1006f91ffd7d8ea09dea03483af3d7d @ceeram ceeram committed with markstory Mar 18, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 cake/tests/cases/basics.test.php
@@ -332,6 +332,23 @@ function testClearCache() {
$this->assertFalse(file_exists(CACHE . 'models' . DS . 'basics_test.cache'));
$this->assertFalse(file_exists(CACHE . 'models' . DS . 'basics_test_2.cache'));
$this->assertFalse(file_exists(CACHE . 'models' . DS . 'basics_test_3.cache'));
+
+ // checking if empty files were not removed
+ $emptyExists = file_exists(CACHE . 'views' . DS . 'empty');
+ if (!$emptyExists) {
+ cache('views' . DS . 'empty', '');
+ }
+ cache('views' . DS . 'basics_test.php', 'simple cache write');
+ $this->assertTrue(file_exists(CACHE . 'views' . DS . 'basics_test.php'));
+ $this->assertTrue(file_exists(CACHE . 'views' . DS . 'empty'));
+
+ $result = clearCache();
+ $this->assertTrue($result);
+ $this->assertTrue(file_exists(CACHE . 'views' . DS . 'empty'));
+ $this->assertFalse(file_exists(CACHE . 'views' . DS . 'basics_test.php'));
+ if (!$emptyExists) {
+ unlink(CACHE . 'views' . DS . 'empty');
+ }
}
/**

0 comments on commit 6d13f0d

Please sign in to comment.