Method testAddGroups
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAddGroups()
{
$modules = ['4', '7'];
$recordModel = \Settings_Groups_Record_Model::getCleanInstance();
$recordModel->set('groupname', 'Test groups');
Missing class import via use statement (line '54', column '20'). Open
$group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
- 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 '77', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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 '43', column '25'). Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
- 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 '94', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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 '93', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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 '87', column '23'). Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])
- 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 '50', column '26'). Open
$group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
- 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 '82', column '25'). Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])
- 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 '58', column '22'). Open
$group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
- 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 '95', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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 '37', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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 '46', column '23'). Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
- 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 '112', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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
Avoid using static access to class '\Settings_Groups_Record_Model' in method 'testDeleteGroups'. Open
$recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
- 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_Groups_Record_Model' in method 'testAddGroups'. Open
$recordModel = \Settings_Groups_Record_Model::getCleanInstance();
- 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_Groups_Record_Model' in method 'testDeleteGroups'. Open
$transferToOwner = \Settings_Groups_Record_Model::getInstance($transferRecordId);
- 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_Groups_Record_Model' in method 'testEditGroups'. Open
$recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
- 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 'testDeleteGroups'. Open
$transferToOwner = \Users_Record_Model::getInstanceById($transferRecordId, '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
Define a constant instead of duplicating this literal "members" 4 times. Open
$recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1', 'Groups:2', 'Roles:H6', 'RoleAndSubordinates:H34']));
- 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_groups" 3 times. Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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 "description" 4 times. Open
$recordModel->set('description', 'Test description');
- 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 "groupid" 13 times. Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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 "groupname" 4 times. Open
$recordModel->set('groupname', 'Test groups');
- 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 "Record in the database should not exist" 3 times. Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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 "modules" 4 times. Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
- 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\Settings\Groups::assertSame
Open
$this->assertSame($row['description'], 'Test description edit');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($users2Group[0], 1);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(0, array_diff($modules, $modulesFromDb));
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertIsInt
Open
$this->assertIsInt(self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(1, $group2Grouprel);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(1, $users2Group);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($group2Rs[0], 'H34');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(1, $group2Role);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertNotFalse
Open
$this->assertNotFalse($row, 'No record id: ' . self::$id);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Argument 1 (value)
is array{0:'Users:1'}
but \Vtiger_Field_Model::getDBValue()
takes \type
defined at /code/modules/Vtiger/models/Field.php:1357
Open
$recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1']));
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(0, array_diff($modules, $modulesFromDb));
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(1, $users2Group);
- Exclude checks
Argument 1 (value)
is array{0:'7'}
but \Vtiger_Field_Model::getDBValue()
takes \type
defined at /code/modules/Vtiger/models/Field.php:1357
Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($row['groupname'], 'Test groups edit');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($row['groupname'], 'Test groups');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($group2Grouprel[0], 2);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->exists(), 'The record was not removed from the database ID: ' . self::$id);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($users2Group[0], 1);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertCount
Open
$this->assertCount(1, $group2Rs);
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($group2Role[0], 'H6');
- Exclude checks
Call to undeclared method \Tests\Settings\Groups::assertSame
Open
$this->assertSame($row['description'], 'Test description');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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
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
$recordModel = \Settings_Groups_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Group 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
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['description'], 'Test description');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddGroups()
- 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['groupname'], 'Test groups');
- 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
$recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1', 'Groups:2', 'Roles:H6', 'RoleAndSubordinates:H34']));
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])->where(['groupid' => self::$id])->column();
- 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 groups creation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('groupname', 'Test groups');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('description', 'Test description');
- 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
private static $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$id = $recordModel->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
$modules = ['4', '7'];
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
$recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1', 'Groups:2', 'Roles:H6', 'RoleAndSubordinates:H34']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertCount(0, array_diff($modules, $modulesFromDb));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
- 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['groupname'], 'Test groups 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($users2Group[0], 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($group2Role[0], 'H6');
- Exclude checks
Line exceeds 120 characters; contains 181 characters Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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
$this->assertCount(1, $group2Role);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testEditGroups()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('description', 'Test description edit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDeleteGroups()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transferToOwner = \Users_Record_Model::getInstanceById($transferRecordId, 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertCount(0, array_diff($modules, $modulesFromDb));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertCount(1, $users2Group);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2rs')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$group2Grouprel = (new \App\Db\Query())->from('vtiger_group2grouprel')->select(['containsgroupid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($group2Grouprel[0], 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing groups edit.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['description'], 'Test description edit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transferRecordId = 1;
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules = ['7'];
- 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->assertCount(1, $users2Group);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing group deletion.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('members', $recordModel->getFieldInstanceByName('members')->getDBValue(['Users:1']));
- Exclude checks
Line exceeds 120 characters; contains 163 characters Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2role')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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
$recordModel->delete($transferToOwner);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modulesFromDb = (new \App\Db\Query())->from('vtiger_group2modules')->select(['tabid'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => 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
$group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($group2Rs[0], 'H34');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['groupid' => self::$id])->column();
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$group2Rs = (new \App\Db\Query())->from('vtiger_group2rs')->select(['roleandsubid'])->where(['groupid' => self::$id])->column();
- 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
->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$transferToOwner) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertCount(1, $group2Grouprel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('modules', $recordModel->getFieldInstanceByName('modules')->getDBValue($modules));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users2Group = (new \App\Db\Query())->from('vtiger_users2group')->select(['userid'])
- 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
$recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertCount(1, $group2Rs);
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$group2Role = (new \App\Db\Query())->from('vtiger_group2role')->select(['roleid'])->where(['groupid' => self::$id])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_Groups_Record_Model::getInstance(self::$id);
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_group2grouprel')->where(['groupid' => self::$id])->exists(), 'Record in the database should not exist');
- 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
$transferToOwner = \Settings_Groups_Record_Model::getInstance($transferRecordId);
- 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
$recordModel->set('groupname', 'Test groups edit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_groups')->where(['groupid' => self::$id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($users2Group[0], 1);
- Exclude checks