|
@@ 188-226 (lines=39) @@
|
| 185 |
|
// ADMIN1 should not be able to level anyone to Admin Level |
| 186 |
|
Env::setUser(Env::ENV_TEST_ADMIN1); |
| 187 |
|
|
| 188 |
|
foreach ($circles as $circle) { |
| 189 |
|
|
| 190 |
|
try { |
| 191 |
|
Circles::levelMember( |
| 192 |
|
$circle->getId(), Env::ENV_TEST_ADMIN3, DeprecatedMember::TYPE_USER, |
| 193 |
|
DeprecatedMember::LEVEL_MODERATOR |
| 194 |
|
); |
| 195 |
|
$this->assertSame(true, false, 'should return an exception'); |
| 196 |
|
} catch (MemberDoesNotExistException $e) { |
| 197 |
|
} catch (Exception $e) { |
| 198 |
|
$this->assertSame( |
| 199 |
|
true, false, 'should have returned a MemberDoesNotExistException' |
| 200 |
|
); |
| 201 |
|
} |
| 202 |
|
|
| 203 |
|
try { |
| 204 |
|
Circles::levelMember( |
| 205 |
|
$circle->getId(), Env::ENV_TEST_ADMIN2, DeprecatedMember::TYPE_USER, DeprecatedMember::LEVEL_ADMIN |
| 206 |
|
); |
| 207 |
|
$this->assertSame(true, false, 'should return an exception'); |
| 208 |
|
} catch (ModeratorIsNotHighEnoughException $e) { |
| 209 |
|
} catch (Exception $e) { |
| 210 |
|
$this->assertSame( |
| 211 |
|
true, false, 'should have returned a ModeratorIsNotHighEnoughException' |
| 212 |
|
); |
| 213 |
|
} |
| 214 |
|
|
| 215 |
|
try { |
| 216 |
|
Circles::levelMember( |
| 217 |
|
$circle->getId(), Env::ENV_TEST_ADMIN2, DeprecatedMember::TYPE_USER, DeprecatedMember::LEVEL_OWNER |
| 218 |
|
); |
| 219 |
|
$this->assertSame(true, false, 'should return an exception'); |
| 220 |
|
} catch (MemberIsNotOwnerException $e) { |
| 221 |
|
} catch (Exception $e) { |
| 222 |
|
$this->assertSame( |
| 223 |
|
true, false, 'should have returned a MemberIsNotOwnerException' |
| 224 |
|
); |
| 225 |
|
} |
| 226 |
|
} |
| 227 |
|
|
| 228 |
|
Env::logout(); |
| 229 |
|
|
|
@@ 254-291 (lines=38) @@
|
| 251 |
|
// MODERATOR1 should not be able to add/level anyone to Moderator/Admin Level |
| 252 |
|
Env::setUser(Env::ENV_TEST_MODERATOR1); |
| 253 |
|
|
| 254 |
|
foreach ($circles as $circle) { |
| 255 |
|
try { |
| 256 |
|
Circles::levelMember( |
| 257 |
|
$circle->getId(), Env::ENV_TEST_MODERATOR2, DeprecatedMember::TYPE_USER, |
| 258 |
|
DeprecatedMember::LEVEL_MODERATOR |
| 259 |
|
); |
| 260 |
|
$this->assertSame(true, false, 'should return an exception'); |
| 261 |
|
} catch (ModeratorIsNotHighEnoughException $e) { |
| 262 |
|
} catch (Exception $e) { |
| 263 |
|
$this->assertSame( |
| 264 |
|
true, false, 'should have returned a ModeratorIsNotHighEnoughException' |
| 265 |
|
); |
| 266 |
|
} |
| 267 |
|
try { |
| 268 |
|
Circles::levelMember( |
| 269 |
|
$circle->getId(), Env::ENV_TEST_MODERATOR2, DeprecatedMember::TYPE_USER, |
| 270 |
|
DeprecatedMember::LEVEL_ADMIN |
| 271 |
|
); |
| 272 |
|
$this->assertSame(true, false, 'should return an exception'); |
| 273 |
|
} catch (ModeratorIsNotHighEnoughException $e) { |
| 274 |
|
} catch (Exception $e) { |
| 275 |
|
$this->assertSame( |
| 276 |
|
true, false, 'should have returned a ModeratorIsNotHighEnoughException' |
| 277 |
|
); |
| 278 |
|
} |
| 279 |
|
try { |
| 280 |
|
Circles::levelMember( |
| 281 |
|
$circle->getId(), Env::ENV_TEST_MODERATOR2, DeprecatedMember::TYPE_USER, |
| 282 |
|
DeprecatedMember::LEVEL_OWNER |
| 283 |
|
); |
| 284 |
|
$this->assertSame(true, false, 'should return an exception'); |
| 285 |
|
} catch (MemberIsNotOwnerException $e) { |
| 286 |
|
} catch (Exception $e) { |
| 287 |
|
$this->assertSame( |
| 288 |
|
true, false, 'should have returned a MemberIsNotOwnerException' |
| 289 |
|
); |
| 290 |
|
} |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
Env::logout(); |
| 294 |
|
|