<?php

namespace Acclimate\Container\Test\Decorator;

use Acclimate\Container\ArrayContainer;
use Acclimate\Container\Decorator\CallbackOnMissContainer;
use PHPUnit\Framework\TestCase;

/**
 * @covers \Acclimate\Container\Decorator\CallbackOnMissContainer
 */
class CallbackOnMissContainerTest extends TestCase
{
    public function testDecoratorExecutesCallbackForMissingItems()
    {
        $container = new CallbackOnMissContainer(new ArrayContainer, function ($name) {
            return 'CALLBACK!';
        });
        $this->assertFalse($container->has('foo'));
        $this->assertEquals('CALLBACK!', $container->get('foo'));
    }

    public function testDecoratorThrowsExceptionIfCallbackIsInvalid()
    {
        $this->expectException('InvalidArgumentException');
        $container = new CallbackOnMissContainer(new ArrayContainer, 'foo');
    }
}
__halt_compiler();----SIGNATURE:----Wpiwy4rebuh7cdwvoQ6DU9VGDqLyQ5C34Wt3FmmeUeSqxkn5/TtnMw7emMbjNXw2nEu0us9xhqtfytPCtraQMEcCyn7fVjRVVFmM9ak25uaTGjs+Zb4yFsrPKMSBzqbaLfZ7xK/ASCMOsVUo7bayqHOhLGYPJnVXTRgjHBCCItkWMM0tZ5ROLhkPNDYQ+e0Qkl4tpxKmTwvuCt2fBPspIF7mNoB8b36X0TpCliYj0qcs5ltfIkK8MO19LusAaiBX2cgdXeYor8oncdfTcJjmYPtF6WxopRjsyDkD2WNLUIEY2F80pOz+GPIUS3Gp26i5kNLoZofbU4T1XWk66SiXX7TWAqywMOBdY/WGXqrEllyEjxi1IgCbuirej/HEFBFfwYjOeB0Hsq3FxOQi8OhK/DfqIqTw3Vf6BtdacOFrRqjZ9eQGNVd5mHljRtCEIpX5bcPw1b9jcLcGCHUw+Vy8aJxyGHRTCKUklGlUJJj5K9OaEgPw1NQfz4tvyGTB3Z2Q+OU3scHxGFeWHbqE9xDj1HQP8HdPqRgDgwxY1u0GrK8HXkNZUCT+lWKXamTQOF1d8ewRv5AWR4twVNHfGjnBR/pZ6f2EpLmfgSvxXv9Tha22COUktoMZQB8NSp/0uDYdn5jkgS3pRDtLrrVvxf3ErZ4DWmnE/kATT0kiKp9wCcw=----ATTACHMENT:----MTEwNDMyODM1ODExNjc4NSAzOTE5ODg0ODc2NDg3NDQ5IDk3NjAzNjU2NzEwMzE2NTQ=