Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed May 24, 2017
1 parent f78897f commit 9a6eb98
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -2,6 +2,7 @@

namespace DI\Test\UnitTest\Definition\Source;

use DI\Definition\AliasDefinition;
use DI\Definition\ObjectDefinition;
use DI\Definition\Source\CachedDefinitionSource;
use DI\Definition\Source\DefinitionArray;
Expand All @@ -28,16 +29,18 @@ public function setUp()
*/
public function should_get_from_cache()
{
$definition = new AliasDefinition('foo', 'bar');

$source = $this->createMock(DefinitionSource::class);
$source
->expects($this->once()) // The sub-source should be called ONLY ONCE
->method('getDefinition')
->willReturn('bar');
->willReturn($definition);

$source = new CachedDefinitionSource($source);

self::assertEquals('bar', $source->getDefinition('foo'));
self::assertEquals('bar', $source->getDefinition('foo'));
self::assertEquals($definition, $source->getDefinition('foo'));
self::assertEquals($definition, $source->getDefinition('foo'));
}

/**
Expand Down

0 comments on commit 9a6eb98

Please sign in to comment.