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

Passed
Pull Request — master (#924)
by
unknown
04:35
created

Bar   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 2
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 1 1
1
<?php
2
3
namespace SmrTest\lib\DefaultGame;
4
5
use PHPUnit\Framework\TestCase;
6
use Smr\Container\DiContainer;
7
8
class Foo {
9
	private Bar $bar;
10
	private float $rand;
11
12
	public function __construct(Bar $bar) {
13
		$this->bar = $bar;
14
		$this->rand = mt_rand() / mt_getrandmax();
15
	}
16
}
17
18
class Bar {
19
	public function __construct() {
20
	}
21
}
22
23
class FooTest extends TestCase {
24
25
	public function test_foo_equals() {
26
		// Get always retrieves the same instance, so this test proves that they are referentially equal
27
		$foo = DiContainer::get(Foo::class);
28
		$foo2 = DiContainer::get(Foo::class);
29
		self::assertEquals($foo, $foo2);
30
	}
31
32
	public function test_foo_not_equals() {
33
		$foo = DiContainer::get(Foo::class);
34
		// Make will create a brand new instance for the requested class
35
		$foo2 = DiContainer::make(Foo::class);
36
		// They are not referentially equal.
37
		self::assertNotEquals($foo, $foo2);
38
	}
39
}
40