GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

TypeMapTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetUnmappedProperty() 0 15 1
A testValidationWithUnmappedPropertiesShouldPass() 0 8 1
A testValidationWithUnmappedPropertiesShouldThrowException() 0 10 1
A createMappedProperty() 0 7 1
A createUnmappedProperty() 0 7 1
1
<?php
2
3
namespace Papper\Tests;
4
5
use Papper\TypeMap;
6
7
class TypeMapTest extends TestCaseBase
8
{
9
	public function testGetUnmappedProperty()
10
	{
11
		// arrange
12
		$mappedPropertyMap = self::createMappedProperty();
13
		$unmappedPropertyMap = self::createUnmappedProperty();
14
15
		$typeMap = new TypeMap('SomeType', 'AnotherType', \Mockery::mock('Papper\ObjectCreatorInterface'));
16
		$typeMap->addPropertyMap($mappedPropertyMap);
17
		$typeMap->addPropertyMap($unmappedPropertyMap);
18
		// act
19
		$unmappedProperties = $typeMap->getUnmappedPropertyMaps();
20
		// assert
21
		$this->assertCount(1, $unmappedProperties);
22
		$this->assertSame($unmappedPropertyMap, $unmappedProperties['unmapped']);
23
	}
24
25
	public function testValidationWithUnmappedPropertiesShouldPass()
26
	{
27
		// arrange
28
		$typeMap = new TypeMap('SomeType', 'AnotherType', \Mockery::mock('Papper\ObjectCreatorInterface'));
29
		$typeMap->addPropertyMap(self::createMappedProperty());
30
		// act
31
		$typeMap->validate();
32
	}
33
34
	public function testValidationWithUnmappedPropertiesShouldThrowException()
35
	{
36
		$this->setExpectedException('Papper\ValidationException');
37
		// arrange
38
		$typeMap = new TypeMap('SomeType', 'AnotherType', \Mockery::mock('Papper\ObjectCreatorInterface'));
39
		$typeMap->addPropertyMap(self::createMappedProperty());
40
		$typeMap->addPropertyMap(self::createUnmappedProperty());
41
		// act
42
		$typeMap->validate();
43
	}
44
45
	private static function createMappedProperty()
46
	{
47
		$mock = \Mockery::mock('Papper\PropertyMap');
48
		$mock->shouldReceive('getMemberName')->andReturn('mapped');
49
		$mock->shouldReceive('isMapped')->andReturn(true);
50
		return $mock;
51
	}
52
53
	private static function createUnmappedProperty()
54
	{
55
		$mock = \Mockery::mock('Papper\PropertyMap');
56
		$mock->shouldReceive('getMemberName')->andReturn('unmapped');
57
		$mock->shouldReceive('isMapped')->andReturn(false);
58
		return $mock;
59
	}
60
}
61