Move login to setUp() of parent::

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2026-02-24 10:25:07 +01:00
parent 16d6380805
commit 8da964fa40
No known key found for this signature in database
GPG Key ID: 70684F4717D49A31
23 changed files with 26 additions and 54 deletions

View File

@ -19,7 +19,7 @@ class ChangePasswordTest extends TestBase
*
* @var bool
*/
protected static $createDatabase = false;
protected $createDatabase = false;
/**
* Array of AssertionFailedError->toString
@ -35,8 +35,6 @@ class ChangePasswordTest extends TestBase
*/
public function testChangePassword(): void
{
$this->login();
$e = $this->waitForElement('id', 'change_password_anchor');
$e->click();

View File

@ -17,7 +17,6 @@ class CreateDropDatabaseTest extends TestBase
parent::setUp();
/* TODO: For now this tests needs superuser for deleting database */
$this->skipIfNotSuperUser();
$this->login();
}
/**

View File

@ -14,7 +14,7 @@ class CreateRemoveUserTest extends TestBase
*
* @var bool
*/
protected static $createDatabase = false;
protected $createDatabase = false;
/**
* Username for the user
@ -39,7 +39,6 @@ class CreateRemoveUserTest extends TestBase
$this->skipIfNotSuperUser();
$this->txtUsername = 'pma_user';
$this->txtPassword = 'abc_123';
$this->login();
}
/**

View File

@ -31,7 +31,7 @@ class EventsTest extends TestBase
. 'INSERT INTO `test_table` (val) VALUES (2);'
. 'SET GLOBAL event_scheduler="ON";'
);
$this->login();
$this->navigateDatabase($this->databaseName);
// Let the Database page load

View File

@ -11,15 +11,6 @@ use PhpMyAdmin\Tests\Selenium\TestBase;
*/
class OperationsTest extends TestBase
{
/**
* setUp function
*/
protected function setUp(): void
{
parent::setUp();
$this->login();
}
private function getToDBOperations(): void
{
$this->gotoHomepage();

View File

@ -49,8 +49,6 @@ class ProceduresTest extends TestBase
. ');'
);
$this->login();
$this->navigateDatabase($this->databaseName);
$this->expandMore();
}

View File

@ -29,8 +29,6 @@ class QueryByExampleTest extends TestBase
. ');'
. 'INSERT INTO `test_table` (val) VALUES (2), (6), (5), (3), (4), (4), (5);'
);
$this->login();
}
/**

View File

@ -32,7 +32,6 @@ class StructureTest extends TestBase
. 'INSERT INTO `test_table` (val) VALUES (2);'
);
$this->login();
$this->navigateDatabase($this->databaseName);
// Let the Database page load

View File

@ -32,8 +32,6 @@ class TriggersTest extends TestBase
. 'INSERT INTO `test_table2` (val) VALUES (2);'
);
$this->login();
$this->navigateDatabase($this->databaseName);
}

View File

@ -24,8 +24,6 @@ class ExportTest extends TestBase
. ');'
. 'INSERT INTO `test_table` (val) VALUES (2);'
);
$this->login();
}
/**

View File

@ -9,15 +9,6 @@ namespace PhpMyAdmin\Tests\Selenium;
*/
class ImportTest extends TestBase
{
/**
* setUp function
*/
protected function setUp(): void
{
parent::setUp();
$this->login();
}
/**
* Test for server level import
*

View File

@ -14,7 +14,14 @@ class LoginTest extends TestBase
*
* @var bool
*/
protected static $createDatabase = false;
protected $createDatabase = false;
/**
* Login before starting this test
*
* @var bool
*/
protected $login = false;
protected function setUp(): void
{

View File

@ -25,7 +25,6 @@ class NormalizationTest extends TestBase
. ');'
);
$this->login();
$this->navigateTable('test_table');
$this->waitForElement('xpath', "(//a[contains(., 'Structure')])")->click();

View File

@ -16,7 +16,7 @@ class ServerSettingsTest extends TestBase
*
* @var bool
*/
protected static $createDatabase = false;
protected $createDatabase = false;
/**
* setUp function

View File

@ -25,7 +25,6 @@ class SqlQueryTest extends TestBase
. ');'
. 'INSERT INTO `test_table` (val) VALUES (2), (3), (4), (5);'
);
$this->login();
}
/**

View File

@ -32,7 +32,6 @@ class BrowseTest extends TestBase
. " (3, 'Abcd', '2012-01-20 02:00:02');"
);
$this->login();
$this->navigateTable('test_table');
$this->waitAjax();

View File

@ -16,8 +16,6 @@ class CreateTest extends TestBase
protected function setUp(): void
{
parent::setUp();
$this->login();
$this->navigateDatabase($this->databaseName);
}

View File

@ -28,7 +28,6 @@ class InsertTest extends TestBase
. ');'
);
$this->login();
$this->navigateTable('test_table');
}

View File

@ -32,7 +32,6 @@ class OperationsTest extends TestBase
. 'INSERT INTO test_table (val, val2) VALUES (33, 44);'
);
$this->login();
$this->navigateTable('test_table');
$this->waitAjax();

View File

@ -27,7 +27,6 @@ class StructureTest extends TestBase
. ');'
);
$this->login();
$this->navigateTable('test_table');
$this->waitForElement('xpath', "(//a[contains(., 'Structure')])")->click();

View File

@ -95,7 +95,14 @@ abstract class TestBase extends TestCase
*
* @var bool
*/
protected static $createDatabase = true;
protected $createDatabase = true;
/**
* Login before starting this test
*
* @var bool
*/
protected $login = true;
/**
* Did the test create the phpMyAdmin storage database ?
@ -148,7 +155,11 @@ abstract class TestBase extends TestCase
$this->navigateTo('');
$this->webDriver->manage()->window()->maximize();
if (! static::$createDatabase) {
if ($this->login) {
$this->login();
}
if (! $this->createDatabase) {
// Stop here, we where not asked to create a database
return;
}

View File

@ -30,7 +30,6 @@ class TrackingTest extends TestBase
. 'INSERT INTO `test_table` (val) VALUES (2), (3);'
);
$this->login();
$this->skipIfNotPMADB();
$this->navigateDatabase($this->databaseName);

View File

@ -14,13 +14,7 @@ class XssTest extends TestBase
*
* @var bool
*/
protected static $createDatabase = false;
protected function setUp(): void
{
parent::setUp();
$this->login();
}
protected $createDatabase = false;
/**
* Tests the SQL query tab with a null query