ScribuntoLuaLibraryAskTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTestModules() 0 5 1
A testAsk() 0 17 1
1
<?php
2
3
namespace SMW\Scribunto\Tests;
4
5
/**
6
 * @covers \SMW\Scribunto\ScribuntoLuaLibrary
7
 * @group semantic-scribunto
8
 *
9
 * @license GNU GPL v2+
10
 * @since 1.0
11
 *
12
 * @author Tobias Oetterer
13
 */
14
class ScribuntoLuaLibraryAskTest extends ScribuntoLuaEngineTestBase {
15
16
	/**
17
	 * Lua test module
18
	 * @var string
19
	 */
20
	protected static $moduleName = self::class;
21
22
	/**
23
	 * ScribuntoLuaEngineTestBase::getTestModules
24
	 */
25
	public function getTestModules() {
26
		return parent::getTestModules() + [
27
			self::$moduleName => __DIR__ . '/' . 'mw.smw.ask.tests.lua',
28
		];
29
	}
30
31
32
	/**
33
	 * Tests method info
34
	 *
35
	 * @return void
36
	 */
37
	public function testAsk() {
38
		$this->assertEmpty(
39
			$this->getScribuntoLuaLibrary()->ask( null )[0]
40
		);
41
		$this->assertEmpty(
42
			$this->getScribuntoLuaLibrary()->ask( '' )[0]
43
		);
44
		$this->assertArrayHasKey(
45
			0,
46
			$this->getScribuntoLuaLibrary()->ask( '[[Modification date::+]]|?Modification date|limit=2|mainlabel=main' )
47
		);
48
		// invalid query
49
		$this->assertInternalType(
50
			'null',
51
			$this->getScribuntoLuaLibrary()->ask( '?Modification date|limit=2|mainlabel=main' )[0]
52
		);
53
	}
54
}