tests/setup/bootstrap.php
Call to method __construct
from undeclared class \Install_InitSchema_Model
Open
Open
$initSchema = new \Install_InitSchema_Model();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
Open
$id = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['user_name' => 'demo'])->scalar();
- Exclude checks
Call to method initialize
from undeclared class \Install_InitSchema_Model
Open
Open
$initSchema->initialize();
- Exclude checks
Call to method setCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
Open
\App\User::setCurrentUserId($id ?: \Users::getActiveAdminId());
- Exclude checks
Define a constant instead of duplicating this literal "config_file_info" 3 times. Open
Open
$_SESSION['config_file_info']['currency_name'] = 'Poland, Zlotych';
- 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.
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 17 and the first side effect is on line 17. Open
Open
<?php
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
\define('ROOT_DIRECTORY', getcwd());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
require_once 'include/main/WebUI.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'TestData package not available, no sample data to install.' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$_SESSION['config_file_info']['currency_symbol'] = 'zł';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$_SESSION['config_file_info']['currency_code'] = 'PLN';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'Coverage driver: PCOV - ' . phpversion('pcov') . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'Coverage driver: Xdebug - ' . phpversion('xdebug') . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'No mailbox password provided, please set YETI_MAIL_PASS in $_SERVER array' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
\define('IS_WINDOWS', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$startTime = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$initSchema = new \Install_InitSchema_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$initSchema->initialize();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'Skipped test database install ...' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'Installing test database ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo round(microtime(true) - $startTime, 1) . ' sec.' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
echo 'Some exceptions occurred in database install queries, verify if database was empty before run.' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
require_once 'install/models/InitSchema.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$_SESSION['config_file_info']['currency_name'] = 'Poland, Zlotych';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
\define('IS_WINDOWS', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!($_SESSION['installation_success'] ?? false)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
putenv('ANSICON=80');
- Exclude checks