Completed
Branch master (486a28)
by Paweł
02:07
created

CodeFixerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testGetBasicFunctionRenames() 0 45 2
1
<?php
2
3
class CodeFixerTest extends PHPUnit_Framework_TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	public function testGetBasicFunctionRenames() {
6
		$fixes = new CodeFixer();
7
8
		$renames = $fixes->getBasicFunctionRenames();
9
10
		$pattern = '/^[a-zA-Z_][\sa-zA-Z_0-9\(\)\->]*$/';
11
12
		foreach ($renames as $from => $to) {
13
			$this->assertNotEmpty($from);
14
			$this->assertNotEmpty($to);
15
16
			$this->assertRegExp($pattern, $from);
17
			$this->assertRegExp($pattern, $to);
18
		}
19
20
		/*
21
		 * Check version filtering
22
		 */
23
		// no results below 1.7
24
		$this->assertEmpty($fixes->getBasicFunctionRenames('1.6'));
25
26
		// version 1.7
27
		$renames = $fixes->getBasicFunctionRenames('1.7');
28
		$this->assertArrayHasKey('elgg_validate_action_url', $renames);
29
		$this->assertArrayNotHasKey('register_elgg_event_handler', $renames);
30
		$this->assertArrayNotHasKey('setup_db_connections', $renames);
31
32
		// version 1.8
33
		$renames = $fixes->getBasicFunctionRenames('1.8');
34
		$this->assertArrayHasKey('elgg_validate_action_url', $renames);
35
		$this->assertArrayHasKey('register_elgg_event_handler', $renames);
36
		$this->assertArrayNotHasKey('setup_db_connections', $renames);
37
38
		// version 1.9
39
		$renames = $fixes->getBasicFunctionRenames('1.9');
40
		$this->assertArrayHasKey('elgg_validate_action_url', $renames);
41
		$this->assertArrayHasKey('register_elgg_event_handler', $renames);
42
		$this->assertArrayHasKey('setup_db_connections', $renames);
43
44
		// all versions
45
		$renames = $fixes->getBasicFunctionRenames('');
46
		$this->assertArrayHasKey('elgg_validate_action_url', $renames);
47
		$this->assertArrayHasKey('register_elgg_event_handler', $renames);
48
		$this->assertArrayHasKey('setup_db_connections', $renames);
49
	}
50
}
51