Completed
Push — master ( 9d80f0...3805b3 )
by Jeroen De
02:21
created

PagePropsIdGeneratorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIncrementsIdByOne() 0 8 1
A testIncrementsNamedId() 0 8 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace IdGenerator\Tests;
6
7
use IdGenerator\PackagePrivate\PagePropsIdGenerator;
8
use MediaWiki\MediaWikiServices;
9
use PHPUnit\Framework\TestCase;
10
11
/**
12
 * @ingroup Database
13
 * @covers \IdGenerator\PackagePrivate\PagePropsIdGenerator
14
 */
15
class PagePropsIdGeneratorTest extends TestCase {
16
17
	public function testIncrementsIdByOne() {
18
		$generator = new PagePropsIdGenerator( MediaWikiServices::getInstance()->getDBLoadBalancer() );
19
20
		$this->assertSame(
21
			$generator->getNewId() + 1,
22
			$generator->getNewId()
23
		);
24
	}
25
26
	public function testIncrementsNamedId() {
27
		$generator = new PagePropsIdGenerator( MediaWikiServices::getInstance()->getDBLoadBalancer() );
28
29
		$this->assertSame(
30
			$generator->getNewId( 'TestName' ) + 1,
31
			$generator->getNewId( 'TestName' )
32
		);
33
	}
34
35
}
36