MongolidLaravel\LaravelCacheComponentTest::testShouldPut PHP Method

testShouldPut() public method

public testShouldPut ( )
    public function testShouldPut()
    {
        // Set
        $cacheRepo = m::mock(Repository::class);
        $serializer = m::mock(Serializer::class);
        $component = new LaravelCacheComponent($cacheRepo, $serializer);
        $key = 'foo';
        $value = [(object) ['name' => 'batata']];
        // Expectations
        $serializer->shouldReceive('convert')->once()->with([['name' => 'batata']])->andReturn([['name' => 'chips']]);
        $cacheRepo->shouldReceive('put')->once()->with($key, [['name' => 'chips']], 3)->andReturn($value);
        // Assertion
        $component->put($key, $value, 3);
    }