diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 541cda8..568254e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.2.5', '7.3', '7.4', '8.0'] + php: ['7.2.5', '7.3', '7.4', '8.0', '8.1'] include: - php: '7.4' deps: lowest diff --git a/Tests/Domain/AuditLoggerTest.php b/Tests/Domain/AuditLoggerTest.php index 05e9c82..afe886d 100644 --- a/Tests/Domain/AuditLoggerTest.php +++ b/Tests/Domain/AuditLoggerTest.php @@ -11,7 +11,11 @@ namespace Symfony\Component\Security\Acl\Tests\Domain; -class AuditLoggerTest extends \PHPUnit\Framework\TestCase +use PHPUnit\Framework\TestCase; +use Symfony\Component\Security\Acl\Domain\AuditLogger; +use Symfony\Component\Security\Acl\Tests\Fixtures\SerializableAuditableEntryInterface; + +class AuditLoggerTest extends TestCase { /** * @dataProvider getTestLogData @@ -73,11 +77,11 @@ public function getTestLogData() protected function getEntry() { - return $this->createMock('Symfony\Component\Security\Acl\Model\AuditableEntryInterface'); + return $this->createMock(SerializableAuditableEntryInterface::class); } protected function getLogger() { - return $this->getMockForAbstractClass('Symfony\Component\Security\Acl\Domain\AuditLogger'); + return $this->getMockForAbstractClass(AuditLogger::class); } } diff --git a/Tests/Domain/EntryTest.php b/Tests/Domain/EntryTest.php index 116269e..a69e3b9 100644 --- a/Tests/Domain/EntryTest.php +++ b/Tests/Domain/EntryTest.php @@ -11,9 +11,12 @@ namespace Symfony\Component\Security\Acl\Tests\Domain; +use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Acl\Domain\Entry; +use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; +use Symfony\Component\Security\Acl\Tests\Fixtures\SerializableAclInterface; -class EntryTest extends \PHPUnit\Framework\TestCase +class EntryTest extends TestCase { public function testConstructor() { @@ -77,7 +80,7 @@ public function testSerializeUnserialize() $uAce = unserialize($serialized); $this->assertNull($uAce->getAcl()); - $this->assertInstanceOf('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface', $uAce->getSecurityIdentity()); + $this->assertInstanceOf(SecurityIdentityInterface::class, $uAce->getSecurityIdentity()); $this->assertEquals($ace->getId(), $uAce->getId()); $this->assertEquals($ace->getMask(), $uAce->getMask()); $this->assertEquals($ace->getStrategy(), $uAce->getStrategy()); @@ -109,11 +112,11 @@ protected function getAce($acl = null, $sid = null) protected function getAcl() { - return $this->createMock('Symfony\Component\Security\Acl\Model\AclInterface'); + return $this->createMock(SerializableAclInterface::class); } protected function getSid() { - return $this->createMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface'); + return $this->createMock(SecurityIdentityInterface::class); } } diff --git a/Tests/Domain/FieldEntryTest.php b/Tests/Domain/FieldEntryTest.php index b7452cc..7b29fd8 100644 --- a/Tests/Domain/FieldEntryTest.php +++ b/Tests/Domain/FieldEntryTest.php @@ -11,10 +11,12 @@ namespace Symfony\Component\Security\Acl\Tests\Domain; +use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Acl\Domain\FieldEntry; use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; +use Symfony\Component\Security\Acl\Tests\Fixtures\SerializableAclInterface; -class FieldEntryTest extends \PHPUnit\Framework\TestCase +class FieldEntryTest extends TestCase { public function testConstructor() { @@ -31,7 +33,7 @@ public function testSerializeUnserialize() $uAce = unserialize($serialized); $this->assertNull($uAce->getAcl()); - $this->assertInstanceOf('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface', $uAce->getSecurityIdentity()); + $this->assertInstanceOf(SecurityIdentityInterface::class, $uAce->getSecurityIdentity()); $this->assertEquals($ace->getId(), $uAce->getId()); $this->assertEquals($ace->getField(), $uAce->getField()); $this->assertEquals($ace->getMask(), $uAce->getMask()); @@ -86,11 +88,11 @@ protected function getAce($acl = null, $sid = null) protected function getAcl() { - return $this->createMock('Symfony\Component\Security\Acl\Model\AclInterface'); + return $this->createMock(SerializableAclInterface::class); } protected function getSid() { - return $this->createMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface'); + return $this->createMock(SecurityIdentityInterface::class); } } diff --git a/Tests/Fixtures/SerializableAclInterface.php b/Tests/Fixtures/SerializableAclInterface.php new file mode 100644 index 0000000..94e8230 --- /dev/null +++ b/Tests/Fixtures/SerializableAclInterface.php @@ -0,0 +1,12 @@ +expects($this->once()) ->method('findAcl') ->with($this->equalTo($oid), $this->equalTo($sids)) - ->willReturn($acl = $this->createMock(AclInterface::class)) + ->willReturn($acl = $this->createMock(SerializableAclInterface::class)) ; $acl @@ -266,7 +266,7 @@ public function testVoteNoAceFound() ->expects($this->once()) ->method('findAcl') ->with($this->equalTo($oid), $this->equalTo($sids)) - ->willReturn($acl = $this->createMock(AclInterface::class)) + ->willReturn($acl = $this->createMock(SerializableAclInterface::class)) ; $acl @@ -309,7 +309,7 @@ public function testVoteGrantsFieldAccess($grant) ->expects($this->once()) ->method('findAcl') ->with($this->equalTo($oid), $this->equalTo($sids)) - ->willReturn($acl = $this->createMock(AclInterface::class)) + ->willReturn($acl = $this->createMock(SerializableAclInterface::class)) ; $acl @@ -355,7 +355,7 @@ public function testVoteNoFieldAceFound() ->expects($this->once()) ->method('findAcl') ->with($this->equalTo($oid), $this->equalTo($sids)) - ->willReturn($acl = $this->createMock(AclInterface::class)) + ->willReturn($acl = $this->createMock(SerializableAclInterface::class)) ; $acl @@ -396,7 +396,7 @@ public function testWhenReceivingAnObjectIdentityInterfaceWeDontRetrieveANewObje ->expects($this->once()) ->method('findAcl') ->with($this->equalTo($oid), $this->equalTo($sids)) - ->willReturn($acl = $this->createMock(AclInterface::class)) + ->willReturn($acl = $this->createMock(SerializableAclInterface::class)) ; $acl