Issues (42)

phpunit/GMailAPITest.php (2 issues)

Labels
Severity
1
<?php
2
declare(strict_types=1);
3
use PHPUnit\Framework\TestCase;
0 ignored issues
show
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
5
class GMailAPITest extends TestCase {
6
  /**
7
   * Code Igniter Instance.
8
   * @var object
9
   */
10
  private static $ci;
11
  /**
12
   * Package name for simplicity
13
   * @var string
14
   */
15
  private const PACKAGE = "francis94c/ci-gmail";
16
17
  /**
18
   * Prerquisites for the Unit Tests.
19
   *
20
   * @covers JWT::__construct
21
   */
22
  public static function setUpBeforeClass(): void {
23
    self::$ci =& get_instance();
0 ignored issues
show
The function get_instance was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
    self::$ci =& /** @scrutinizer ignore-call */ get_instance();
Loading history...
24
  }
25
  /**
26
   * [testLoadPackage description]
27
   */
28
  public function testLoadPackage():void {
29
    $config = [
30
      'client_id' => 'abcde',
31
    ];
32
    self::$ci->load->package(self::PACKAGE);
33
    self::$ci->gmail->init($config);
34
    $this->assertEquals($config['client_id'], self::$ci->gmail->getClientId());
35
  }
36
  /**
37
   * [testAuthorizeURL description]
38
   * @depends testLoadPackage
39
   */
40
  public function testAuthorizeURL():void {
41
    $this->assertEquals(
42
      GMail::AUTH_URL.'?client_id=abcde&redirect_uri=https://example.com&scope='.GMailScopes::LABELS.'&response_type=code&access_type=offline',
43
      self::$ci->gmail->getAuthorizeUrl(GMailScopes::LABELS, 'https://example.com')
44
    );
45
  }
46
}
47