has() public method

Determine if an item exists in the cache. This method will also check if the ttl of the given cache key has been expired and will free the memory if so.
public has ( string $key ) : boolean
$key string Cache key of the item.
return boolean Has cache key.
 public function testShouldCheckIfHave()
 {
     // Set
     $cacheRepo = m::mock(Repository::class);
     $serializer = m::mock(Serializer::class);
     $component = new LaravelCacheComponent($cacheRepo, $serializer);
     $key = 'foo';
     $exists = true;
     // Expectations
     $cacheRepo->shouldReceive('has')->once()->with($key)->andReturn($exists);
     // Assertion
     $this->assertEquals($exists, $component->has($key));
 }