N°4367 Fix \privUITransactionFileTest::testIsTransactionValid

Was crashing because of limitations on loading User objects
This commit is contained in:
Pierre Goiffon
2021-11-04 16:15:01 +01:00
parent 4450c28295
commit 2e8920f3d1

View File

@@ -148,11 +148,15 @@ class privUITransactionFileTest extends ItopDataTestCase
*/
public function testIsTransactionValid()
{
$this->markTestSkipped('on Jenkins, develop branch we have "Login with user2 throw an error"');
$this->CreateUser(static::USER1_TEST_LOGIN, self::SAMPLE_DATA_SUPPORT_PROFILE_ID);
$this->CreateUser(static::USER2_TEST_LOGIN, self::SAMPLE_DATA_SUPPORT_PROFILE_ID);
// created users aren't admin, so each one can't see the other (\UserRights::GetSelectFilter)
// If calling \UserRights::Login(user1) then \UserRights::Login(user2) we won't be able to load user2 !
// As now we are in the admin context, we are calling FindUser() directly so that user objects will be saved in the UserRights cache !
// user1 can be omitted as the first \UserRights::Login cache will initialize the UserRights cache
$this->InvokeNonPublicStaticMethod(UserRights::class, 'FindUser', [self::USER2_TEST_LOGIN]);
// create token in the user1 context
$bUser1Login1 = UserRights::Login(self::USER1_TEST_LOGIN);
$this->assertTrue($bUser1Login1, 'Login with user1 throw an error');