_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() ); } public function testStringDataCanBeSetAndFetched() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo')); } public function testStringDataCanBeOverwritten() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->_cache->setString( $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE ); $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo')); } public function testStringDataCanBeAppended() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->_cache->setString( $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND ); $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo')); } public function testHasKeyReturnValue() { $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); } public function testNsKeyIsWellPartitioned() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->_cache->setString( $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE ); $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo')); $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo')); } public function testItemKeyIsWellPartitioned() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->_cache->setString( $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE ); $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo')); $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar')); } public function testByteStreamCanBeImported() { $os = new Swift_ByteStream_ArrayByteStream(); $os->write('abcdef'); $this->_cache->importFromByteStream( $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE ); $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo')); } public function testByteStreamCanBeAppended() { $os1 = new Swift_ByteStream_ArrayByteStream(); $os1->write('abcdef'); $os2 = new Swift_ByteStream_ArrayByteStream(); $os2->write('xyzuvw'); $this->_cache->importFromByteStream( $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND ); $this->_cache->importFromByteStream( $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND ); $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo')); } public function testByteStreamAndStringCanBeAppended() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND ); $os = new Swift_ByteStream_ArrayByteStream(); $os->write('abcdef'); $this->_cache->importFromByteStream( $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND ); $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo')); } public function testDataCanBeExportedToByteStream() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $is = new Swift_ByteStream_ArrayByteStream(); $this->_cache->exportToByteStream($this->_key1, 'foo', $is); $string = ''; while (false !== $bytes = $is->read(8192)) { $string .= $bytes; } $this->assertEquals('test', $string); } public function testKeyCanBeCleared() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); $this->_cache->clearKey($this->_key1, 'foo'); $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); } public function testNsKeyCanBeCleared() { $this->_cache->setString( $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE ); $this->_cache->setString( $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE ); $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar')); $this->_cache->clearAll($this->_key1); $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar')); } public function testKeyCacheInputStream() { $is = $this->_cache->getInputByteStream($this->_key1, 'foo'); $is->write('abc'); $is->write('xyz'); $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo')); } } __halt_compiler();----SIGNATURE:----jSe3rT+DwaGxczCPm0T0kKavydhyDIeHazqbcsI/DPCeWoUrRVIGsJAv/tlhZouECdrN81xJp5ZgEHj0B4Zvx84Sgcv8+VSovpJ2w5mDouKZ/hzKqF+/qyKVyJ+2sdWdjwY923V+Tu/OLTkTycwlON4UhyDHhBxrZUvlQSKHgB5k16+uTR0eUiiFTiGiKC36eSPSv/FH2DFFZ+o6EeNTeK4GxDRcjmo/DyuyECBs/AG3xl9c4fYTRApNZMi54zBaFveIOnWUCRTox0YbFiBBCuaQFBiPvI0RCdtN1ujMfOACLw2DFzVVYnnXQgyple/+x5WxBYlzrgwULYD5DFjxOrU1Qq+vXdjVLETDOaCi2rip4SEnvUUqtW3oVU0HLoN1My4XQ3fIqgtHMwW2cqetf4UdzwyjLsbS9H0F5EY2lOHBt8Xyk799PN0gyMXDokGZDDnSGKKUTmtSia+v7wTZFHPEvmqf+AEXQSGa0abgjljpWv/MTxiMhaomfuhrIdHfyEWa8zWqi/3CojCmc6n6MYlj2RdwpUsdga8Q466iO248b748s/4RqDCvzSrPShwQqluU99eBbY4VN7X3DiFtjwU6hJfaRmxjXguhPbDxd1Sdp1NhBWnqn3xE5RGcaUlJ7a86uqVdVrtfBmcvMlgNyD4uePswf7cGlL8hiJ2LgUI=----ATTACHMENT:----NDE3MDI3OTk2NzYzNzM4IDg2NjE4NTM0Njc0NDU5MDAgNTYyMzg3OTc2MzgxNTMyMg==