ExtensionRegistryHelperTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetSingletonOnInvalidEnvironment() 0 5 1
A testGetSingleton() 0 4 1
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