ParserFunctionFactoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanConstruct() 0 7 1
B testNewSignupFieldsParserFunction() 0 29 1
1
<?php
2
3
namespace SES\Tests;
4
5
use SES\ParserFunctionFactory;
6
7
use Title;
8
use Parser;
9
use ParserOptions;
10
11
/**
12
 * @covers \SES\ParserFunctionFactory
13
 *
14
 * @group semantic-signup
15
 *
16
 * @license GNU GPL v2+
17
 * @since 1.0
18
 *
19
 * @author mwjames
20
 */
21
class ParserFunctionFactoryTest extends \PHPUnit_Framework_TestCase {
22
23
	public function testCanConstruct() {
24
25
		$this->assertInstanceOf(
26
			'\SES\ParserFunctionFactory',
27
			new ParserFunctionFactory()
28
		);
29
	}
30
31
	public function testNewSignupFieldsParserFunction() {
32
33
		$parser = $this->getMockBuilder( '\Parser' )
34
			->disableOriginalConstructor()
35
			->getMock();
36
37
		$instance = new ParserFunctionFactory();
38
39
		list( $name, $definition, $flag ) = $instance->newSignupFieldsParserFunctionDefinition();
40
41
		$this->assertEquals(
42
			'signupfields',
43
			$name
44
		);
45
46
		$this->assertInstanceOf(
47
			'\Closure',
48
			$definition
49
		);
50
51
		$this->assertEquals(
52
			0,
53
			$flag
54
		);
55
56
		$this->assertNotEmpty(
57
			call_user_func_array( $definition, array( $parser ) )
58
		);
59
	}
60
61
}
62