コード例 #1
0
 public function testCRUD()
 {
     $file = self::DIR . "/test.sync";
     $storage = new StorageFile($file);
     $shared = new SharedMemory($storage);
     $this->assertNull($shared->get('hello'));
     $this->assertNull($shared->get('foo'));
     $this->assertFalse($shared->has('hello'));
     $this->assertFalse($shared->has('foo'));
     $this->assertEquals('world', $shared->set('hello', 'world'));
     $this->assertEquals('bar', $shared->set('foo', 'bar'));
     $this->assertEquals('world', $shared->get('hello'));
     $this->assertEquals('bar', $shared->get('foo'));
     $this->assertTrue($shared->has('hello'));
     $this->assertTrue($shared->has('foo'));
     $shared->remove('foo');
     $this->assertNull($shared->get('foo'));
     $this->assertFalse($shared->has('foo'));
 }