Skip to content

Commit

Permalink
[phalcon#49] - correcting test
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Jul 30, 2024
1 parent 70ba8f2 commit 9a2b4e0
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/unit/Container/Definitions/DefinitionsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
use Phalcon\Tests\Fixtures\Container\TestWithInterface;
use UnitTester;

use function uniqid;

class DefinitionsCest
{
protected Definitions $definitions;
Expand Down Expand Up @@ -144,28 +146,30 @@ function () {
*/
public function containerDefinitionsDefinitionsMagicValues(UnitTester $I): void
{
$name = uniqid('val');

// not defined
$actual = isset($this->definitions->one);
$actual = isset($this->definitions->$name);
$I->assertFalse($actual);

$this->definitions->one = 'ten';
$this->definitions->$name = 'ten';

$actual = isset($this->definitions->one);
$actual = isset($this->definitions->$name);
$I->assertTrue($actual);

$expected = 'ten';
$actual = $this->definitions->one;
$actual = $this->definitions->$name;
$I->assertSame($expected, $actual);

unset($this->definitions->one);
unset($this->definitions->$name);

$actual = isset($this->definitions->one);
$actual = isset($this->definitions->$name);
$I->assertFalse($actual);

$I->expectThrowable(
new NotFound("Value definition 'one' not found."),
function () {
$this->definitions->one;
new NotFound("Value definition '$name' not found."),
function () use ($name) {
$this->definitions->$name;
}
);
}
Expand Down

0 comments on commit 9a2b4e0

Please sign in to comment.