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

PagePropsIdGeneratorTest::testIncrementsIdByOne()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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