Method testGenerateToken
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testGenerateToken(): void
{
$moduleName = 'Contacts';
$moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
if (!($field = current($moduleModel->getFieldsByType('token', true)))) {
Method testAddConfiguration
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAddConfiguration(): void
{
$app = \Settings_WebserviceApps_Record_Model::getCleanInstance();
$app->set('type', 'ManageConsents');
$app->set('status', 1);
The class ManageConsents has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13. Open
final class ManageConsents extends \Tests\Base
{
use AssertsTrait;
/**
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '84', column '27'). Open
$this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [
- 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 '167', column '15'). Open
$row = (new \App\Db\Query())->from($user->baseTable)->where(['id' => self::$apiUserId])->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 '106', column '17'). Open
$field = new \vtlib\Field();
- 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 '\Vtiger_Record_Model' in method 'testGenerateToken'. Open
$recordModel = \Vtiger_Record_Model::getCleanInstance('Contacts');
- 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\Json' in method 'testRecordsList'. Open
$response = \App\Json::decode($body);
- 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\Fields\ServerAccess' in method 'testAddConfiguration'. Open
$row = \App\Fields\ServerAccess::get(self::$serverId);
- 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_WebserviceUsers_Record_Model' in method 'testAddConfiguration'. Open
$user = \Settings_WebserviceUsers_Record_Model::getCleanInstance('ManageConsents');
- 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\Json' in method 'testAddConsent'. Open
$response = \App\Json::decode($body);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Record_Model' in method 'setUpBeforeClass'. Open
$recordModel = \Vtiger_Record_Model::getCleanInstance('Approvals');
- 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\Utils' in method 'testAddConsent'. Open
$request = $this->httpClient->post('ApprovalsRegister/Record', \App\Utils::merge(['json' => [
'subject' => 'Text',
'approvalsid' => self::$approvalId,
'contactid' => self::$recordId,
'approvals_register_type' => 'PLL_ACCEPTANCE',
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '104', column '9'). Open
public function testGenerateToken(): void
{
$moduleName = 'Contacts';
$moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
if (!($field = current($moduleModel->getFieldsByType('token', true)))) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\Settings_WebserviceApps_Record_Model' in method 'testAddConfiguration'. Open
$app = \Settings_WebserviceApps_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 '\Vtiger_Record_Model' in method 'testGetConsents'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById(self::$recordId);
- 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\RequestHttp' in method 'setUp'. Open
$this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [
- 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\Utils' in method 'setUp'. Open
$this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [
'base_uri' => \App\Config::main('site_URL') . 'webservice/ManageConsents/',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'timeout' => 60,
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Module_Model' in method 'testGenerateToken'. Open
$moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
- 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\Fields\Token' in method 'testGenerateToken'. Open
\App\Fields\Token::setTokens($field->name, $moduleName);
- 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 '\ApprovalsRegister_Module_Model' in method 'testAddConsent'. Open
\ApprovalsRegister_Module_Model::reloadApprovals(self::$recordId);
- 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\User' in method 'testGenerateToken'. Open
$recordModel->set('assigned_user_id', \App\User::getCurrentUserId());
- 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\Utils' in method 'testGetConsents'. Open
$request = $this->httpClient->post('Contacts/GetConsentsForEntry', \App\Utils::merge(['json' => [
'token' => $recordModel->get('token'),
]], self::$requestOptions));
- 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\User' in method 'setUpBeforeClass'. Open
$recordModel->set('assigned_user_id', \App\User::getCurrentUserId());
- 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\Config' in method 'setUp'. Open
'base_uri' => \App\Config::main('site_URL') . 'webservice/ManageConsents/',
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Record_Model' in method 'testGenerateToken'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById(self::$recordId);
- 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\User' in method 'testAddConfiguration'. Open
$user->set('user_id', \App\User::getActiveAdminId());
- 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\Json' in method 'testGetConsents'. Open
$response = \App\Json::decode($body);
- 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 "headers" 3 times. Open
'headers' => [
- 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 "token" 10 times. Open
if (!($field = current($moduleModel->getFieldsByType('token', true)))) {
- 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 "result" 6 times. Open
static::assertNotEmpty($response['result'], 'Approvals/RecordsList result is empty and should have at least one entry: ' . self::$approvalId);
- 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 "ManageConsents" 3 times. Open
$app->set('type', 'ManageConsents');
- 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 "status" 6 times. Open
$app->set('status', 1);
- 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 method get
from undeclared class \GuzzleHttp\Client
Open
$request = $this->httpClient->get('Approvals/RecordsList', self::$requestOptions);
- Exclude checks
Call to method reloadApprovals
from undeclared class \ApprovalsRegister_Module_Model
Open
\ApprovalsRegister_Module_Model::reloadApprovals(self::$recordId);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame($approvalField->getUITypeModel()->getArrayValues($recordModel->get($approvalField->getName())), $response['result']['consents'], 'Contacts/GetConsentsForEntry record should be the same: (array) ' . self::$approvalId);
- Exclude checks
Call to method __construct
from undeclared class \FR3D\SwaggerAssertions\SchemaManager
Open
self::$schemaManager = new SchemaManager(json_decode(file_get_contents(ROOT_DIRECTORY . \App\Installer\Developer::PATH . '/ManageConsents.json')));
- Exclude checks
Assigning int
to property but \Tests\Integrations\ManageConsents::$recordId
is array
Open
self::$recordId = $recordModel->getId();
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(1, $response['status'], 'ApprovalsRegister/Record API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(1, $response['status'], 'Contacts/GetConsentsForEntry API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Assigning 64
to property but \vtlib\Field->maximumlength
is string
Open
$field->maximumlength = \Vtiger_Token_UIType::MAX_LENGTH;
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame($row['status'], 1);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertResponseBodyMatch
Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/Approvals/RecordsList', 'get', 200);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(self::$recordId, $response['result']['id'], 'Contacts/GetConsentsForEntry record should be the same: ' . self::$recordId);
- Exclude checks
Assigning 'varchar\x2864\x29'
to property but \vtlib\Field->columntype
is false
Open
$field->columntype = 'varchar(' . \Vtiger_Token_UIType::MAX_LENGTH . ')';
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotFalse
Open
static::assertNotFalse($row, 'No record id: ' . self::$apiUserId);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotEmpty
Open
static::assertNotEmpty($response['result']['id'], 'ApprovalsRegister/Record record should not be empty');
- Exclude checks
Call to undeclared method \Vtiger_Base_UIType::getArrayValues
Open
static::assertSame($approvalField->getUITypeModel()->getArrayValues($recordModel->get($approvalField->getName())), $response['result']['consents'], 'Contacts/GetConsentsForEntry record should be the same: (array) ' . self::$approvalId);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($user->baseTable)->where(['id' => self::$apiUserId])->one();
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(1, $response['status'], 'Approvals/RecordsList API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Property \Tests\Integrations\ManageConsents::$schemaManager
has undeclared type \FR3D\SwaggerAssertions\SchemaManager
Open
protected static $schemaManager;
- Exclude checks
Call to method getActiveAdminId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user->set('user_id', \App\User::getActiveAdminId());
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertResponseBodyMatch
Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/ApprovalsRegister/Record', 'post', 200);
- Exclude checks
array to string
conversion Open
static::assertSame(self::$recordId, $response['result']['id'], 'Contacts/GetConsentsForEntry record should be the same: ' . self::$recordId);
- Exclude checks
Call to method post
from undeclared class \GuzzleHttp\Client
Open
$request = $this->httpClient->post('ApprovalsRegister/Record', \App\Utils::merge(['json' => [
- Exclude checks
Argument 1 (recordId)
is array
but \Vtiger_Record_Model::getInstanceById()
takes int
defined at /code/modules/Vtiger/models/Record.php:763
Open
$recordModel = \Vtiger_Record_Model::getInstanceById(self::$recordId);
- Exclude checks
Call to method __construct
from undeclared class \GuzzleHttp\Client
Open
$this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotEmpty
Open
static::assertNotEmpty($recordModel->get('token'), 'Token should not be empty for field: ' . $field->name);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotFalse
Open
static::assertNotFalse($row, 'No record id: ' . self::$serverId);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(200, $request->getStatusCode(), 'Approvals/RecordsList API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotEmpty
Open
static::assertNotEmpty($response['result'], 'Approvals/RecordsList result is empty and should have at least one entry: ' . self::$approvalId);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotEmpty
Open
static::assertNotEmpty($response['result'], 'ApprovalsRegister/Record result is empty and should have at least one entry.');
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame($row['name'], $app->get('name'));
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertNotEmpty
Open
static::assertNotEmpty($response['result']['records'][self::$approvalId], 'Approvals/RecordsList record:' . self::$approvalId . ' not exists');
- Exclude checks
Class uses undeclared trait \FR3D\SwaggerAssertions\PhpUnit\AssertsTrait
Open
final class ManageConsents extends \Tests\Base
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame($row['type'], 'ManageConsents');
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame((int) $row['server_id'], self::$serverId);
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame($row['token'], $user->get('token'));
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(200, $request->getStatusCode(), 'Contacts/GetConsentsForEntry error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$recordModel->set('assigned_user_id', \App\User::getCurrentUserId());
- Exclude checks
Argument 1 (recordId)
is array
but \Vtiger_Record_Model::getInstanceById()
takes int
defined at /code/modules/Vtiger/models/Record.php:763
Open
$recordModel = \Vtiger_Record_Model::getInstanceById(self::$recordId);
- Exclude checks
Assigning 'token'
to property but \vtlib\Field->column
is false
Open
$field->column = 'token';
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame($row['pass'], $app->get('pass'));
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertSame
Open
static::assertSame(200, $request->getStatusCode(), 'ApprovalsRegister/RecordAPI error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Property \Tests\Integrations\ManageConsents->httpClient
has undeclared type \GuzzleHttp\Client
Open
protected $httpClient;
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$recordModel->set('assigned_user_id', \App\User::getCurrentUserId());
- Exclude checks
Call to method post
from undeclared class \GuzzleHttp\Client
Open
$request = $this->httpClient->post('Contacts/GetConsentsForEntry', \App\Utils::merge(['json' => [
- Exclude checks
Static call to undeclared method \Tests\Integrations\ManageConsents::assertResponseBodyMatch
Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/Contacts/GetConsentsForEntry', 'post', 200);
- 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
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $requestOptions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $approvalId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getCleanInstance('Approvals');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('approvals_status', 'PLL_ACTIVE');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$requestOptions['headers']['x-api-key'] = $row['api_key'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame($row['token'], $user->get('token'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing RecordsList.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$request = $this->httpClient->get('Approvals/RecordsList', self::$requestOptions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = \App\Json::decode($body);
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
static::assertSame(200, $request->getStatusCode(), 'ApprovalsRegister/RecordAPI error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(1, $response['status'], 'ApprovalsRegister/Record API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'token' => $recordModel->get('token'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/Contacts/GetConsentsForEntry', 'post', 200);
- 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
$recordModel->set('assigned_user_id', \App\User::getCurrentUserId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('type', \Api\WebservicePremium\Privilege::USER_PERMISSIONS);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets the list of consents for specific entry.
- 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
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$schemaManager = new SchemaManager(json_decode(file_get_contents(ROOT_DIRECTORY . \App\Installer\Developer::PATH . '/ManageConsents.json')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$approvalId = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->column = 'token';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing add configuration.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame($row['type'], 'ManageConsents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
static::assertNotEmpty($response['result'], 'ApprovalsRegister/Record result is empty and should have at least one entry.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/ApprovalsRegister/Record', 'post', 200);
- 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
static::assertSame($approvalField->getUITypeModel()->getArrayValues($recordModel->get($approvalField->getName())), $response['result']['consents'], 'Contacts/GetConsentsForEntry record should be the same: (array) ' . self::$approvalId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Api server 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
* @var SchemaManager
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'connect_timeout' => 60,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance = current($moduleModel->getBlocks());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->columntype = 'varchar(' . \Vtiger_Token_UIType::MAX_LENGTH . ')';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->uitype = 324;
- 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
$app->set('url', '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$app->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('user_id', \App\User::getActiveAdminId());
- 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
static::assertNotEmpty($response['result'], 'ApprovalsRegister/Record result is empty and should have at least one entry.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\ApprovalsRegister_Module_Model::reloadApprovals(self::$recordId);
- 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
* Api user id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->displaytype = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('salutationtype', 'Mr.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$requestOptions['headers']['x-token'] = $user->get('token');
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
static::assertNotEmpty($response['result'], 'Approvals/RecordsList result is empty and should have at least one entry: ' . self::$approvalId);
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
static::assertNotEmpty($response['result']['records'][self::$approvalId], 'Approvals/RecordsList record:' . self::$approvalId . ' not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/Approvals/RecordsList', 'get', 200);
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/ApprovalsRegister/Record', 'post', 200);
- 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
'timeout' => 60,
- 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 testGenerateToken(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = 'Contacts';
- 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
$request = $this->httpClient->post('ApprovalsRegister/Record', \App\Utils::merge(['json' => [
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
static::assertSame(1, $response['status'], 'ApprovalsRegister/Record API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Line exceeds 120 characters; contains 244 characters Open
static::assertSame($approvalField->getUITypeModel()->getArrayValues($recordModel->get($approvalField->getName())), $response['result']['consents'], 'Contacts/GetConsentsForEntry record should be the same: (array) ' . self::$approvalId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $apiUserId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('assigned_user_id', \App\User::getCurrentUserId());
- 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
'Accept' => 'application/json',
- 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
$field->table = $moduleModel->tableName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotEmpty($recordModel->get('token'), 'Token should not be empty for field: ' . $field->name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame($row['name'], $app->get('name'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$requestOptions['auth'] = [$app->get('name'), $app->get('pass')];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(1, $response['status'], 'Approvals/RecordsList API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddConsent(): void
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
static::assertSame(200, $request->getStatusCode(), 'Contacts/GetConsentsForEntry error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(1, $response['status'], 'Contacts/GetConsentsForEntry API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- 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
protected $httpClient;
- 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
$recordModel->set('email', 'manage_consents@yetiforce.com');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = \App\Fields\ServerAccess::get(self::$serverId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame($row['pass'], $app->get('pass'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$apiUserId = $user->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
$this->logs = $body = $request->getBody()->getContents();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'contactid' => self::$recordId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = \App\Json::decode($body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(self::$recordId, $response['result']['id'], 'Contacts/GetConsentsForEntry record should be the same: ' . self::$recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
use AssertsTrait;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- 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->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base_uri' => \App\Config::main('site_URL') . 'webservice/ManageConsents/',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->name = 'token';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->maximumlength = \Vtiger_Token_UIType::MAX_LENGTH;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->typeofdata = 'V~O';
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/Approvals/RecordsList', 'get', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = \App\Json::decode($body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testGetConsents(): void
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/ManageConsents/Contacts/GetConsentsForEntry', 'post', 200);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Request options.
- 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
protected static $schemaManager;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- 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 generate token.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('firstname', 'Test');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotEmpty($response['result'], 'Approvals/RecordsList result is empty and should have at least one entry: ' . self::$approvalId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'registration_date' => date('Y-m-d H:i:s'),
- 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
* Before a test method is run, this method is invoked.
- 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
$field = new \vtlib\Field();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\Token::setTokens($field->name, $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
$app = \Settings_WebserviceApps_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$app->set('name', 'manage_consents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$app->set('ips', '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame($row['status'], 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame((int) $row['server_id'], self::$serverId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotEmpty($response['result']['records'][self::$approvalId], 'Approvals/RecordsList record:' . self::$approvalId . ' not exists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'approvals_register_type' => 'PLL_ACCEPTANCE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'approvals_register_status' => 'PLL_ACCEPTED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs = $body = $request->getBody()->getContents();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $serverId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $recordId;
- 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
'Content-Type' => 'application/json',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!($field = current($moduleModel->getFieldsByType('token', true)))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockInstance->addField($field);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getCleanInstance('Contacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('lastname', 'Testowy');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('contactstatus', 'Active');
- 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
$recordModel = \Vtiger_Record_Model::getInstanceById(self::$recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->save();
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
static::assertSame(1, $response['status'], 'Approvals/RecordsList API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- 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
'approvalsid' => self::$approvalId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById(self::$recordId);
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
static::assertSame(1, $response['status'], 'Contacts/GetConsentsForEntry API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Record ID.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setUpBeforeClass(): void
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
self::$schemaManager = new SchemaManager(json_decode(file_get_contents(ROOT_DIRECTORY . \App\Installer\Developer::PATH . '/ManageConsents.json')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'headers' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'x-raw-data' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->label = 'token';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field->defaultvalue = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$recordId = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \Settings_WebserviceUsers_Record_Model::getCleanInstance('ManageConsents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('server_id', self::$serverId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(200, $request->getStatusCode(), 'Approvals/RecordsList API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- 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
* @var \GuzzleHttp\Client
- 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
'http_errors' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddConfiguration(): void
- 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
$app->set('pass', 'manage_consents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$serverId = (int) $app->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user->set('status', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($user->baseTable)->where(['id' => self::$apiUserId])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotFalse($row, 'No record id: ' . self::$apiUserId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Adds an consent entry.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subject' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$request = $this->httpClient->post('Contacts/GetConsentsForEntry', \App\Utils::merge(['json' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs = $body = $request->getBody()->getContents();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function setUp(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$app->set('type', 'ManageConsents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotFalse($row, 'No record id: ' . self::$serverId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- 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
$approvalField = current($recordModel->getModule()->getFieldsByType('multiReference', true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]], self::$requestOptions));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(200, $request->getStatusCode(), 'Contacts/GetConsentsForEntry error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- 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
$recordModel->set('name', 'Consent1');
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$app->set('status', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testRecordsList(): void
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
static::assertSame(200, $request->getStatusCode(), 'Approvals/RecordsList API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- 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
]], self::$requestOptions));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertSame(200, $request->getStatusCode(), 'ApprovalsRegister/RecordAPI error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotEmpty($response['result']['id'], 'ApprovalsRegister/Record record should not be empty');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
static::assertSame(self::$recordId, $response['result']['id'], 'Contacts/GetConsentsForEntry record should be the same: ' . self::$recordId);
- Exclude checks