YetiForceCompany/YetiForceCRM

View on GitHub
tests/Integrations/WebserviceStandardTest.php

Summary

Maintainability
C
7 hrs
Test Coverage
A
100%

Method testLogIn2fa has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testLogIn2fa(): void
    {
        $request = $this->httpClient->get('Users/TwoFactorAuth', self::$requestOptions);
        $this->logs = $body = $request->getBody()->getContents();
        $response = \App\Json::decode($body);
Severity: Minor
Found in tests/Integrations/WebserviceStandardTest.php - About 1 hr to fix

    Method testAddConfiguration has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testAddConfiguration(): void
        {
            $app = \Settings_WebserviceApps_Record_Model::getCleanInstance();
            $app->set('type', 'WebserviceStandard');
            $app->set('status', 1);
    Severity: Minor
    Found in tests/Integrations/WebserviceStandardTest.php - About 1 hr to fix

      The class WebserviceStandardTest has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
      Open

      final class WebserviceStandardTest extends \Tests\Base
      {
          use AssertsTrait;
      
          /**

      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 '69', column '27').
      Open

              $this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [

      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 '177', column '21').
      Open

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

      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 '192', column '21').
      Open

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '122', column '15').
      Open

              $row = (new \App\Db\Query())->from('w_#__api_user')->where(['id' => self::$apiUserId])->one();

      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\Encryption' in method 'testAddConfiguration'.
      Open

              static::assertTrue(\App\Encryption::verifyPasswordHash('api', $row['password'], 'WebserviceStandard'));

      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);

      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 'testLogIn2fa'.
      Open

              $request = $this->httpClient->post('Users/TwoFactorAuth', \App\Utils::merge(
                  [
                      'json' => [
                          'methods' => 'TOPO',
                          'secret' => $secretKey,

      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/WebserviceStandard/',
                  'auth' => ['api', 'api'],
                  'Content-Type' => 'application/json',
                  'Accept' => 'application/json',

      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_Field_Model' in method 'testAddConfiguration'.
      Open

              $fieldModel = \Vtiger_Field_Model::init('Accounts', \App\Field::SYSTEM_FIELDS['share_externally']);

      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_WebserviceApps_Record_Model' in method 'testAddConfiguration'.
      Open

              $app = \Settings_WebserviceApps_Record_Model::getCleanInstance();

      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_id' => \App\User::getActiveAdminId(),

      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 'testLogIn'.
      Open

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(
                      [
                          'json' => [
                              'userName' => 'api@yetiforce.com',
                              'password' => 'api',

      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 'testLogIn'.
      Open

              $response = \App\Json::decode($body);

      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 'testLogIn2fa'.
      Open

              $response = \App\Json::decode($body);

      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 'testLogIn2fa'.
      Open

              $response = \App\Json::decode($body);

      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\Encryption' in method 'testAddConfiguration'.
      Open

                  'password' => \App\Encryption::createPasswordHash('api', 'WebserviceStandard'),

      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 'testLogIn2fa'.
      Open

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(
                  [
                      'json' => [
                          'userName' => 'api@yetiforce.com',
                          'password' => 'api',

      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/WebserviceStandard/',

      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('WebserviceStandard');

      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 '\vtlib\Block' in method 'testAddConfiguration'.
      Open

              $blockInstance = \vtlib\Block::getInstance('LBL_ACCOUNT_INFORMATION', 'Accounts');

      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 'testLogIn2fa'.
      Open

              $response = \App\Json::decode($body);

      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 'testLogIn2fa'.
      Open

              $response = \App\Json::decode($body);

      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 'testLogout'.
      Open

              $response = \App\Json::decode($body);

      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(), [

      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 "WebserviceStandard" 5 times.
      Open

              $app->set('type', 'WebserviceStandard');

      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 "/webservice/WebserviceStandard/Users/TwoFactorAuth" 3 times.
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'get', 200);

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "Users/Login API error: " 4 times.
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      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" 5 times.
      Open

              self::$authUserParams = $response['result'];

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "Users/TwoFactorAuth" 3 times.
      Open

              $request = $this->httpClient->get('Users/TwoFactorAuth', self::$requestOptions);

      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 "password" 4 times.
      Open

                  'password' => \App\Encryption::createPasswordHash('api', 'WebserviceStandard'),

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "Users/TwoFactorAuth API error: " 8 times.
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      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.

      Remove this unused "$recordId" private field.
      Open

          private static $recordId;

      If a private field is declared but not used in the program, it can be considered dead code and should therefore be removed. This will improve maintainability because developers will not wonder what the variable is used for.

      Noncompliant Code Example

      class MyClass {
        private $foo = 4;                       //foo is unused
      
        public function compute($a) {
          return $a * 4;
        }
      }
      

      Compliant Solution

      class MyClass {
      
        public function compute($a) {
          return $a * 4;
        }
      }
      

      See

      Define a constant instead of duplicating this literal "headers" 4 times.
      Open

                  'headers' => [

      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" 9 times.
      Open

              $app->set('status', 1);

      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 "api@yetiforce.com" 4 times.
      Open

                  'user_name' => 'api@yetiforce.com',

      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 private fields such as '$recordId'.
      Open

          private static $recordId;

      UnusedPrivateField

      Since: 0.2

      Detects when a private field is declared and/or assigned a value, but not used.

      Example

      class Something
      {
          private static $FOO = 2; // Unused
          private $i = 5; // Unused
          private $j = 6;
          public function addOne()
          {
              return $this->j++;
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

      Property \Tests\Integrations\WebserviceStandardTest::$schemaManager has undeclared type \FR3D\SwaggerAssertions\SchemaManager
      Open

          protected static $schemaManager;

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame($row['type'], 'WebserviceStandard');

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

                  'user_id' => \App\User::getActiveAdminId(),

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

              $row = (new \App\Db\Query())->from('w_#__api_user')->where(['id' => self::$apiUserId])->one();

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Call to method delete from undeclared class \GuzzleHttp\Client
      Open

              $request = $this->httpClient->delete('Users/TwoFactorAuth', self::$requestOptions);

      Call to method verifyPasswordHash from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
      Open

              static::assertTrue(\App\Encryption::verifyPasswordHash('api', $row['password'], 'WebserviceStandard'));

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertTrue
      Open

              static::assertTrue($response['result'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Logout API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertTrue
      Open

              static::assertTrue(\App\Encryption::verifyPasswordHash('api', $row['password'], 'WebserviceStandard'));

      Call to method __construct from undeclared class \PragmaRX\Google2FA\Google2FA
      Open

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Property \Tests\Integrations\WebserviceStandardTest->httpClient has undeclared type \GuzzleHttp\Client
      Open

          protected $httpClient;

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(1, $response['status'], 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertResponseBodyMatch
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Login', 'post', 200);

      Call to method post from undeclared class \GuzzleHttp\Client
      Open

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertNotFalse
      Open

              static::assertNotFalse($row, 'No record id: ' . self::$serverId);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertResponseBodyMatch
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Login', 'post', 200);

      Class uses undeclared trait \FR3D\SwaggerAssertions\PhpUnit\AssertsTrait
      Open

      final class WebserviceStandardTest extends \Tests\Base

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame((int) $row['server_id'], self::$serverId);

      Call to method __construct from undeclared class \PragmaRX\Google2FA\Google2FA
      Open

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame($row['pass'], 'api');

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Call to method post from undeclared class \GuzzleHttp\Client
      Open

              $request = $this->httpClient->post('Users/TwoFactorAuth', \App\Utils::merge(

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Call to method put from undeclared class \GuzzleHttp\Client
      Open

              $request = $this->httpClient->put('Users/Logout', self::$requestOptions);

      Call to method __construct from undeclared class \GuzzleHttp\Client
      Open

              $this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame($row['name'], 'api');

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(1, $response['status'], 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Assigning int to property but \Vtiger_Field_Model->fieldparams is string
      Open

              $fieldModel->fieldparams = self::$serverId;

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame('TOTP', $response['result']['authMethods'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Call to method getCurrentOtp from undeclared class \PragmaRX\Google2FA\Google2FA
      Open

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertResponseBodyMatch
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'delete', 200);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame($row['status'], 1);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame($row['user_name'], 'api@yetiforce.com');

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertResponseBodyMatch
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'get', 200);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertResponseBodyMatch
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'post', 200);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(1, $response['status'], 'Users/Logout API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Call to method createPasswordHash from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
      Open

                  'password' => \App\Encryption::createPasswordHash('api', 'WebserviceStandard'),

      Assigning 'share_externally_api' to property but \Vtiger_Field_Model->column is false
      Open

              $fieldModel->column = $fieldModel->name = 'share_externally_api';

      Call to method post from undeclared class \GuzzleHttp\Client
      Open

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(

      Call to method getCurrentOtp from undeclared class \PragmaRX\Google2FA\Google2FA
      Open

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertResponseBodyMatch
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Logout', 'put', 200);

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertNotFalse
      Open

              static::assertNotFalse($row, 'No record id: ' . self::$apiUserId);

      Call to method get from undeclared class \GuzzleHttp\Client
      Open

              $request = $this->httpClient->get('Users/TwoFactorAuth', self::$requestOptions);

      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 . '/WebserviceStandard.json')));

      Static call to undeclared method \Tests\Integrations\WebserviceStandardTest::assertSame
      Open

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          public function testLogout(): void
          {
              $request = $this->httpClient->put('Users/Logout', self::$requestOptions);
              $this->logs = $body = $request->getBody()->getContents();
              $response = \App\Json::decode($body);
      Severity: Major
      Found in tests/Integrations/WebserviceStandardTest.php and 2 other locations - About 4 hrs to fix
      tests/Integrations/WebservicePremiumTest.php on lines 444..452
      tests/Integrations/WebservicePremiumTest.php on lines 497..505

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 166.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Only one argument is allowed per line in a multi-line function call
      Open

                      ], self::$requestOptions)

      Only one argument is allowed per line in a multi-line function call
      Open

                  ], self::$requestOptions)

      Only one argument is allowed per line in a multi-line function call
      Open

                  ], self::$requestOptions)

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

           */

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

           * @var int

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

              static::assertSame($row['status'], 1);

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

          /**

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

          private static $apiUserId;

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

           *

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

           * @var array

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

                  'base_uri' => \App\Config::main('site_URL') . 'webservice/WebserviceStandard/',

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

              $app = \Settings_WebserviceApps_Record_Model::getCleanInstance();

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

              $app->set('type', 'WebserviceStandard');

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

              $app->save();

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

              static::assertNotFalse($row, 'No record id: ' . self::$serverId);

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

                  'status' => 1,

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

                  'crmid' => 0,

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

              $row = (new \App\Db\Query())->from('w_#__api_user')->where(['id' => self::$apiUserId])->one();

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

              static::assertNotFalse($row, 'No record id: ' . self::$apiUserId);

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

                          ],

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

          protected static $schemaManager;

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

              $app->set('name', 'api');

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

              $row = \App\Fields\ServerAccess::get(self::$serverId);

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

          }

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

          protected $httpClient;

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

          }

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

                  'type' => 1,

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

                  'popupReferenceModule' => 'Contacts',

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

                  'crmid_display' => '',

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

                  'user_id' => \App\User::getActiveAdminId(),

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

          {

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

           * Api server id.

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

           * @var int

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

          private static $serverId;

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

          /**

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

           *

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

          private static $requestOptions = [];

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

          private static $recordId;

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

          {

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

          }

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

           * Testing add configuration.

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

                  'authy_methods' => 'PLL_AUTHY_TOTP',

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

              static::assertSame($row['user_name'], 'api@yetiforce.com');

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

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(

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

              self::$authUserParams = $response['result'];

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

          }

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

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

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

          }

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

          /**

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

           * Request options.

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

           * @var array

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

              $this->httpClient = new \GuzzleHttp\Client(\App\Utils::merge(\App\RequestHttp::getOptions(), [

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

                  'timeout' => 60,

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

                  ],

      Line exceeds 120 characters; contains 132 characters
      Open

              static::assertSame(1, $response['status'], 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

           * Test logon 2fa .

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

                  [

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

                      'json' => [

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

                          'secret' => $secretKey,

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

                      ],

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

                  ], self::$requestOptions)

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

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'post', 200);

      Line exceeds 120 characters; contains 140 characters
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

           * Api user id.

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

           * Details about logged in user.

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

                  'Content-Type' => 'application/json',

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

              $app->set('url', '');

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

              $app->set('pass', 'api');

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

              self::$requestOptions['headers']['x-api-key'] = $row['api_key'];

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

              $user = \Settings_WebserviceUsers_Record_Model::getCleanInstance('WebserviceStandard');

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

              $fieldModel = \Vtiger_Field_Model::init('Accounts', \App\Field::SYSTEM_FIELDS['share_externally']);

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

              );

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

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Line exceeds 120 characters; contains 140 characters
      Open

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

                  [

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

                          'code' => (new \PragmaRX\Google2FA\Google2FA())->getCurrentOtp($secretKey),

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

              $response = \App\Json::decode($body);

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

              $request = $this->httpClient->delete('Users/TwoFactorAuth', self::$requestOptions);

      Line exceeds 120 characters; contains 140 characters
      Open

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              $request = $this->httpClient->put('Users/Logout', self::$requestOptions);

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

              static::assertSame(1, $response['status'], 'Users/Logout API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

           */

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

           */

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

                              'params' => ['language' => 'pl-PL'],

      Line exceeds 120 characters; contains 138 characters
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'post', 200);

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

                  ], self::$requestOptions)

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

              $this->logs = $body = $request->getBody()->getContents();

      Line exceeds 120 characters; contains 130 characters
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Login', 'post', 200);

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

              $response = \App\Json::decode($body);

      Line exceeds 120 characters; contains 140 characters
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'delete', 200);

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

           */

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

           *

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

          /** @var SchemaManager */

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

                  'connect_timeout' => 60,

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

              self::$serverId = (int) $app->getId();

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

              static::assertSame($row['name'], 'api');

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

                  'user_name' => 'api@yetiforce.com',

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

              ]);

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

                      [

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

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

          /**

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

              $request = $this->httpClient->get('Users/TwoFactorAuth', self::$requestOptions);

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

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              $response = \App\Json::decode($body);

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

              static::assertSame(1, $response['status'], 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              $this->logs = $body = $request->getBody()->getContents();

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

           */

      Line exceeds 120 characters; contains 159 characters
      Open

              self::$schemaManager = new SchemaManager(json_decode(file_get_contents(ROOT_DIRECTORY . \App\Installer\Developer::PATH . '/WebserviceStandard.json')));

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

          protected function setUp(): void

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

                  'headers' => [

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

          /**

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

          public function testAddConfiguration(): void

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

                  'server_id' => self::$serverId,

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

              self::$apiUserId = $user->getId();

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

              static::assertSame((int) $row['server_id'], self::$serverId);

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

              $fieldModel->column = $fieldModel->name = 'share_externally_api';

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

              $blockInstance = \vtlib\Block::getInstance('LBL_ACCOUNT_INFORMATION', 'Accounts');

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

              $this->logs = $body = $request->getBody()->getContents();

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

              $response = \App\Json::decode($body);

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

          {

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

              $request = $this->httpClient->post('Users/TwoFactorAuth', \App\Utils::merge(

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

          {

      Line exceeds 120 characters; contains 133 characters
      Open

              static::assertSame(1, $response['status'], 'Users/Logout API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

           *

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

                  'auth' => ['api', 'api'],

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

              ]));

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

              $app->set('status', 1);

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

              $app->set('ips', '');

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

              $user->setData([

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

                  'password' => \App\Encryption::createPasswordHash('api', 'WebserviceStandard'),

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

              $user->save();

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

          public function testLogIn(): void

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

              static::assertSame(1, $response['status'], 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(

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

                      'json' => [

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

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

          use AssertsTrait;

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

          {

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

                  'Accept' => 'application/json',

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

              static::assertSame($row['pass'], 'api');

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

                  'login_method' => 'PLL_PASSWORD',

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

                              'userName' => 'api@yetiforce.com',

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

                      ], self::$requestOptions)

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

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              $secretKey = $response['result']['secretKey'];

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

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

          /**

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

           */

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

           */

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

          /** @var \GuzzleHttp\Client */

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

              $blockInstance->addField($fieldModel);

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

          public static function setUpBeforeClass(): void

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

                              'password' => 'api',

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

              );

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

                  'http_errors' => false,

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

              self::$requestOptions['headers']['x-token'] = self::$authUserParams['token'];

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

          public function testLogIn2fa(): void

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

              static::assertTrue(\App\Encryption::verifyPasswordHash('api', $row['password'], 'WebserviceStandard'));

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

              $response = \App\Json::decode($body);

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

           * Testing login.

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

                          'methods' => 'TOPO',

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

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              self::$authUserParams = $response['result'];

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

              $this->logs = $body = $request->getBody()->getContents();

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

              self::$requestOptions['headers']['x-token'] = self::$authUserParams['token'];

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

              );

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

          }

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

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Login', 'post', 200);

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

          /**

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

              $this->logs = $body = $request->getBody()->getContents();

      Line exceeds 120 characters; contains 148 characters
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

           * Testing Logout.

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

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Logout', 'put', 200);

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

          /**

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

          private static $authUserParams;

      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 . '/WebserviceStandard.json')));

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

          {

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

              static::assertSame($row['type'], 'WebserviceStandard');

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

              $fieldModel->fieldparams = self::$serverId;

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

                          'json' => [

      Line exceeds 120 characters; contains 140 characters
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

                          'password' => 'api',

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

                      ],

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

              static::assertTrue($response['result'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

                      'x-raw-data' => 1,

      Line exceeds 120 characters; contains 130 characters
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Login', 'post', 200);

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

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'get', 200);

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

                          'userName' => 'api@yetiforce.com',

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

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'delete', 200);

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

          public function testLogout(): void

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

              $response = \App\Json::decode($body);

      Line exceeds 120 characters; contains 141 characters
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/Logout API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              $this->logs = $body = $request->getBody()->getContents();

      Line exceeds 120 characters; contains 140 characters
      Open

              static::assertSame(1, $response['status'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Line exceeds 120 characters; contains 148 characters
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Line exceeds 120 characters; contains 130 characters
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Logout', 'put', 200);

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

              static::assertSame('TOTP', $response['result']['authMethods'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Line exceeds 120 characters; contains 160 characters
      Open

              static::assertSame('TOTP', $response['result']['authMethods'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Line exceeds 120 characters; contains 137 characters
      Open

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/TwoFactorAuth', 'get', 200);

      Line exceeds 120 characters; contains 137 characters
      Open

              static::assertTrue($response['result'], 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

           */

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

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Line exceeds 120 characters; contains 132 characters
      Open

              static::assertSame(1, $response['status'], 'Users/Login API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              static::assertSame(200, $request->getStatusCode(), 'Users/Logout API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

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

              self::assertResponseBodyMatch($response, self::$schemaManager, '/webservice/WebserviceStandard/Users/Login', 'post', 200);

      Line exceeds 120 characters; contains 148 characters
      Open

              static::assertSame(200, $request->getStatusCode(), 'Users/TwoFactorAuth API error: ' . PHP_EOL . $request->getReasonPhrase() . '|' . $body);

      Expected 0 spaces before closing bracket; newline found
      Open

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(

      Multi-line function call not indented correctly; expected 8 spaces but found 16
      Open

                      ], self::$requestOptions)

      Closing parenthesis of a multi-line function call must be on a line by itself
      Open

                  ], self::$requestOptions)

      Closing parenthesis of a multi-line function call must be on a line by itself
      Open

                  ], self::$requestOptions)

      Closing parenthesis of a multi-line function call must be on a line by itself
      Open

                      ], self::$requestOptions)

      Expected 0 spaces before closing bracket; newline found
      Open

              $request = $this->httpClient->post('Users/Login', \App\Utils::merge(

      Multi-line function call not indented correctly; expected 12 spaces but found 16
      Open

                      [

      Expected 0 spaces before closing bracket; newline found
      Open

              $request = $this->httpClient->post('Users/TwoFactorAuth', \App\Utils::merge(

      Multi-line function call not indented correctly; expected 8 spaces but found 12
      Open

                  ], self::$requestOptions)

      Multi-line function call not indented correctly; expected 8 spaces but found 12
      Open

                  ], self::$requestOptions)

      There are no issues that match your filters.

      Category
      Status