Skip to content

Commit

Permalink
[container] - Updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Nov 1, 2019
1 parent ff726ff commit 8777c10
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/unit/Container/GetCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Phalcon\Escaper;
use Phalcon\Test\Fixtures\Traits\DiTrait;
use UnitTester;
use function spl_object_hash;

class GetCest
{
Expand All @@ -33,16 +34,27 @@ public function containerGet(UnitTester $I)
$I->wantToTest('Container - get()');

$this->newDi();
$this->setDiEscaper();

$container = new Container($this->container);
$escaper = new Escaper();
$this->container->setShared('test', $escaper);
$this->setDiEscaper();

/** @var Service $service */
$service = $container->get('escaper');
$container = new Container($this->container);
$containerEscaper = $container->get('test');

$I->assertEquals(
$I->assertInstanceOf(
Escaper::class,
$service->getDefinition()
$containerEscaper
);

$diEscaper = $this->container->getShared('test');

$expected = spl_object_hash($escaper);
$actual = spl_object_hash($diEscaper);
$I->assertEquals($expected, $actual);

$expected = spl_object_hash($diEscaper);
$actual = spl_object_hash($containerEscaper);
$I->assertEquals($expected, $actual);
}
}

0 comments on commit 8777c10

Please sign in to comment.