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

testApiRequest_shouldReturnApiErrorOnFailedRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
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