YetiForceCompany/YetiForceCRM

View on GitHub
tests/setup/bootstrap.php

Summary

Maintainability
A
0 mins
Test Coverage

Call to method __construct from undeclared class \Install_InitSchema_Model
Open

    $initSchema = new \Install_InitSchema_Model();
Severity: Critical
Found in tests/setup/bootstrap.php by phan

Call to undeclared method \App\Db\Query::select
Open

$id = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['user_name' => 'demo'])->scalar();
Severity: Critical
Found in tests/setup/bootstrap.php by phan

Call to method initialize from undeclared class \Install_InitSchema_Model
Open

    $initSchema->initialize();
Severity: Critical
Found in tests/setup/bootstrap.php by phan

Call to method setCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

\App\User::setCurrentUserId($id ?: \Users::getActiveAdminId());
Severity: Critical
Found in tests/setup/bootstrap.php by phan

Define a constant instead of duplicating this literal "config_file_info" 3 times.
Open

    $_SESSION['config_file_info']['currency_name'] = 'Poland, Zlotych';
Severity: Critical
Found in tests/setup/bootstrap.php by sonar-php

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

<?php
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    \define('ROOT_DIRECTORY', getcwd());
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    require_once 'include/main/WebUI.php';
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo 'TestData package not available, no sample data to install.' . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $_SESSION['config_file_info']['currency_symbol'] = 'zł';
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $_SESSION['config_file_info']['currency_code'] = 'PLN';
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo 'Coverage driver: PCOV - ' . phpversion('pcov') . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo 'Coverage driver: Xdebug - ' . phpversion('xdebug') . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo 'No mailbox password provided, please set YETI_MAIL_PASS in $_SERVER array' . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    \define('IS_WINDOWS', true);
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $startTime = microtime(true);
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $initSchema = new \Install_InitSchema_Model();
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $initSchema->initialize();
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo 'Skipped test database install ...' . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo 'Installing test database ';
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    echo round(microtime(true) - $startTime, 1) . ' sec.' . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        echo 'Some exceptions occurred in database install queries, verify if database was empty before run.' . PHP_EOL;
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    require_once 'install/models/InitSchema.php';
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    $_SESSION['config_file_info']['currency_name'] = 'Poland, Zlotych';
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    \define('IS_WINDOWS', false);
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    if (!($_SESSION['installation_success'] ?? false)) {
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    putenv('ANSICON=80');
Severity: Minor
Found in tests/setup/bootstrap.php by phpcodesniffer

There are no issues that match your filters.

Category
Status