diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-25 17:55:51 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-25 17:55:51 +0100 |
commit | a3388622287e218beddfa14a47ed677d4307b36b (patch) | |
tree | 1b4c7ac8597b1cc798b6683d4a81c90d38de12f6 /tests/simple_unit/SqlMap/SqlMapCacheTest.php | |
parent | c7fd3e1167b6f2fa7746edbd0fb8f8c1694c61f9 (diff) |
Removed simpletest and moved all tests in the unit tree
Tests are executed now, but a lot of them need fixing.
Diffstat (limited to 'tests/simple_unit/SqlMap/SqlMapCacheTest.php')
-rw-r--r-- | tests/simple_unit/SqlMap/SqlMapCacheTest.php | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/tests/simple_unit/SqlMap/SqlMapCacheTest.php b/tests/simple_unit/SqlMap/SqlMapCacheTest.php deleted file mode 100644 index 7c3495b5..00000000 --- a/tests/simple_unit/SqlMap/SqlMapCacheTest.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -require_once(dirname(__FILE__).'/BaseCase.php'); - -/** - * @package System.DataAccess.SQLMap - */ -class SqlMapCacheTest extends UnitTestCase -{ - function testFIFOCache() - { - $fifo = new TSqlMapFifoCache(2); - $object1 = new TSqlMapManager; - $object2 = new TComponent; - $object3 = new TSqlMapGateway(null); - - $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 TSqlMapManager; - $object2 = new TComponent; - $object3 = new TSqlMapGateway(null); - - $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)); - } -} - |