Fix some errors founf by PHPStan and Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
0a1f083990
commit
c8a5cd4065
@ -99,7 +99,7 @@
|
||||
"symfony/finder": "^5.2.3",
|
||||
"symfony/twig-bridge": "^5.2.3",
|
||||
"tecnickcom/tcpdf": "^6.4.1",
|
||||
"vimeo/psalm": "^4.8.0"
|
||||
"vimeo/psalm": "^4.8.1"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
||||
@ -1915,28 +1915,3 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/TrackingTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$element of method PhpMyAdmin\\\\Tests\\\\Selenium\\\\TestBase\\:\\:moveto\\(\\) expects Facebook\\\\WebDriver\\\\Remote\\\\RemoteWebElement, Facebook\\\\WebDriver\\\\WebDriverElement given\\.$#"
|
||||
count: 1
|
||||
path: test/selenium/CreateRemoveUserTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$element of method PhpMyAdmin\\\\Tests\\\\Selenium\\\\TestBase\\:\\:moveto\\(\\) expects Facebook\\\\WebDriver\\\\Remote\\\\RemoteWebElement, Facebook\\\\WebDriver\\\\WebDriverElement given\\.$#"
|
||||
count: 2
|
||||
path: test/selenium/ServerSettingsTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$element of method PhpMyAdmin\\\\Tests\\\\Selenium\\\\TestBase\\:\\:moveto\\(\\) expects Facebook\\\\WebDriver\\\\Remote\\\\RemoteWebElement, Facebook\\\\WebDriver\\\\WebDriverElement given\\.$#"
|
||||
count: 4
|
||||
path: test/selenium/Table/BrowseTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$element of method PhpMyAdmin\\\\Tests\\\\Selenium\\\\TestBase\\:\\:moveto\\(\\) expects Facebook\\\\WebDriver\\\\Remote\\\\RemoteWebElement, Facebook\\\\WebDriver\\\\WebDriverElement given\\.$#"
|
||||
count: 1
|
||||
path: test/selenium/Table/CreateTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$element of method PhpMyAdmin\\\\Tests\\\\Selenium\\\\TestBase\\:\\:moveto\\(\\) expects Facebook\\\\WebDriver\\\\Remote\\\\RemoteWebElement, Facebook\\\\WebDriver\\\\WebDriverElement given\\.$#"
|
||||
count: 1
|
||||
path: test/selenium/TrackingTest.php
|
||||
|
||||
|
||||
@ -2858,52 +2858,9 @@
|
||||
<code>testGetLatestCompatibleVersionWithNewPHPVersion</code>
|
||||
</PossiblyInvalidArgument>
|
||||
</file>
|
||||
<file src="test/selenium/ChangePasswordTest.php">
|
||||
<InternalMethod occurrences="3">
|
||||
<code>toString</code>
|
||||
<code>toString</code>
|
||||
<code>toString</code>
|
||||
</InternalMethod>
|
||||
</file>
|
||||
<file src="test/selenium/CreateRemoveUserTest.php">
|
||||
<ArgumentTypeCoercion occurrences="1">
|
||||
<code>$ele</code>
|
||||
</ArgumentTypeCoercion>
|
||||
</file>
|
||||
<file src="test/selenium/ServerSettingsTest.php">
|
||||
<ArgumentTypeCoercion occurrences="2">
|
||||
<code>$ele</code>
|
||||
<code>$ele</code>
|
||||
</ArgumentTypeCoercion>
|
||||
</file>
|
||||
<file src="test/selenium/Table/BrowseTest.php">
|
||||
<ArgumentTypeCoercion occurrences="4">
|
||||
<code>$ele</code>
|
||||
<code>$ele</code>
|
||||
<code>$elem</code>
|
||||
<code>$element</code>
|
||||
</ArgumentTypeCoercion>
|
||||
</file>
|
||||
<file src="test/selenium/Table/CreateTest.php">
|
||||
<ArgumentTypeCoercion occurrences="1">
|
||||
<code>$ele</code>
|
||||
</ArgumentTypeCoercion>
|
||||
</file>
|
||||
<file src="test/selenium/TestBase.php">
|
||||
<InternalMethod occurrences="1">
|
||||
<code>getName</code>
|
||||
</InternalMethod>
|
||||
<PossiblyFalseOperand occurrences="5">
|
||||
<code>getenv('GITHUB_ACTION')</code>
|
||||
<code>getenv('TESTSUITE_BROWSERSTACK_KEY')</code>
|
||||
<code>getenv('TESTSUITE_BROWSERSTACK_USER')</code>
|
||||
<code>getenv('TESTSUITE_SELENIUM_HOST')</code>
|
||||
<code>getenv('TESTSUITE_SELENIUM_PORT')</code>
|
||||
</PossiblyFalseOperand>
|
||||
</file>
|
||||
<file src="test/selenium/TrackingTest.php">
|
||||
<ArgumentTypeCoercion occurrences="1">
|
||||
<code>$ele</code>
|
||||
</ArgumentTypeCoercion>
|
||||
</file>
|
||||
</files>
|
||||
|
||||
@ -9,6 +9,7 @@ use PhpMyAdmin\ErrorHandler;
|
||||
use PhpMyAdmin\Footer;
|
||||
use PhpMyAdmin\Header;
|
||||
use PhpMyAdmin\Plugins\Auth\AuthenticationCookie;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Tests\AbstractNetworkTestCase;
|
||||
use ReflectionException;
|
||||
use ReflectionMethod;
|
||||
@ -176,6 +177,9 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase
|
||||
*/
|
||||
public function testAuthError(): void
|
||||
{
|
||||
$_REQUEST = [];
|
||||
Response::getInstance()->setAjax(false);
|
||||
|
||||
$_REQUEST['old_usr'] = '';
|
||||
$GLOBALS['cfg']['LoginCookieRecall'] = true;
|
||||
$GLOBALS['cfg']['blowfish_secret'] = 'secret';
|
||||
|
||||
@ -52,21 +52,21 @@ class ChangePasswordTest extends TestBase
|
||||
$ele = $this->waitForElement('name', 'pma_pw');
|
||||
$this->assertEquals('', $ele->getAttribute('value'));
|
||||
} catch (AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
array_push($this->verificationErrors, $e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
$ele = $this->waitForElement('name', 'pma_pw2');
|
||||
$this->assertEquals('', $ele->getAttribute('value'));
|
||||
} catch (AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
array_push($this->verificationErrors, $e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
$ele = $this->waitForElement('name', 'generated_pw');
|
||||
$this->assertEquals('', $ele->getAttribute('value'));
|
||||
} catch (AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
array_push($this->verificationErrors, $e->getMessage());
|
||||
}
|
||||
|
||||
$this->byId('button_generate_password')->click();
|
||||
|
||||
@ -189,7 +189,7 @@ abstract class TestBase extends TestCase
|
||||
|
||||
private function getBrowserStackCredentials(): string
|
||||
{
|
||||
return getenv('TESTSUITE_BROWSERSTACK_USER') . ':' . getenv('TESTSUITE_BROWSERSTACK_KEY');
|
||||
return (string) getenv('TESTSUITE_BROWSERSTACK_USER') . ':' . (string) getenv('TESTSUITE_BROWSERSTACK_KEY');
|
||||
}
|
||||
|
||||
protected function getTestSuiteUserLogin(): string
|
||||
@ -257,8 +257,8 @@ abstract class TestBase extends TestCase
|
||||
|
||||
if ($this->hasSeleniumConfig()) {
|
||||
return 'http://'
|
||||
. getenv('TESTSUITE_SELENIUM_HOST') . ':'
|
||||
. getenv('TESTSUITE_SELENIUM_PORT') . '/wd/hub';
|
||||
. (string) getenv('TESTSUITE_SELENIUM_HOST') . ':'
|
||||
. (string) getenv('TESTSUITE_SELENIUM_PORT') . '/wd/hub';
|
||||
}
|
||||
|
||||
return '';
|
||||
@ -310,13 +310,15 @@ abstract class TestBase extends TestCase
|
||||
$buildLocal = true;
|
||||
$buildId = 'Manual';
|
||||
$projectName = 'phpMyAdmin';
|
||||
$buildTagEnv = getenv('BUILD_TAG');
|
||||
$githubActionEnv = getenv('GITHUB_ACTION');
|
||||
|
||||
if (getenv('BUILD_TAG')) {
|
||||
$buildId = getenv('BUILD_TAG');
|
||||
if ($buildTagEnv) {
|
||||
$buildId = $buildTagEnv;
|
||||
$buildLocal = false;
|
||||
$projectName = 'phpMyAdmin (Jenkins)';
|
||||
} elseif (getenv('GITHUB_ACTION')) {
|
||||
$buildId = 'github-' . getenv('GITHUB_ACTION');
|
||||
} elseif ($githubActionEnv) {
|
||||
$buildId = 'github-' . $githubActionEnv;
|
||||
$buildLocal = true;
|
||||
$projectName = 'phpMyAdmin (GitHub - Actions)';
|
||||
}
|
||||
@ -536,7 +538,7 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $id The element ID
|
||||
*/
|
||||
public function byId(string $id): WebDriverElement
|
||||
public function byId(string $id): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->findElement(WebDriverBy::id($id));
|
||||
}
|
||||
@ -546,7 +548,7 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $selector The element css selector
|
||||
*/
|
||||
public function byCssSelector(string $selector): WebDriverElement
|
||||
public function byCssSelector(string $selector): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->findElement(WebDriverBy::cssSelector($selector));
|
||||
}
|
||||
@ -556,7 +558,7 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $xpath The xpath
|
||||
*/
|
||||
public function byXPath(string $xpath): WebDriverElement
|
||||
public function byXPath(string $xpath): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->findElement(WebDriverBy::xpath($xpath));
|
||||
}
|
||||
@ -566,7 +568,7 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $linkText The link text
|
||||
*/
|
||||
public function byLinkText(string $linkText): WebDriverElement
|
||||
public function byLinkText(string $linkText): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->findElement(WebDriverBy::linkText($linkText));
|
||||
}
|
||||
@ -592,7 +594,7 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $partialLinkText The partial link text
|
||||
*/
|
||||
public function byPartialLinkText(string $partialLinkText): WebDriverElement
|
||||
public function byPartialLinkText(string $partialLinkText): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->findElement(WebDriverBy::partialLinkText($partialLinkText));
|
||||
}
|
||||
@ -610,7 +612,7 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $name The name
|
||||
*/
|
||||
public function byName(string $name): WebDriverElement
|
||||
public function byName(string $name): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->findElement(WebDriverBy::name($name));
|
||||
}
|
||||
@ -764,10 +766,8 @@ abstract class TestBase extends TestCase
|
||||
*
|
||||
* @param string $func Locate using - cssSelector, xpath, tagName, partialLinkText, linkText, name, id, className
|
||||
* @param string $arg Selector
|
||||
*
|
||||
* @return WebDriverElement Element waited for
|
||||
*/
|
||||
public function waitForElement(string $func, string $arg): WebDriverElement
|
||||
public function waitForElement(string $func, string $arg): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->wait(30, 500)->until(
|
||||
WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::$func($arg))
|
||||
@ -781,7 +781,7 @@ abstract class TestBase extends TestCase
|
||||
* @param string $arg Selector
|
||||
* @param int $timeout Timeout in seconds
|
||||
*/
|
||||
public function waitUntilElementIsPresent(string $func, string $arg, int $timeout): WebDriverElement
|
||||
public function waitUntilElementIsPresent(string $func, string $arg, int $timeout): RemoteWebElement
|
||||
{
|
||||
return $this->webDriver->wait($timeout, 500)->until(
|
||||
WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::$func($arg))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user