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 (#1038)
by Dan
04:32
created

DatabasePropertiesTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
dl 0
loc 43
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_validate_config_happy_path() 0 41 1
1
<?php declare(strict_types=1);
2
3
namespace SmrTest;
4
5
use Dotenv\Dotenv;
6
use Dotenv\Validator;
7
use PHPUnit\Framework\TestCase;
8
use Smr\DatabaseProperties;
9
10
/**
11
 * @covers \Smr\DatabaseProperties
12
 */
13
class DatabasePropertiesTest extends TestCase {
14
15
	public function test_validate_config_happy_path() {
16
		// Given a Dotenv object
17
		$dotEnv = $this->createMock(Dotenv::class);
18
		$validator = $this->createMock(Validator::class);
19
20
		// And the dotenv config will return the following array when loaded
21
		$dotEnv
22
			->expects(self::once())
23
			->method('load')
24
			->willReturn([
25
				'MYSQL_HOST' => 'host',
26
				'MYSQL_USER' => 'user',
27
				'MYSQL_PASSWORD' => 'pass',
28
				'MYSQL_DATABASE' => 'database',
29
			]);
30
31
		// And we expect that the dotenv "required" method will be called with the following arguments
32
		$dotEnv
33
			->expects(self::once())
34
			->method('required')
35
			->with([
36
				'MYSQL_HOST',
37
				'MYSQL_USER',
38
				'MYSQL_PASSWORD',
39
				'MYSQL_DATABASE',
40
			])
41
			->willReturn($validator);
42
43
		$validator
44
			->expects(self::once())
45
			->method('notEmpty')
46
			->willReturnSelf();
47
48
		// When constructing the properties class
49
		$dbProperties = new DatabaseProperties($dotEnv);
50
51
		// Then the properties have expected values
52
		self::assertEquals('host', $dbProperties->getHost());
53
		self::assertEquals('user', $dbProperties->getUser());
54
		self::assertEquals('pass', $dbProperties->getPassword());
55
		self::assertEquals('database', $dbProperties->getDatabaseName());
56
	}
57
58
}
59