From 2cc86d0181dc3d05bbf7d4830a219e7ad5f3f954 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 31 Oct 2017 12:35:53 +0100 Subject: [PATCH 1/2] Fix test (and count usage with 7.2) --- test/RbacTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/RbacTest.php b/test/RbacTest.php index 1c387e25..5bd364db 100644 --- a/test/RbacTest.php +++ b/test/RbacTest.php @@ -136,7 +136,8 @@ public function testAddRoleWithParentsUsingRbac() $this->rbac->addRole($bar, $foo); $this->assertEquals($bar->getParent(), $foo); - $this->assertEquals(1, count($foo->getChildren())); + $this->assertEquals($foo->getChildren(), $bar); + $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); } public function testAddRoleWithAutomaticParentsUsingRbac() @@ -148,7 +149,8 @@ public function testAddRoleWithAutomaticParentsUsingRbac() $this->rbac->addRole($bar, $foo); $this->assertEquals($bar->getParent(), $foo); - $this->assertEquals(1, count($foo->getChildren())); + $this->assertEquals($foo->getChildren(), $bar); + $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); } /** From 8e8a5ff205c78aaf343355424802da79f07504e3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 31 Oct 2017 12:42:26 +0100 Subject: [PATCH 2/2] also check hasChildren --- test/RbacTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/RbacTest.php b/test/RbacTest.php index 5bd364db..2326f109 100644 --- a/test/RbacTest.php +++ b/test/RbacTest.php @@ -136,7 +136,9 @@ public function testAddRoleWithParentsUsingRbac() $this->rbac->addRole($bar, $foo); $this->assertEquals($bar->getParent(), $foo); + $this->assertTrue($foo->hasChildren()); $this->assertEquals($foo->getChildren(), $bar); + $this->assertFalse($bar->hasChildren()); $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); } @@ -149,7 +151,9 @@ public function testAddRoleWithAutomaticParentsUsingRbac() $this->rbac->addRole($bar, $foo); $this->assertEquals($bar->getParent(), $foo); + $this->assertTrue($foo->hasChildren()); $this->assertEquals($foo->getChildren(), $bar); + $this->assertFalse($bar->hasChildren()); $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); }