Skip to content

Commit

Permalink
Fix test for PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Dec 7, 2020
1 parent b8abb27 commit de904b4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/TestCase/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ public function testAutowireWithInvalidInternalClass(): void
$this->assertInstanceOf(Exception::class, $container->get(Exception::class));
} else {
// PHP 7.x
// Cannot determine default value for internal functions
$this->expectException(InvalidDefinitionException::class);
$container->get(Exception::class);
}
Expand All @@ -308,11 +309,18 @@ public function testAutowireWithInvalidInternalClass(): void
*/
public function testAutowireWithInvalidInternalInterface(): void
{
$this->expectException(InvalidDefinitionException::class);

$container = new Container();
$container->addResolver(new ConstructorResolver($container));
$container->get(NotFoundException::class);

if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
// PHP 8+
$this->assertInstanceOf(NotFoundException::class, $container->get(NotFoundException::class));
} else {
// PHP 7.x
// Cannot determine default value for internal functions
$this->expectException(InvalidDefinitionException::class);
$container->get(NotFoundException::class);
}
}

/**
Expand Down

0 comments on commit de904b4

Please sign in to comment.