mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
Merge branch 'support/3.2' into develop
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Copyright (c) 2010-2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
@@ -74,7 +75,7 @@ class UserRightsTest extends ItopDataTestCase
|
||||
$iCount++;
|
||||
|
||||
$oUser = self::CreateUser($sLogin, $iProfileId);
|
||||
$_SESSION = array();
|
||||
$_SESSION = [];
|
||||
UserRights::Login($sLogin);
|
||||
return $oUser;
|
||||
}
|
||||
@@ -102,8 +103,7 @@ class UserRightsTest extends ItopDataTestCase
|
||||
// Fixture data required in this case only
|
||||
try {
|
||||
self::CreateUser('admin', 1);
|
||||
}
|
||||
catch (CoreCannotSaveObjectException $e) {
|
||||
} catch (CoreCannotSaveObjectException $e) {
|
||||
// The admin account could exist, depending on where and when the test suite is executed
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,6 @@ class UserRightsTest extends ItopDataTestCase
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** Test IsActionAllowedOnAttribute
|
||||
*
|
||||
* @dataProvider ActionAllowedOnAttributeProvider
|
||||
@@ -455,7 +454,7 @@ class UserRightsTest extends ItopDataTestCase
|
||||
public function NonAdminCanListOwnProfilesProvider(): array
|
||||
{
|
||||
return [
|
||||
'with Admins visible'=> [false],
|
||||
'with Admins visible' => [false],
|
||||
'with Admins hidden' => [true],
|
||||
];
|
||||
}
|
||||
@@ -482,7 +481,7 @@ class UserRightsTest extends ItopDataTestCase
|
||||
public function NonAdminCannotListAdminProfilesProvider(): array
|
||||
{
|
||||
return [
|
||||
'with Admins visible'=> [false, 1],
|
||||
'with Admins visible' => [false, 1],
|
||||
'with Admins hidden' => [true, 0],
|
||||
];
|
||||
}
|
||||
@@ -494,13 +493,13 @@ class UserRightsTest extends ItopDataTestCase
|
||||
|
||||
$this->assertDBQueryCount(
|
||||
1,
|
||||
fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
'A query should be performed the first time FindUser is called'
|
||||
);
|
||||
|
||||
$this->assertDBQueryCount(
|
||||
0,
|
||||
fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
'The cache should prevent additional queries on subsequent calls'
|
||||
);
|
||||
}
|
||||
@@ -512,13 +511,13 @@ class UserRightsTest extends ItopDataTestCase
|
||||
|
||||
$this->assertDBQueryCount(
|
||||
2,
|
||||
fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
'Some queries should be performed the first time FindUser is called'
|
||||
);
|
||||
|
||||
$this->assertDBQueryCount(
|
||||
0,
|
||||
fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey),
|
||||
'The cache should prevent additional queries on subsequent calls'
|
||||
);
|
||||
}
|
||||
@@ -529,13 +528,13 @@ class UserRightsTest extends ItopDataTestCase
|
||||
|
||||
$this->assertDBQueryCount(
|
||||
2,
|
||||
fn() => $this->FindUserAndAssertItWasNotFound($sLogin),
|
||||
fn () => $this->FindUserAndAssertItWasNotFound($sLogin),
|
||||
'Some queries should be performed the first time FindUser is called'
|
||||
);
|
||||
|
||||
$this->assertDBQueryCount(
|
||||
0,
|
||||
fn() => $this->FindUserAndAssertItWasNotFound($sLogin),
|
||||
fn () => $this->FindUserAndAssertItWasNotFound($sLogin),
|
||||
'The cache should prevent additional queries on subsequent calls'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user