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