Skip to content

Commit

Permalink
Merge 10fbce1 into 7eb279d
Browse files Browse the repository at this point in the history
  • Loading branch information
feryardiant committed Jun 19, 2020
2 parents 7eb279d + 10fbce1 commit 7527781
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public function __construct(array $instances = [])
{
$this->resolver = new Resolver($this);

$this->set(ContainerInterface::class, $this);
$this->set(PsrContainerInterface::class, ContainerInterface::class);
$this->set(self::class, $this);
$this->set(ContainerInterface::class, self::class);
$this->set(PsrContainerInterface::class, self::class);

foreach ($instances as $id => $instance) {
$this->set($id, $instance);
Expand Down
10 changes: 7 additions & 3 deletions test/spec/Container.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
}
]);

expect($m)->toBeAnInstanceOf(ContainerInterface::class);
expect($m)->toBeAnInstanceOf(PsrContainer::class);
expect($m->get(stdClass::class))->toBeAnInstanceOf(stdClass::class);
});

it('Should register it-self', function () {
expect($this->c->get(PsrContainer::class))->toBeAnInstanceOf(PsrContainer::class);
$self = [Container::class, PsrContainer::class, ContainerInterface::class];

foreach ($self as $a) {
foreach ($self as $b) {
expect($this->c->get($a))->toBeAnInstanceOf($b);
}
}
});

it('Should resolve serive provider', function () {
Expand Down

0 comments on commit 7527781

Please sign in to comment.