Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Failed Conditions
Pull Request — master (#1017)
by Dan
04:28
created

BaseIntegrationSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 20
dl 0
loc 33
rs 10
c 3
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 2 1
A onNotSuccessfulTest() 0 3 1
A setUpBeforeClass() 0 9 2
A cleanUp() 0 7 2
1
<?php declare(strict_types=1);
2
3
namespace SmrTest;
4
5
use mysqli;
6
use PHPUnit\Framework\TestCase;
7
use Smr\Container\DiContainer;
8
use Smr\MySqlProperties;
9
use Throwable;
10
11
class BaseIntegrationSpec extends TestCase {
12
	protected static mysqli $conn;
13
	private static $defaultPopulatedTables = array();
14
15
	public static function setUpBeforeClass(): void {
16
		if (!isset(self::$conn)) {
17
			$mysqlProperties = DiContainer::get(MySqlProperties::class);
0 ignored issues
show
Unused Code introduced by
The assignment to $mysqlProperties is dead and can be removed.
Loading history...
18
			self::$conn = DiContainer::make(mysqli::class);
19
			$query = "SELECT table_name FROM information_schema.tables WHERE table_rows > 0 AND TABLE_SCHEMA='smr_live'";
20
			$rs = self::$conn->query($query);
21
			$all = $rs->fetch_all();
22
			array_walk_recursive($all, function($a) {
23
				self::$defaultPopulatedTables[] = "'" . $a . "'";
24
			});
25
		}
26
	}
27
28
	protected function onNotSuccessfulTest(Throwable $t): void {
29
		$this->cleanUp();
30
		throw $t;
31
	}
32
33
	protected function tearDown(): void {
34
		$this->cleanUp();
35
	}
36
37
	protected function cleanUp() {
38
		$implode = implode(",", self::$defaultPopulatedTables);
39
		$query = "SELECT Concat('TRUNCATE TABLE ', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'smr_live' and TABLE_NAME not in (${implode})";
40
		$rs = self::$conn->query($query);
41
		$all = $rs->fetch_all();
42
		foreach ($all as $truncate) {
43
			self::$conn->query($truncate[0]);
44
		}
45
	}
46
}
47