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 committed Aug 29, 2020
1 parent aa76831 commit fe0cb26
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,27 @@ jobs:
- '7.2'
- '7.3'
- '7.4'
phpunit-version: ['8.5']
dependencies: [highest]
allowed_to_fail: [false]
variant: [normal]
include:
- php-version: '7.2'
phpunit-version: '8.5'
dependencies: lowest
allowed_to_fail: false
variant: normal
- php-version: '8.0'
phpunit-version: '9.3'
dependencies: highest
allowed_to_fail: true
variant: normal
- php-version: '7.3'
phpunit-version: '8.5'
dependencies: highest
allowed_to_fail: false
variant: 'symfony/symfony:"4.4.*"'
- php-version: '7.3'
phpunit-version: '8.5'
dependencies: highest
allowed_to_fail: false
variant: 'sonata-project/block-bundle:"3.*"'

env:
SYMFONY_PHPUNIT_VERSION: ${{ matrix.phpunit-version }}

steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
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 fe0cb26

Please sign in to comment.