Completed
Push — cargo-test ( 1add19 )
by Jeroen De
07:30 queued 04:28
created

CargoQueryTest::testCargoQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\Tests\System;
6
7
use Maps\Tests\MapsTestFactory;
8
use PHPUnit\Framework\TestCase;
9
use Title;
10
11
class CargoQueryTest extends TestCase {
12
13
	public function setUp(): void {
14
		if ( !class_exists( \CargoDisplayFormat::class ) ) {
15
			$this->markTestSkipped( 'Cargo is not available' );
16
		}
17
	}
18
19
	public function testCargoQuery() {
20
		$content = $this->getCargoMapOutput();
21
22
		$this->assertContains( '<div id="map_leaflet_', $content );
23
		$this->assertContains( '"GeoJsonSource":"TestGeoJson"', $content );
24
		$this->assertContains( '"GeoJsonRevisionId":', $content );
25
		$this->assertContains( '"geojson":{"type":"FeatureCollection"', $content );
26
	}
27
28
	private function getCargoMapOutput(): string {
29
		return MapsTestFactory::newTestInstance()->getPageContentFetcher()
30
			->getPageContent( 'CargoMap' )->getParserOutput( Title::newFromText( 'CargoMap' ) )->getText();
31
	}
32
33
}
34