From 970ef7dc56a3b293f061b3d6a96a8ada571c7e33 Mon Sep 17 00:00:00 2001 From: gwoo Date: Thu, 11 Sep 2008 13:35:11 +0000 Subject: [PATCH] fixing issue in schema when model does not use a table. updating cache test to properly test Cache::set() git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7592 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/model/schema.php | 2 +- cake/tests/cases/libs/cache.test.php | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/cake/libs/model/schema.php b/cake/libs/model/schema.php index 5f65b18ee..9820d1454 100644 --- a/cake/libs/model/schema.php +++ b/cake/libs/model/schema.php @@ -205,7 +205,7 @@ class CakeSchema extends Object { $Object =& ClassRegistry::init(array('class' => $model, 'ds' => $connection)); } - if (is_object($Object)) { + if (is_object($Object) && $Object->useTable !== false) { $Object->setDataSource($connection); $table = $db->fullTableName($Object, false); diff --git a/cake/tests/cases/libs/cache.test.php b/cake/tests/cases/libs/cache.test.php index 73cf960db..9ea9bf839 100644 --- a/cake/tests/cases/libs/cache.test.php +++ b/cake/tests/cases/libs/cache.test.php @@ -159,24 +159,17 @@ class CacheTest extends CakeTestCase { Cache::set(array('duration' => '+1 year')); $data = Cache::read('test_cache'); - if($data === false) { - $data = 'this is just a simple test of the cache system'; - $write = Cache::write('test_cache', $data); - } + $this->assertFalse($data); + + $data = 'this is just a simple test of the cache system'; + $write = Cache::write('test_cache', $data); $this->assertTrue($write); - $write = false; - Cache::set(array('duration' => '+1 year')); - $data = Cache::read('test_cache'); - if($data === false) { - $data = 'this is just a simple test of the cache system'; - $write = Cache::write('test_cache', $data); - } - $this->assertFalse($write); + $this->assertEqual($data, 'this is just a simple test of the cache system'); Cache::delete('test_cache');