Completed
Branch AUTOMATED_TESTING (6eabf7)
by Gordon
14:03
created

MapLayerExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testCMSFields() 0 12 2
1
<?php
2
3
class MapLayerExtensionTest extends SapphireTest {
1 ignored issue
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 setUp() {
6
		// add MapExtension and MapLayerExtension extension to Member
7
		Member::add_extension('MapExtension');
8
		Member::add_extension('MapLayerExtension');
9
		parent::setUp();
10
	}
11
12
	// check for addition of extra CMS fields
13
	public function testCMSFields() {
14
		$instance = new Member();
15
		$fields = $instance->getCMSFields();
16
		$tab = $fields->findOrMakeTab('Root.MapLayers');
17
		$fields = $tab->FieldList();
18
		$names = array();
19
		foreach ($fields as $field) {
20
			$names[] = $field->getName();
21
		}
22
		$expected = array('Map Layers');
23
		$this->assertEquals($expected, $names);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<MapLayerExtensionTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
	}
25
26
}
27