Code Duplication    Length = 12-12 lines in 4 locations

tests/unit/controller/settingscontrollerTest.php 4 locations

@@ 94-105 (lines=12) @@
91
		$this->assertEquals(422, $actual->getStatus());
92
	}
93
94
	public function testSetViewWithConfigException() {
95
		$this->config->expects($this->once())
96
			->method('setUserValue')
97
			->with('user123', $this->appName, 'currentView', 'month')
98
			->will($this->throwException(new \Exception));
99
100
		$actual = $this->controller->setConfig('view', 'month');
101
102
		$this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $actual);
103
		$this->assertEquals([], $actual->getData());
104
		$this->assertEquals(500, $actual->getStatus());
105
	}
106
107
	public function testGetView() {
108
		$this->config->expects($this->once())
@@ 120-131 (lines=12) @@
117
		$this->assertEquals(200, $actual->getStatus());
118
	}
119
120
	public function testGetViewWithConfigException() {
121
		$this->config->expects($this->once())
122
			->method('getUserValue')
123
			->with('user123', $this->appName, 'currentView', 'month')
124
			->will($this->throwException(new \Exception));
125
126
		$actual = $this->controller->getConfig('view');
127
128
		$this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $actual);
129
		$this->assertEquals([], $actual->getData());
130
		$this->assertEquals(500, $actual->getStatus());
131
	}
132
133
	/**
134
	 * @dataProvider setPopoverWithAllowedValueDataProvider
@@ 163-174 (lines=12) @@
160
		$this->assertEquals(422, $actual->getStatus());
161
	}
162
163
	public function testSetPopoverWithConfigException() {
164
		$this->config->expects($this->once())
165
			->method('setUserValue')
166
			->with('user123', $this->appName, 'skipPopover', 'no')
167
			->will($this->throwException(new \Exception));
168
169
		$actual = $this->controller->setConfig('skipPopover', 'no');
170
171
		$this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $actual);
172
		$this->assertEquals([], $actual->getData());
173
		$this->assertEquals(500, $actual->getStatus());
174
	}
175
176
	public function testGetPopover() {
177
		$this->config->expects($this->once())
@@ 189-200 (lines=12) @@
186
		$this->assertEquals(200, $actual->getStatus());
187
	}
188
189
	public function testGetPopoverWithConfigException() {
190
		$this->config->expects($this->once())
191
			->method('getUserValue')
192
			->with('user123', $this->appName, 'skipPopover', 'no')
193
			->will($this->throwException(new \Exception));
194
195
		$actual = $this->controller->getConfig('skipPopover');
196
197
		$this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $actual);
198
		$this->assertEquals([], $actual->getData());
199
		$this->assertEquals(500, $actual->getStatus());
200
	}
201
202
	public function testGetNotExistingConfig() {
203
		$actual = $this->controller->getConfig('foo');