Completed
Push — master ( cfd44f...5307df )
by
unknown
07:21
created

FormatSnakValueTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testApiRequest_shouldReturnApiErrorOnFailedRequest() 0 17 1
1
<?php
2
3
declare( strict_types = 1 );
4
namespace Wikibase\Repo\Tests\FederatedProperties\Api;
5
6
use ApiUsageException;
7
8
/**
9
 * @covers \Wikibase\Repo\Api\FormatSnakValue
10
 *
11
 * @group Wikibase
12
 * @group WikibaseAPI
13
 * @group Database
14
 * @group medium
15
 *
16
 * @license GPL-2.0-or-later
17
 */
18
class FormatSnakValueTest extends FederatedPropertiesApiTestCase {
19
20
	public function testApiRequest_shouldReturnApiErrorOnFailedRequest() {
21
22
		$this->setMwGlobals( 'wgLanguageCode', 'qqx' );
23
		$this->setSourceWikiUnavailable();
24
25
		$params = [
26
			'action' => 'wbformatvalue',
27
			'generate' => 'text/plain',
28
			'datavalue' => '{ "value": "test", "type": "string" }',
29
			'property' => 'P854',
30
			'options' => json_encode( [ 'lang' => 'qqx' ] ),
31
		];
32
33
		$this->expectException( ApiUsageException::class );
34
		$this->expectExceptionMessage( '(wikibase-api-federated-properties-failed-request)' );
35
		$this->doApiRequest( $params );
36
	}
37
}
38