summaryrefslogtreecommitdiffstats
path: root/31.patch
blob: 5bc443a282ffb3a8d5d4a44e1804ec42931588f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 2cc86d0181dc3d05bbf7d4830a219e7ad5f3f954 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
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 <remi@remirepo.net>
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());
     }