get() public method

Retrieve an item from the cache by key.
public get ( string $key ) : mixed
$key string Cache key of the item to be retrieved.
return mixed
コード例 #1
0
 public function testShouldGet()
 {
     // Set
     $cacheRepo = m::mock(Repository::class);
     $serializer = m::mock(Serializer::class);
     $component = new LaravelCacheComponent($cacheRepo, $serializer);
     $key = 'foo';
     $value = 'bar';
     // Expectations
     $cacheRepo->shouldReceive('get')->once()->with($key, null)->andReturn($value);
     // Assertion
     $this->assertEquals($value, $component->get($key));
 }