[Cache] Apply NullAdapter as Null Object
This commit is contained in:
parent
40d7315202
commit
f6818eb7ac
@ -114,7 +114,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
|
|||||||
*/
|
*/
|
||||||
public function save(CacheItemInterface $item)
|
public function save(CacheItemInterface $item)
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +124,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
|
|||||||
*/
|
*/
|
||||||
public function saveDeferred(CacheItemInterface $item)
|
public function saveDeferred(CacheItemInterface $item)
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +134,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
|
|||||||
*/
|
*/
|
||||||
public function commit()
|
public function commit()
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +113,7 @@ class NullAdapterTest extends TestCase
|
|||||||
$this->assertFalse($item->isHit());
|
$this->assertFalse($item->isHit());
|
||||||
$this->assertNull($item->get(), "Item's value must be null when isHit is false.");
|
$this->assertNull($item->get(), "Item's value must be null when isHit is false.");
|
||||||
|
|
||||||
$this->assertFalse($adapter->save($item));
|
$this->assertTrue($adapter->save($item));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeferredSave()
|
public function testDeferredSave()
|
||||||
@ -124,7 +124,7 @@ class NullAdapterTest extends TestCase
|
|||||||
$this->assertFalse($item->isHit());
|
$this->assertFalse($item->isHit());
|
||||||
$this->assertNull($item->get(), "Item's value must be null when isHit is false.");
|
$this->assertNull($item->get(), "Item's value must be null when isHit is false.");
|
||||||
|
|
||||||
$this->assertFalse($adapter->saveDeferred($item));
|
$this->assertTrue($adapter->saveDeferred($item));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCommit()
|
public function testCommit()
|
||||||
@ -135,7 +135,7 @@ class NullAdapterTest extends TestCase
|
|||||||
$this->assertFalse($item->isHit());
|
$this->assertFalse($item->isHit());
|
||||||
$this->assertNull($item->get(), "Item's value must be null when isHit is false.");
|
$this->assertNull($item->get(), "Item's value must be null when isHit is false.");
|
||||||
|
|
||||||
$this->assertFalse($adapter->saveDeferred($item));
|
$this->assertTrue($adapter->saveDeferred($item));
|
||||||
$this->assertFalse($this->createCachePool()->commit());
|
$this->assertTrue($this->createCachePool()->commit());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user