Code Duplication    Length = 43-44 lines in 2 locations

tests/unit/controller/contactcontrollerTest.php 2 locations

@@ 45-88 (lines=44) @@
42
			$this->request, $this->contacts);
43
	}
44
45
	public function testSearchLocation() {
46
		$expected = [
47
			[
48
				'label' => "33 42nd Street\nRandom Town\nSome State\nUnited States",
49
				'name' => 'Person 1',
50
			],
51
			[
52
				'label' => "5 Random Ave\n12782 Some big city\nYet another state\nUnited States",
53
				'name' => 'Person 1',
54
			],
55
			[
56
				'label' => "ABC Street 2\n01337 Village\nGermany",
57
				'name' => '',
58
			],
59
		];
60
61
		$apiResponse = [
62
			[
63
				'FN' => 'Person 1',
64
				'ADR' => [
65
						'33 42nd Street;Random Town;Some State;;United States',
66
						';;5 Random Ave;12782 Some big city;Yet another state;United States',
67
				],
68
			],
69
			[
70
				'FN' => 'Person 2',
71
			],
72
			[
73
				'ADR' => [
74
					'ABC Street 2;01337 Village;;Germany',
75
				],
76
			],
77
		];
78
79
		$this->contacts->expects($this->once())
80
			->method('search')
81
			->with($this->equalTo('Person'), $this->equalTo(['FN', 'ADR']))
82
			->will($this->returnValue($apiResponse));
83
84
		$actual = $this->controller->searchLocation('Person');
85
86
		$this->assertEquals($expected, $actual->getData());
87
88
	}
89
90
	public function testSearchAttendee() {
91
		$expected = [
@@ 90-132 (lines=43) @@
87
88
	}
89
90
	public function testSearchAttendee() {
91
		$expected = [
92
			[
93
				'name' => 'Person 1',
94
				'email' => '[email protected]',
95
			],
96
			[
97
				'name' => 'Person 1',
98
				'email' => '[email protected]',
99
			],
100
			[
101
				'name' => '',
102
				'email' => '[email protected]',
103
			],
104
		];
105
106
		$apiResponse = [
107
			[
108
				'FN' => 'Person 1',
109
				'EMAIL' => [
110
					'[email protected]',
111
					'[email protected]',
112
				],
113
			],
114
			[
115
				'FN' => 'Person 2',
116
			],
117
			[
118
				'EMAIL' => [
119
					'[email protected]',
120
				],
121
			],
122
		];
123
124
		$this->contacts->expects($this->once())
125
			->method('search')
126
			->with($this->equalTo('Person'), $this->equalTo(['FN', 'EMAIL']))
127
			->will($this->returnValue($apiResponse));
128
129
		$actual = $this->controller->searchAttendee('Person');
130
131
		$this->assertEquals($expected, $actual->getData());
132
	}
133
}
134