Skip to content

Commit

Permalink
fix test under php 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 authored and greg0ire committed Aug 29, 2020
1 parent da06013 commit 63242f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
13 changes: 11 additions & 2 deletions tests/Admin/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,20 @@ public function testToString(): void
$s = new FooToString();
$this->assertSame('salut', $admin->toString($s));

$this->assertSame('', $admin->toString(false));
}

public function testToStringNull(): void
{
if (\PHP_VERSION_ID >= 80000) {
$this->markTestSkipped('PHP 8.0 does not allow __toString() method to return null');
}

$admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'Sonata\NewsBundle\Controller\PostAdminController');

// To string method is implemented, but returns null
$s = new FooToStringNull();
$this->assertNotEmpty($admin->toString($s));

$this->assertSame('', $admin->toString(false));
}

public function testIsAclEnabled(): void
Expand Down
10 changes: 0 additions & 10 deletions tests/Command/SetupAclCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,4 @@ public function testExecuteWithException1(): void
$commandTester->getDisplay()
);
}

public function testExecuteWithException2(): void
{
$pool = new Pool($this->container, '', '');

$this->expectException(\TypeError::class);
$this->expectExceptionMessage(sprintf('Argument 2 passed to %s::__construct() must implement interface %s, instance of %s given', SetupAclCommand::class, AdminAclManipulatorInterface::class, \stdClass::class));

new SetupAclCommand($pool, new \stdClass());
}
}

0 comments on commit 63242f0

Please sign in to comment.