Passed
Push — master ( af0ddd...588379 )
by Francis
01:16
created

APIKeyAuthAuthTest::tearDownAfterClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
declare(strict_types=1);
3
defined('BASEPATH') OR exit('No direct script access allowed');
4
5
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by Francis Ilechukwu
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...
6
7
class APIKeyAuthAuthTest extends TestCase {
8
  /**
9
   * Code Igniter Instance.
10
   * @var object
11
   */
12
  private static $ci;
13
  /**
14
   * Package name for simplicity
15
   * @var string
16
   */
17
  private const PACKAGE = "francis94c/ci-rest";
18
19
  /**
20
   * Prerquisites for the Unit Tests.
21
   *
22
   * @covers JWT::__construct
23
   */
24
  public static function setUpBeforeClass(): void {
25
    self::$ci =& get_instance();
0 ignored issues
show
Bug introduced by Francis Ilechukwu
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

25
    self::$ci =& /** @scrutinizer ignore-call */ get_instance();
Loading history...
26
    self::$ci->load->database('mysqli://[email protected]/test_db');
27
    self::$ci->load->helper("url");
28
    $queries = explode("#@@@", file_get_contents(FCPATH . 'application/splints/' . self::PACKAGE . '/phpunit/database.sql'));
0 ignored issues
show
Bug introduced by Francis Ilechukwu
The constant FCPATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
29
    self::assertTrue(count($queries) > 0);
30
    self::$ci->load->database();
31
    foreach ($queries as $query) {
32
      self::$ci->db->query($query);
33
    }
34
  }
35
  /**
36
   * [testAPIKeyAuth description]
37
   */
38
  public function testAPIKeyAuth():void {
39
    $_SERVER['HTTP_X_API_KEY'] = "ABCDE";
40
    $this->assertTrue(true);
41
  }
42
  /**
43
   * [tearDownAfterClass description]
44
   */
45
  public static function tearDownAfterClass(): void {
46
    self::$ci->db->empty_table("api_keys");
47
    self::$ci->db->empty_table("users");
48
    self::$ci->db->empty_table("rest_api_rate_limit");
49
    self::$ci->load->dbforge();
50
    self::$ci->dbforge->drop_table("api_keys");
51
    self::$ci->dbforge->drop_table("users");
52
    self::$ci->dbforge->drop_table("rest_api_rate_limit");
53
    self::$ci->db->close();
54
  }
55
}
56