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
03:42
created

Bar::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 1
rs 10
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