Missing class import via use statement (line '106', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H2');
- 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 '128', column '26'). Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H1');
- 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 '100', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- 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 '139', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- 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 '122', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- 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\User' in method 'createUsersRecord'. Open
if (($userId = \App\User::getUserIdByName($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 '\Vtiger_Record_Model' in method 'createUsersRecord'. Open
$user = \Vtiger_Record_Model::getCleanInstance('Users');
- 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 '\Vtiger_Record_Model' in method 'testAddUser'. Open
$user = \Vtiger_Record_Model::getCleanInstance('Users');
- 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 assigning values to variables in if clauses and the like (line '52', column '8'). Open
public static function createUsersRecord($login = 'demo')
{
if (isset(self::$record[$login])) {
return self::$record[$login];
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\User' in method 'testLoadBaseUser'. Open
\App\User::setCurrentUserId(self::createUsersRecord()->getId());
- 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 '\Settings_Users_Module_Model' in method 'testLocksUser'. Open
$moduleModel = \Settings_Users_Module_Model::getInstance();
- 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 '\Users_Record_Model' in method 'testDeleteUser'. Open
$currentUserModel = \Users_Record_Model::getCurrentUserModel();
- 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 '\Settings_Users_Module_Model' in method 'testDeleteLocksUser'. Open
$moduleModel = \Settings_Users_Module_Model::getInstance();
- 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 '\Vtiger_Record_Model' in method 'createUsersRecord'. Open
self::$record[$login] = \Vtiger_Record_Model::getInstanceById($userId, 'Users');
- 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\Db' in method 'testLoadBaseUser'. Open
$db = \App\Db::getInstance();
- 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 '\Vtiger_Record_Model' in method 'testEditUser'. Open
$user = \Vtiger_Record_Model::getInstanceById(self::$id, 'Users');
- 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 '\Users_Record_Model' in method 'testDeleteUser'. Open
\Users_Record_Model::deleteUserPermanently(self::$id, $currentUserModel->getId());
- 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 a constant instead of duplicating this literal "false" 4 times. Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'big_letters'])->execute();
- 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.
Define a constant instead of duplicating this literal "first_name" 5 times. Open
$user->set('first_name', 'Demo');
- 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.
Define a constant instead of duplicating this literal "testuser" 4 times. Open
$user->set('user_name', 'testuser');
- 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.
Define a constant instead of duplicating this literal "roleid" 5 times. Open
$user->set('roleid', 'H2');
- 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.
Define a constant instead of duplicating this literal "vtiger_password" 5 times. Open
$db->createCommand()->update('vtiger_password', ['val' => 4], ['type' => 'min_length'])->execute();
- 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.
Define a constant instead of duplicating this literal "YetiForce" 3 times. Open
$user->set('last_name', 'YetiForce');
- 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.
Define a constant instead of duplicating this literal "last_name" 5 times. Open
$user->set('last_name', 'YetiForce');
- 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.
Define a constant instead of duplicating this literal "vtiger_users" 3 times. Open
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- 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.
Define a constant instead of duplicating this literal "Users" 4 times. Open
self::$record[$login] = \Vtiger_Record_Model::getInstanceById($userId, 'Users');
- 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.
Define a constant instead of duplicating this literal "email1" 5 times. Open
$user->set('email1', "{$login}@yetiforce.com");
- 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.
Define a constant instead of duplicating this literal "user_name" 5 times. Open
$user->set('user_name', $login);
- 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 undeclared method \Tests\Base\A_User::assertNotFalse
Open
$this->assertNotFalse($user, 'No user');
- Exclude checks
Call to method setCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
\App\User::setCurrentUserId(self::createUsersRecord()->getId());
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['last_name'], 'YetiForce');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H2');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'special'])->execute();
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H2');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertIsInt
Open
$this->assertIsInt(self::createUsersRecord()->getId());
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['first_name'], 'Test');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'big_letters'])->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'small_letters'])->execute();
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['email1'], 'testuser@yetiforce.com');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_password', ['val' => 4], ['type' => 'min_length'])->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'numbers'])->execute();
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['user_name'], 'testuseredit');
- Exclude checks
Call to method getUserIdByName
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
if (($userId = \App\User::getUserIdByName($login))) {
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertIsInt
Open
$this->assertIsInt(self::$id);
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['user_name'], 'testuser');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertCount
Open
$this->assertCount(0, $locks, 'Unexpected value in lock array');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['last_name'], 'YetiForce edit');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['first_name'], 'Test edit');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H1');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H1');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame(['H6' => ['copy', 'paste']], $moduleModel->getLocks(), 'Unexpected value in lock array');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertNotNull
Open
$this->assertNotNull($moduleModel, 'Object is null');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertFileExists
Open
$this->assertFileExists('user_privileges/locks.php');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertSame
Open
$this->assertSame($row['email1'], 'testuser-edit@yetiforce.com');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertNotNull
Open
$this->assertNotNull($moduleModel, 'Object is null');
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertFileExists
Open
$this->assertFileExists('user_privileges/locks.php');
- Exclude checks
Argument 1 (data)
is ''
but \Settings_Users_Module_Model::saveLocks()
takes array
defined at /code/modules/Settings/Users/models/Module.php:169
Open
$moduleModel->saveLocks($param);
- Exclude checks
Call to undeclared method \Tests\Base\A_User::assertNotFalse
Open
$this->assertNotFalse($currentUserModel, 'No current user');
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
private static $id;
- 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
The class A_User is not named in CamelCase. Open
class A_User extends \Tests\Base
{
/**
* The default user password.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* User id.
- 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
$user->set('email1', "{$login}@yetiforce.com");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('confirm_password', self::$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
$user->set('last_name', 'YetiForce');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$id = $user->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['last_name'], 'YetiForce edit');
- 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->assertFileExists('user_privileges/locks.php');
- 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
* The default user password.
- 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 \Users_Record_Model
- 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
$user->set('first_name', 'Test');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('confirm_password', 'testuser');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('email1', 'testuser-edit@yetiforce.com');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Users_Record_Model::deleteUserPermanently(self::$id, $currentUserModel->getId());
- 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
$locks = $moduleModel->getLocks();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $defaultPassrowd = 'Demo12345678T';
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['user_name'], 'testuser');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H1');
- 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
$moduleModel->saveLocks($param);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* List of \Users_Record_Model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create/return users module record model with demo user.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($userId = \App\User::getUserIdByName($login))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('user_name', $login);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$record[$login] = $user;
- 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
* Testing user creation.
- 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
$param = [['user' => 'H6', 'locks' => ['copy', 'paste']]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(['H6' => ['copy', 'paste']], $moduleModel->getLocks(), 'Unexpected value in lock array');
- 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
Line exceeds 120 characters; contains 143 characters Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H2');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testEditUser()
- 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
$param = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotNull($moduleModel, 'Object is null');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \Exception
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('roleid', 'H2');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\User::setCurrentUserId(self::createUsersRecord()->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['email1'], 'testuser@yetiforce.com');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('roleid', 'H1');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['email1'], 'testuser-edit@yetiforce.com');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($currentUserModel, 'No current user');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \Vtiger_Record_Model::getCleanInstance('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H2');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('first_name', 'Test edit');
- Exclude checks
Line exceeds 120 characters; contains 175 characters Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- 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->assertFileExists('user_privileges/locks.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel->saveLocks($param);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $login
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$record[$login] = \Vtiger_Record_Model::getInstanceById($userId, 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testLoadBaseUser()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'numbers'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['user_name'], 'testuseredit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('last_name', 'YetiForce');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('user_password', self::$defaultPassrowd);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_password', ['val' => 4], ['type' => 'min_length'])->execute();
- 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
$user->set('user_name', 'testuser');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('last_name', 'YetiForce edit');
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$this->assertSame((new \App\Db\Query())->select(['roleid'])->from('vtiger_user2role')->where(['userid' => self::$id])->scalar(), 'H1');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing user deletion.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertCount(0, $locks, 'Unexpected value in lock array');
- 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
private static $record = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function createUsersRecord($login = 'demo')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'big_letters'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddUser()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('email1', 'testuser@yetiforce.com');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotFalse($user, 'No user');
- 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->assertFalse((new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing locks creation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \Users_Record_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \Vtiger_Record_Model::getCleanInstance('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('user_password', 'testuser');
- 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 testDeleteUser()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Settings_Users_Module_Model::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing locks deletion.
- 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 self::$record[$login];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('roleid', 'H2');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsInt(self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- 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->assertSame($row['first_name'], 'Test edit');
- 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
$currentUserModel = \Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testLocksUser()
- 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 testDeleteLocksUser()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Settings_Users_Module_Model::getInstance();
- 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
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'special'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsInt(self::createUsersRecord()->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['last_name'], 'YetiForce');
- 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
$user = \Vtiger_Record_Model::getInstanceById(self::$id, 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotNull($moduleModel, 'Object is null');
- 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 self::$record[$login];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('is_admin', 'on');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing user edition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('user_name', 'testuseredit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->save();
- 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
$db->createCommand()->update('vtiger_password', ['val' => 'false'], ['type' => 'small_letters'])->execute();
- 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 (isset(self::$record[$login])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('first_name', 'Demo');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing user creation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['first_name'], 'Test');
- 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
$row = (new \App\Db\Query())->from('vtiger_users')->where(['id' => self::$id])->one();
- 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
Class name "A_User" is not in camel caps format Open
class A_User extends \Tests\Base
- Exclude checks