The method GuiBase::onNotSuccessfulTest() calls the typical debug function print_r() which is mostly only used during development. Open
\print_r($t);
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
The method GuiBase::onNotSuccessfulTest() calls the typical debug function print_r() which is mostly only used during development. Open
\print_r($this->logs);
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
Function findError
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function findError(): void
{
$source = $this->driver->getPageSource();
if (false !== stripos($source, 'YetiError!!!')) {
// @codeCoverageIgnoreStart
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method findError
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findError(): void
{
$source = $this->driver->getPageSource();
if (false !== stripos($source, 'YetiError!!!')) {
// @codeCoverageIgnoreStart
Missing class import via use statement (line '154', column '15'). Open
throw new \Exception('A JavaScript error has occurred: ' . PHP_EOL . $log);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '141', column '14'). Open
throw new \Exception('Undefined variable found');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '131', column '14'). Open
throw new \Exception('An error has been found');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '136', column '14'). Open
throw new \Exception('An error has been found');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Config' in method 'url'. Open
$this->driver->get(\App\Config::main('site_URL') . $url);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Facebook\WebDriver\WebDriverBy' in method 'login'. Open
$this->driver->findElement(WebDriverBy::tagName('form'))->submit();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Facebook\WebDriver\Remote\RemoteWebDriver' in method 'setUp'. Open
$this->driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities, 60000, 60000);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method onNotSuccessfulTest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo 'No $this->driver';
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Facebook\WebDriver\WebDriverBy' in method 'login'. Open
$this->driver->findElement(WebDriverBy::id('username'))->sendKeys('demo');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'login'. Open
$this->driver->get(\App\Config::main('site_URL') . 'index.php?module=Users&view=Login');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Facebook\WebDriver\Remote\DesiredCapabilities' in method 'setUp'. Open
$capabilities = DesiredCapabilities::chrome();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Facebook\WebDriver\WebDriverBy' in method 'login'. Open
$this->driver->findElement(WebDriverBy::id('password'))->sendKeys(\Tests\Base\A_User::$defaultPassrowd);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define and throw a dedicated exception instead of using a generic one. Open
throw new \Exception('An error has been found');
- Read upRead up
- Exclude checks
If you throw a general exception type, such as ErrorException, RuntimeException, or Exception in a library or framework, it forces consumers to catch all exceptions, including unknown exceptions that they do not know how to handle.
Instead, either throw a subtype that already exists in the Standard PHP Library, or create your own type that derives from Exception.
Noncompliant Code Example
throw new Exception(); // Noncompliant
Compliant Solution
throw new InvalidArgumentException(); // or throw new UnexpectedValueException();
See
- MITRE, CWE-397 - Declaration of Throws for Generic Exception
- CERT, ERR07-J. - Do not throw RuntimeException, Exception, or Throwable
Define and throw a dedicated exception instead of using a generic one. Open
throw new \Exception('An error has been found');
- Read upRead up
- Exclude checks
If you throw a general exception type, such as ErrorException, RuntimeException, or Exception in a library or framework, it forces consumers to catch all exceptions, including unknown exceptions that they do not know how to handle.
Instead, either throw a subtype that already exists in the Standard PHP Library, or create your own type that derives from Exception.
Noncompliant Code Example
throw new Exception(); // Noncompliant
Compliant Solution
throw new InvalidArgumentException(); // or throw new UnexpectedValueException();
See
- MITRE, CWE-397 - Declaration of Throws for Generic Exception
- CERT, ERR07-J. - Do not throw RuntimeException, Exception, or Throwable
Define and throw a dedicated exception instead of using a generic one. Open
throw new \Exception('A JavaScript error has occurred: ' . PHP_EOL . $log);
- Read upRead up
- Exclude checks
If you throw a general exception type, such as ErrorException, RuntimeException, or Exception in a library or framework, it forces consumers to catch all exceptions, including unknown exceptions that they do not know how to handle.
Instead, either throw a subtype that already exists in the Standard PHP Library, or create your own type that derives from Exception.
Noncompliant Code Example
throw new Exception(); // Noncompliant
Compliant Solution
throw new InvalidArgumentException(); // or throw new UnexpectedValueException();
See
- MITRE, CWE-397 - Declaration of Throws for Generic Exception
- CERT, ERR07-J. - Do not throw RuntimeException, Exception, or Throwable
Define and throw a dedicated exception instead of using a generic one. Open
throw new \Exception('Undefined variable found');
- Read upRead up
- Exclude checks
If you throw a general exception type, such as ErrorException, RuntimeException, or Exception in a library or framework, it forces consumers to catch all exceptions, including unknown exceptions that they do not know how to handle.
Instead, either throw a subtype that already exists in the Standard PHP Library, or create your own type that derives from Exception.
Noncompliant Code Example
throw new Exception(); // Noncompliant
Compliant Solution
throw new InvalidArgumentException(); // or throw new UnexpectedValueException();
See
- MITRE, CWE-397 - Declaration of Throws for Generic Exception
- CERT, ERR07-J. - Do not throw RuntimeException, Exception, or Throwable
Define a constant instead of duplicating this literal "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" 3 times. Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method get
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->get(\App\Config::main('site_URL') . 'index.php?module=Users&view=Login');
- Exclude checks
Call to method getCurrentURL
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->getCurrentURL();
- Exclude checks
Call to method takeScreenshot
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->takeScreenshot(ROOT_DIRECTORY . '/cache/logs/selenium_screenshot.png');
- Exclude checks
Call to method getTitle
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->getTitle();
- Exclude checks
Call to method manage
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$browserLogs = $this->driver->manage()->getLog('browser');
- Exclude checks
Call to method tagName
from undeclared class \Facebook\WebDriver\WebDriverBy
Open
$this->driver->findElement(WebDriverBy::tagName('form'))->submit();
- Exclude checks
Call to method getPageSource
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$source = $this->driver->getPageSource();
- Exclude checks
Call to method create
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities, 60000, 60000);
- Exclude checks
Call to method getPageSource
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
file_put_contents(ROOT_DIRECTORY . '/cache/logs/selenium_source.html', $this->driver->getPageSource());
- Exclude checks
Reference to undeclared class \PHPUnit\Framework\TestCase
Open
parent::setUp();
- Exclude checks
Call to method getCurrentURL
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
'url' => $this->driver->getCurrentURL(),
- Exclude checks
Call to method getPageSource
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
'getPageSource' => $this->driver->getPageSource(),
- Exclude checks
Call to method manage
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
print_r($this->driver->manage()->getLog('browser'));
- Exclude checks
Call to method id
from undeclared class \Facebook\WebDriver\WebDriverBy
Open
$this->driver->findElement(WebDriverBy::id('password'))->sendKeys(\Tests\Base\A_User::$defaultPassrowd);
- Exclude checks
Property \Tests\GuiBase->driver
has undeclared type \Facebook\WebDriver\Remote\RemoteWebDriver
Open
protected $driver;
- Exclude checks
Call to method findElement
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->findElement(WebDriverBy::id('username'))->sendKeys('demo');
- Exclude checks
Call to method id
from undeclared class \Facebook\WebDriver\WebDriverBy
Open
$this->driver->findElement(WebDriverBy::id('username'))->sendKeys('demo');
- Exclude checks
Class extends undeclared class \PHPUnit\Framework\TestCase
Open
abstract class GuiBase extends TestCase
- Exclude checks
Call to method findElement
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->findElement(WebDriverBy::id('password'))->sendKeys(\Tests\Base\A_User::$defaultPassrowd);
- Exclude checks
Call to method getCurrentURL
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
'url' => $this->driver->getCurrentURL(),
- Exclude checks
Call to method chrome
from undeclared class \Facebook\WebDriver\Remote\DesiredCapabilities
Open
$capabilities = DesiredCapabilities::chrome();
- Exclude checks
Call to method findElement
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->findElement(WebDriverBy::tagName('form'))->submit();
- Exclude checks
Call to method get
from undeclared class \Facebook\WebDriver\Remote\RemoteWebDriver
Open
$this->driver->get(\App\Config::main('site_URL') . $url);
- Exclude checks
Avoid variables with short names like $t. Configured minimum length is 3. Open
protected function onNotSuccessfulTest(\Throwable $t): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
protected function onNotSuccessfulTest(\Throwable $t): void
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$capabilities->setCapability('chromeOptions', ['args' => ['headless', 'disable-dev-shm-usage', 'no-sandbox']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function login(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $logs;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $driver;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->getCurrentURL();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function setUp(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->isLogin) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null !== $this->driver) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \ReflectionException
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Throwable $t
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($this->logs)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
file_put_contents(ROOT_DIRECTORY . '/cache/logs/selenium_logs.log', print_r($this->logs, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
print_r($t->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'No $this->driver';
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->login();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find error or exceptions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
file_put_contents(ROOT_DIRECTORY . '/cache/logs/selenium_source.html', $this->driver->getPageSource());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->driver)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->findElement(WebDriverBy::id('username'))->sendKeys('demo');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$source = $this->driver->getPageSource();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreEnd
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test' => __METHOD__,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => $this->driver->getCurrentURL(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $url
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test' => __METHOD__,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function findError(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'Browser logs: ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
print_r($this->driver->manage()->getLog('browser'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::setUp();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$capabilities->setCapability('chromeOptions', ['args' => ['headless', 'disable-dev-shm-usage', 'no-sandbox']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($browserLogs as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreEnd
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Not success test.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LOGS:\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'URL: ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Setup test.
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LOGS:\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities, 60000, 60000);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreStart
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('SEVERE' === $value['level']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw $t;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->get(\App\Config::main('site_URL') . 'index.php?module=Users&view=Login');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== stripos($source, 'YetiForceError!!!')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$browserLogs = $this->driver->manage()->getLog('browser');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->isLogin = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== stripos($source, 'YetiError!!!')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Exception('An error has been found');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $isLogin = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->get(\App\Config::main('site_URL') . $url);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'getPageSource' => $this->driver->getPageSource(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreEnd
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\print_r($t);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'Title: ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->getTitle();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing login page display.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @codeCoverageIgnoreStart */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$log = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$log .= "[{$value['level']}] {$value['message']}\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool Is login */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->takeScreenshot(ROOT_DIRECTORY . '/cache/logs/selenium_screenshot.png');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Go to URL.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function url(string $url): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => $this->driver->getCurrentURL(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->findElement(WebDriverBy::tagName('form'))->submit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Exception('Undefined variable found');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var \Facebook\WebDriver\Remote\RemoteWebDriver Web driver. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\print_r($this->logs);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($browserLogs) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreStart
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($log) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'getPageSource' => $source,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var mixed Last logs. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$capabilities = DesiredCapabilities::chrome();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== stripos($source, 'Undefined variable:')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreEnd
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Exception('A JavaScript error has occurred: ' . PHP_EOL . $log);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->driver->findElement(WebDriverBy::id('password'))->sendKeys(\Tests\Base\A_User::$defaultPassrowd);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Exception('An error has been found');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// @codeCoverageIgnoreStart
- Exclude checks