Skip to content

Commit

Permalink
The container auto-registers itself with the interop interface
Browse files Browse the repository at this point in the history
  • Loading branch information
thispagecannotbefound committed Jul 31, 2014
1 parent 9812c10 commit 7610310
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DI/Container.php
Expand Up @@ -85,6 +85,7 @@ public function __construct(
// Auto-register the container
$this->singletonEntries['DI\Container'] = $this;
$this->singletonEntries['DI\ContainerInterface'] = $this;
$this->singletonEntries['Interop\Container\ContainerInterface'] = $this;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions tests/UnitTests/DI/ContainerTest.php
Expand Up @@ -94,6 +94,16 @@ public function testContainerInterfaceIsRegistered()

$this->assertSame($container, $container->get('DI\ContainerInterface'));
}

/**
* The container auto-registers itself (with the interop interface)
*/
public function testContainerInteropInterfaceIsRegistered()
{
$container = ContainerBuilder::buildDevContainer();

$this->assertSame($container, $container->get('Interop\Container\ContainerInterface'));
}

/**
* @see https://github.com/mnapoli/PHP-DI/issues/126
Expand Down

0 comments on commit 7610310

Please sign in to comment.