@@ 87-103 (lines=17) @@ | ||
84 | ->getMock(); |
|
85 | } |
|
86 | ||
87 | public function testSystemLevel() |
|
88 | { |
|
89 | $this->provider->expects($this->once()) |
|
90 | ->method('getAccessLevel') |
|
91 | ->with(self::PERMISSION, 'entity:'.self::ENTITY_NAME) |
|
92 | ->will($this->returnValue(AccessLevel::SYSTEM_LEVEL)); |
|
93 | ||
94 | $this->treeProvider->expects($this->exactly(1)) |
|
95 | ->method('getTree') |
|
96 | ->will($this->returnValue($this->treeProvider)); |
|
97 | ||
98 | $this->treeProvider->expects($this->exactly(1)) |
|
99 | ->method('getAllBusinessUnitIds') |
|
100 | ->will($this->returnValue($this->treeProvider)); |
|
101 | ||
102 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
103 | } |
|
104 | ||
105 | public function testLocalLevel() |
|
106 | { |
|
@@ 105-121 (lines=17) @@ | ||
102 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
103 | } |
|
104 | ||
105 | public function testLocalLevel() |
|
106 | { |
|
107 | $this->provider->expects($this->once()) |
|
108 | ->method('getAccessLevel') |
|
109 | ->with(self::PERMISSION, 'entity:'.self::ENTITY_NAME) |
|
110 | ->will($this->returnValue(AccessLevel::LOCAL_LEVEL)); |
|
111 | ||
112 | $this->treeProvider->expects($this->exactly(1)) |
|
113 | ->method('getTree') |
|
114 | ->will($this->returnValue($this->treeProvider)); |
|
115 | ||
116 | $this->treeProvider->expects($this->exactly(1)) |
|
117 | ->method('getUserBusinessUnitIds') |
|
118 | ->will($this->returnValue($this->treeProvider)); |
|
119 | ||
120 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
121 | } |
|
122 | ||
123 | public function testDeepLevel() |
|
124 | { |
|
@@ 123-139 (lines=17) @@ | ||
120 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
121 | } |
|
122 | ||
123 | public function testDeepLevel() |
|
124 | { |
|
125 | $this->provider->expects($this->once()) |
|
126 | ->method('getAccessLevel') |
|
127 | ->with(self::PERMISSION, 'entity:'.self::ENTITY_NAME) |
|
128 | ->will($this->returnValue(AccessLevel::DEEP_LEVEL)); |
|
129 | ||
130 | $this->treeProvider->expects($this->exactly(1)) |
|
131 | ->method('getTree') |
|
132 | ->will($this->returnValue($this->treeProvider)); |
|
133 | ||
134 | $this->treeProvider->expects($this->exactly(1)) |
|
135 | ->method('getUserSubordinateBusinessUnitIds') |
|
136 | ->will($this->returnValue($this->treeProvider)); |
|
137 | ||
138 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
139 | } |
|
140 | ||
141 | public function testGlobalLevel() |
|
142 | { |
|
@@ 141-157 (lines=17) @@ | ||
138 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
139 | } |
|
140 | ||
141 | public function testGlobalLevel() |
|
142 | { |
|
143 | $this->provider->expects($this->once()) |
|
144 | ->method('getAccessLevel') |
|
145 | ->with(self::PERMISSION, 'entity:'.self::ENTITY_NAME) |
|
146 | ->will($this->returnValue(AccessLevel::GLOBAL_LEVEL)); |
|
147 | ||
148 | $this->treeProvider->expects($this->exactly(1)) |
|
149 | ->method('getTree') |
|
150 | ->will($this->returnValue($this->treeProvider)); |
|
151 | ||
152 | $this->treeProvider->expects($this->exactly(1)) |
|
153 | ->method('getOrganizationBusinessUnitIds') |
|
154 | ->will($this->returnValue($this->treeProvider)); |
|
155 | ||
156 | $this->provider->getBusinessUnitIds(self::ENTITY_NAME, self::PERMISSION); |
|
157 | } |
|
158 | ||
159 | public function testAccessNotGranted() |
|
160 | { |