MongolidLaravel\LaravelCacheComponentTest::testShouldCheckIfHave PHP Method

testShouldCheckIfHave() public method

    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));
    }