Missing class import via use statement (line '27', column '21'). Open
$fieldRoId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- 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 '26', column '19'). Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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 '63', column '15'). Open
return (new \App\Db\Query())->select(['tabid', 'related_tabid', 'relation_id'])->from('vtiger_relatedlists')->all();
- 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 '159', column '19'). Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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 '44', column '23'). Open
$fieldColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'vat_id'])->scalar();
- 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 '45', column '25'). Open
$fieldRoColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, true), 'Expected read perms(ids)');
- 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\Field' in method 'testGetRelatedFieldForModulePair'. Open
$result0 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), \App\Module::getModuleName($forModuleId));
- 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\Module' in method 'testGetRelatedFieldForModulePair'. Open
$result2 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), false);
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids)');
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids, cached)');
- 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\Module' in method 'testGetRelatedFieldForModulePair'. Open
$result1 = \App\Field::getRelatedFieldForModule(false, \App\Module::getModuleName($forModuleId));
- 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\Field' in method 'testGetRelatedFieldForModulePair'. Open
$result2 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), false);
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids, cached)');
- 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\Module' in method 'testGetRelatedFieldForModulePair'. Open
$result0 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), \App\Module::getModuleName($forModuleId));
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', true), 'Expected read perms(strings)');
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertTrue(\App\Field::getColumnPermission('Leads', $fieldColumn, true), 'Expected read perms(string)');
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertTrue(\App\Field::getFieldPermission($moduleId, $fieldId, false), 'Expected write perms(ids)');
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', true), 'Expected no read perms(field not exists)');
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', false), 'Expected no write perms(field not exists)');
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', false), 'Expected write perms(field not exists)');
- 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\Module' in method 'testGetRelatedFieldForModulePair'. Open
$result0 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), \App\Module::getModuleName($forModuleId));
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings,cached)');
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertTrue(\App\Field::getFieldPermission($moduleId, $fieldId, true), 'Expected read perms(ids)');
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, $fieldRoId, false), 'Expected no write perms(ids)');
- 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\Field' in method 'testGetRelatedFieldForModulePair'. Open
$result1 = \App\Field::getRelatedFieldForModule(false, \App\Module::getModuleName($forModuleId));
- 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\Module' in method 'testGetFieldPermission'. Open
$moduleId = \App\Module::getModuleId('Leads');
- 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\Field' in method 'testGetFieldPermission'. Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings)');
- 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\Module' in method 'testGetColumnPermission'. Open
$moduleId = \App\Module::getModuleId('Leads');
- 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\Field' in method 'testGetRelatedFieldForSpecificModulePairs'. Open
$result = \App\Field::getRelatedFieldForModule($moduleName, $forModuleName);
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids)');
- 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\Field' in method 'testGetColumnPermission'. Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', true), 'Expected no read perms(field not exists)');
- 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\Field' in method 'testGetRelatedFieldForModuleAll'. Open
$this->assertNotEmpty(\App\Field::getRelatedFieldForModule(), 'All relations list should be not empty');
- 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\Field' in method 'testGetFieldsFromRelation'. Open
$result = \App\Field::getFieldsFromRelation($relationId);
- 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\Field' in method 'testGetFieldInfo'. Open
$fieldInfo = \App\Field::getFieldInfo($fieldId);
- 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\Field' in method 'testGetFieldInfo'. Open
$fieldInfoByName = \App\Field::getFieldInfo('email', $moduleId);
- 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\Field' in method 'testGetFieldsFromEmptyRelation'. Open
$result = \App\Field::getFieldsFromRelation('');
- 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\Field' in method 'testGetFieldInfo'. Open
$this->assertSame($fieldInfo, \App\Field::getFieldInfo($fieldId), 'Field info from cache should be same as reference');
- 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\Field' in method 'testGetFieldsFromRelation'. Open
$this->assertSame($result, \App\Field::getFieldsFromRelation($relationId), 'Relation fields from cache should be equal as reference for relation: ' . $relationId);
- 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\Module' in method 'testGetRelatedFieldForSpecificModulePairs'. Open
$this->assertSame(\App\Module::getModuleId($moduleName), $result['tabid'], 'Expected tabid differs from reference');
- 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\Module' in method 'testGetFieldInfo'. Open
$moduleId = \App\Module::getModuleId('Leads');
- 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 "Leads" 7 times. Open
$moduleId = \App\Module::getModuleId('Leads');
- 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 "Relation list should be array type" 4 times. Open
$this->assertIsArray($result0, 'Relation list should be array type');
- 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 "fieldid" 5 times. Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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_field" 5 times. Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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 "tabid" 9 times. Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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 "fieldname" 5 times. Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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 "email" 6 times. Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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.
Avoid unused parameters such as '$relationId'. Open
public function testGetRelatedFieldForModulePair($forModuleId, $moduleId, $relationId)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$moduleId'. Open
public function testGetFieldsFromRelation($forModuleId, $moduleId, $relationId)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$forModuleId'. Open
public function testGetFieldsFromRelation($forModuleId, $moduleId, $relationId)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', false), 'Expected no write perms(field not exists)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertNotEmpty
Open
$this->assertNotEmpty(\App\Field::getRelatedFieldForModule(), 'All relations list should be not empty');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame($fieldInfo, \App\Field::getFieldInfo($fieldId), 'Field info from cache should be same as reference');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- Exclude checks
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, $fieldRoId, false), 'Expected no write perms(ids)');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
return (new \App\Db\Query())->select(['tabid', 'related_tabid', 'relation_id'])->from('vtiger_relatedlists')->all();
- Exclude checks
Call to undeclared method \Tests\App\Field::assertNotEmpty
Open
$this->assertNotEmpty($fieldInfo, 'Field info should be not empty');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertNotEmpty
Open
$this->assertNotEmpty($result, 'Relation data should be not empty');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($fieldInfo, 'Expected field info array');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', true), 'Expected read perms(strings)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings,cached)');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'vat_id'])->scalar();
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getColumnPermission('Leads', $fieldColumn, true), 'Expected read perms(string)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($result2, 'Relation list should be array type');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', false), 'Expected write perms(field not exists)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($result, 'Expected result type array for empty relation');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame(\App\Module::getModuleId($moduleName), $result['tabid'], 'Expected tabid differs from reference');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame($moduleId, $fieldInfoByName['tabid'], 'Expected moduleid in fieldinfo same as reference');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids, cached)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($result1, 'Relation list should be array type');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertEmpty
Open
$this->assertEmpty($result, 'Fields array from empty relation should be empty');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame($fieldId, $fieldInfo['fieldid'], 'Expected fieldid in fieldinfo same as reference');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($fieldInfoByName, 'Expected field info array');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings)');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldRoColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- Exclude checks
Expected @param annotation for moduleId
to be before the @param annotation for relationId
Open
* @param int $relationId
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame($result, \App\Field::getFieldsFromRelation($relationId), 'Relation fields from cache should be equal as reference for relation: ' . $relationId);
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getFieldPermission($moduleId, $fieldId, false), 'Expected write perms(ids)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', true), 'Expected no read perms(field not exists)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($result0, 'Relation list should be array type');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$fieldRoId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getFieldPermission($moduleId, $fieldId, true), 'Expected read perms(ids)');
- Exclude checks
Argument 1 (relationId)
is ''
but \App\Field::getFieldsFromRelation()
takes int
defined at /code/app/Field.php:297
Open
$result = \App\Field::getFieldsFromRelation('');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame($fieldId, $fieldInfoByName['fieldid'], 'Expected fieldid in fieldinfo same as reference');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids, cached)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($result, 'Expected result type array for relation: ' . $relationId);
- Exclude checks
Call to undeclared method \Tests\App\Field::assertTrue
Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, true), 'Expected read perms(ids)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertFalse
Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', true), 'Expected no read perms(field not exists)');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertIsArray
Open
$this->assertIsArray($result, 'Relation list should be array type');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertSame
Open
$this->assertSame($moduleId, $fieldInfo['tabid'], 'Expected moduleid in fieldinfo same as reference');
- Exclude checks
Call to undeclared method \Tests\App\Field::assertNotEmpty
Open
$this->assertNotEmpty($fieldInfoByName, 'Field info should be not empty');
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getFieldPermission function.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getFieldPermission($moduleId, $fieldId, true), 'Expected read perms(ids)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getFieldPermission($moduleId, $fieldId, false), 'Expected write perms(ids)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', true), 'Expected no read perms(field not exists)');
- 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
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- 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->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings,cached)');
- 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 124 characters Open
$this->assertSame(\App\Module::getModuleId($moduleName), $result['tabid'], 'Expected tabid differs from reference');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getRelatedFieldForModule without params.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $relationId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = \App\Field::getFieldsFromRelation($relationId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, $fieldRoId, false), 'Expected no write perms(ids)');
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', false), 'Expected no write perms(field not exists)');
- 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
$fieldColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'vat_id'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids, cached)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, $fieldRoId, false), 'Expected no write perms(ids)');
- 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 mixed $moduleId
- 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($result, \App\Field::getFieldsFromRelation($relationId), 'Relation fields from cache should be equal as reference for relation: ' . $relationId);
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
$this->assertSame($result, \App\Field::getFieldsFromRelation($relationId), 'Relation fields from cache should be equal as reference for relation: ' . $relationId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Leads');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', false), 'Expected write perms(strings,cached)');
- 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 testGetRelatedFieldForModulePair($forModuleId, $moduleId, $relationId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsArray($result1, 'Relation list should be array type');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Relations modules list provider.
- 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 mixed $forModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = \App\Field::getRelatedFieldForModule($moduleName, $forModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsArray($result, 'Relation list should be array type');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty($fieldInfoByName, 'Field info should be not empty');
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', true), 'Expected no read perms(field not exists)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['DataSetRegister', 'IncidentRegister'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty(\App\Field::getRelatedFieldForModule(), 'All relations list should be not empty');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleId
- 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
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$this->assertSame($fieldInfo, \App\Field::getFieldInfo($fieldId), 'Field info from cache should be same as reference');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInfoByName = \App\Field::getFieldInfo('email', $moduleId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($moduleId, $fieldInfoByName['tabid'], 'Expected moduleid in fieldinfo same as reference');
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', true), 'Expected no read perms(field not exists)');
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetFieldPermission()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Leads');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldRoId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(\App\Field::getFieldPermission($moduleId, 'NxField', false), 'Expected no write perms(field not exists)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getColumnPermission function.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetColumnPermission()
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$fieldColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'vat_id'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids, cached)');
- 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
* @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
* @param mixed $forModuleId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = \App\Field::getFieldsFromRelation('');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsArray($fieldInfoByName, 'Expected field info 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
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleName
- 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
public function testGetFieldInfo()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsArray($fieldInfo, 'Expected field info array');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getRelatedFieldForModule function with params from vtiger_relatedlist table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetRelatedFieldForModuleAll()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider relationsProvider
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$fieldRoId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getFieldPermission('Leads', 'email', true), 'Expected read perms(strings)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids, cached)');
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids, cached)');
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
return (new \App\Db\Query())->select(['tabid', 'related_tabid', 'relation_id'])->from('vtiger_relatedlists')->all();
- 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
public function testGetFieldsFromRelation($forModuleId, $moduleId, $relationId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($moduleId, $fieldInfo['tabid'], 'Expected moduleid in fieldinfo same as reference');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldRoColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, $fieldRoColumn, false), 'Expected no write perms(ids)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', true), 'Expected no read perms(field not exists)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $forModuleId
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$result0 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), \App\Module::getModuleName($forModuleId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertNotEmpty($result, 'Relation data should be not empty');
- 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
* Testing getFieldsFromRelation for empty relation id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, true), 'Expected read perms(ids)');
- 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
/**
- 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 testGetFieldsFromEmptyRelation()
- 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
* Relations modules ids provider.
- 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->assertIsArray($result0, 'Relation list should be array type');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result1 = \App\Field::getRelatedFieldForModule(false, \App\Module::getModuleName($forModuleId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsArray($result2, 'Relation list should be array type');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider relationSelectedModulesProvider
- 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->assertEmpty($result, 'Fields array from empty relation should be empty');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getFieldInfo.
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$fieldRoColumn = (new \App\Db\Query())->select(['columnname'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'smcreatorid'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertTrue(\App\Field::getColumnPermission('Leads', $fieldColumn, true), 'Expected read perms(string)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new \App\Db\Query())->select(['tabid', 'related_tabid', 'relation_id'])->from('vtiger_relatedlists')->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Leads');
- 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(\App\Field::getColumnPermission($moduleId, 'NxColumn', false), 'Expected write perms(field not exists)');
- 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
$result0 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), \App\Module::getModuleName($forModuleId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result2 = \App\Field::getRelatedFieldForModule(\App\Module::getModuleName($moduleId), false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $relationId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function relationSelectedModulesProvider()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['FInvoice', 'FCorectingInvoice'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['DataSetRegister', 'AuditRegister'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame(\App\Module::getModuleId($moduleName), $result['tabid'], 'Expected tabid differs from reference');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getFieldsFromRelation.
- 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->assertNotEmpty($fieldInfo, 'Field info should be not empty');
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$fieldId = (new \App\Db\Query())->select(['fieldid'])->from('vtiger_field')->where(['tabid' => $moduleId, 'fieldname' => 'email'])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($fieldInfo, \App\Field::getFieldInfo($fieldId), 'Field info from cache should be same as reference');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldInfo = \App\Field::getFieldInfo($fieldId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($fieldId, $fieldInfoByName['fieldid'], 'Expected fieldid in fieldinfo same as reference');
- 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->assertTrue(\App\Field::getColumnPermission($moduleId, $fieldColumn, false), 'Expected write perms(ids)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function relationsProvider()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider relationsProvider
- 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
['LocationRegister', 'IncidentRegister'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['LocationRegister', 'AuditRegister'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetRelatedFieldForSpecificModulePairs($forModuleName, $moduleName)
- 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($fieldId, $fieldInfo['fieldid'], 'Expected fieldid in fieldinfo same as reference');
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$this->assertFalse(\App\Field::getColumnPermission($moduleId, 'NxColumn', false), 'Expected write perms(field not exists)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing getRelatedFieldForModule function with params from vtiger_relatedlist table.
- 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->assertIsArray($result, 'Expected result type array for relation: ' . $relationId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertIsArray($result, 'Expected result type array for empty relation');
- Exclude checks