From 55c4ac1bfe565f1ca7f537fdd8b7a201be28e581 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 10 Nov 2005 12:47:19 +0000 Subject: Initial import of prado framework --- tests/UnitTests/framework/Data/utMemCache.php | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/UnitTests/framework/Data/utMemCache.php (limited to 'tests/UnitTests/framework/Data/utMemCache.php') diff --git a/tests/UnitTests/framework/Data/utMemCache.php b/tests/UnitTests/framework/Data/utMemCache.php new file mode 100644 index 00000000..26981f63 --- /dev/null +++ b/tests/UnitTests/framework/Data/utMemCache.php @@ -0,0 +1,66 @@ +fail('TMemCache is not tested. PHP extension "memcache" is required by TMemCache.'); + return; + } + $cache=new TMemCache; + + $this->assertTrue($cache->getHost()==='localhost'); + $cache->setHost('localhost2'); + $this->assertTrue($cache->getHost()==='localhost2'); + + $this->assertTrue($cache->getPort()===11211); + $cache->setPort(1000); + $this->assertTrue($cache->getPort()===1000); + + $cache->init(null,null); + try + { + $cache->setHost('newhost'); + $this->fail('exception not raised when setting Server after init'); + } + catch(TInvalidOperationException $e) + { + $this->pass(); + } + try + { + $cache->setPort(10000); + $this->fail('exception not raised when setting Port after init'); + } + catch(TInvalidOperationException $e) + { + $this->pass(); + } + } + + public function testBasicOperations() + { + if(!extension_loaded('memcache')) + { + $this->fail('TMemCache is not tested. PHP extension "memcache" is required by TMemCache.'); + return; + } + $cache=new TMemCache; + $cache->init(null,null); + $this->setCache($cache); + $this->basicOperations(); + $this->setCache(null); + } +} + +?> \ No newline at end of file -- cgit v1.2.3