testGetSingletonOnInvalidEnvironment()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ExtensionRegistryHelper\Test;
4
5
use ExtensionRegistryHelper\ExtensionRegistryHelper;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * Class ExtensionRegistryHelperTest
10
 */
11
class ExtensionRegistryHelperTest extends TestCase {
12
13
	/**
14
	 * This has to come first. Otherwise the singleton will already be stored in the static variable.
15
	 *
16
	 * @throws \Exception
17
	 */
18
	public function testGetSingletonOnInvalidEnvironment() {
19
20
		$this->expectException( \Exception::class );
21
22
		self::assertInstanceOf( ExtensionRegistryHelper::class, ExtensionRegistryHelper::singleton() );
23
	}
24
25
	/**
26
	 * @throws \Exception
27
	 */
28
	public function testGetSingleton() {
29
30
		$GLOBALS[ 'wgVersion' ] = '1.27';
31
		self::assertInstanceOf( ExtensionRegistryHelper::class, ExtensionRegistryHelper::singleton() );
32
	}
33
34
35
}
36