summaryrefslogtreecommitdiff
path: root/tests/unit/SQLMap/SqlMapCacheTest.php
diff options
context:
space:
mode:
authorctrlaltca <>2012-07-12 11:21:01 +0000
committerctrlaltca <>2012-07-12 11:21:01 +0000
commit903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch)
treee08bf04f0823650a231227ac3499121270172a23 /tests/unit/SQLMap/SqlMapCacheTest.php
parent3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff)
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'tests/unit/SQLMap/SqlMapCacheTest.php')
-rw-r--r--tests/unit/SQLMap/SqlMapCacheTest.php152
1 files changed, 76 insertions, 76 deletions
diff --git a/tests/unit/SQLMap/SqlMapCacheTest.php b/tests/unit/SQLMap/SqlMapCacheTest.php
index a2593e1a..f1746115 100644
--- a/tests/unit/SQLMap/SqlMapCacheTest.php
+++ b/tests/unit/SQLMap/SqlMapCacheTest.php
@@ -1,77 +1,77 @@
-<?php
-
-require_once(dirname(__FILE__).'/BaseTest.php');
-
-/**
- * @package System.DataAccess.SQLMap
- */
-class SqlMapCacheTest extends PHPUnit2_Framework_TestCase
-{
- function testFIFOCache()
- {
- $fifo = new TSqlMapFifoCache(2);
- $object1 = new TSqlMapper;
- $object2 = new TComponent;
- $object3 = new TMapper;
-
- $key1 = 'key1';
- $key2 = 'key2';
- $key3 = 'key3';
-
- $fifo->set($key1, $object1);
- $fifo->set($key2, $object2);
-
- $this->assertTrue($object1 === $fifo->get($key1));
- $this->assertTrue($object2 === $fifo->get($key2));
-
- //object 1 should be removed
- $fifo->set($key3, $object3);
-
- $this->assertNull($fifo->get($key1));
- $this->assertTrue($object2 === $fifo->get($key2));
- $this->assertTrue($object3 === $fifo->get($key3));
-
- //object 2 should be removed
- $fifo->set($key1, $object1);
-
- $this->assertNull($fifo->get($key2));
- $this->assertTrue($object3 === $fifo->get($key3));
- $this->assertTrue($object1 === $fifo->get($key1));
- }
-
- function testLruCache()
- {
- $lru = new TSqlMapLruCache(2);
-
- $object1 = new TSqlMapper;
- $object2 = new TComponent;
- $object3 = new TMapper;
-
- $key1 = 'key1';
- $key2 = 'key2';
- $key3 = 'key3';
-
- $lru->set($key1, $object1);
- $lru->set($key2, $object2);
-
- $this->assertTrue($object2 === $lru->get($key2));
- $this->assertTrue($object1 === $lru->get($key1));
-
- //object 2 should be removed, i.e. least recently used
- $lru->set($key3, $object3);
-
- $this->assertNull($lru->get($key2));
- $this->assertTrue($object1 === $lru->get($key1));
- $this->assertTrue($object3 === $lru->get($key3));
-
- //object 1 will be removed
- $lru->set($key2, $object2);
-
- $this->assertNull($lru->get($key1));
- $this->assertTrue($object2 === $lru->get($key2));
- $this->assertTrue($object3 === $lru->get($key3));
- }
-}
-
-
+<?php
+
+require_once(dirname(__FILE__).'/BaseTest.php');
+
+/**
+ * @package System.DataAccess.SQLMap
+ */
+class SqlMapCacheTest extends PHPUnit2_Framework_TestCase
+{
+ function testFIFOCache()
+ {
+ $fifo = new TSqlMapFifoCache(2);
+ $object1 = new TSqlMapper;
+ $object2 = new TComponent;
+ $object3 = new TMapper;
+
+ $key1 = 'key1';
+ $key2 = 'key2';
+ $key3 = 'key3';
+
+ $fifo->set($key1, $object1);
+ $fifo->set($key2, $object2);
+
+ $this->assertTrue($object1 === $fifo->get($key1));
+ $this->assertTrue($object2 === $fifo->get($key2));
+
+ //object 1 should be removed
+ $fifo->set($key3, $object3);
+
+ $this->assertNull($fifo->get($key1));
+ $this->assertTrue($object2 === $fifo->get($key2));
+ $this->assertTrue($object3 === $fifo->get($key3));
+
+ //object 2 should be removed
+ $fifo->set($key1, $object1);
+
+ $this->assertNull($fifo->get($key2));
+ $this->assertTrue($object3 === $fifo->get($key3));
+ $this->assertTrue($object1 === $fifo->get($key1));
+ }
+
+ function testLruCache()
+ {
+ $lru = new TSqlMapLruCache(2);
+
+ $object1 = new TSqlMapper;
+ $object2 = new TComponent;
+ $object3 = new TMapper;
+
+ $key1 = 'key1';
+ $key2 = 'key2';
+ $key3 = 'key3';
+
+ $lru->set($key1, $object1);
+ $lru->set($key2, $object2);
+
+ $this->assertTrue($object2 === $lru->get($key2));
+ $this->assertTrue($object1 === $lru->get($key1));
+
+ //object 2 should be removed, i.e. least recently used
+ $lru->set($key3, $object3);
+
+ $this->assertNull($lru->get($key2));
+ $this->assertTrue($object1 === $lru->get($key1));
+ $this->assertTrue($object3 === $lru->get($key3));
+
+ //object 1 will be removed
+ $lru->set($key2, $object2);
+
+ $this->assertNull($lru->get($key1));
+ $this->assertTrue($object2 === $lru->get($key2));
+ $this->assertTrue($object3 === $lru->get($key3));
+ }
+}
+
+
?> \ No newline at end of file