Completed
Push — merge-sm ( 44b830...c70fa4 )
by Jeroen De
10:03 queued 07:12
created

MapsMapperTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 2
A imageUrlProvider() 0 8 1
A testGetFileUrl() 0 3 1
A testGivenNull_getFileUrlReturnsNull() 0 3 1
1
<?php
2
3
namespace Maps\Test;
4
5
use MapsMapper;
6
7
/**
8
 * @covers MapsMapper
9
 *
10
 * @since 3.6
11
 *
12
 * @group Maps
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Peter Grassberger < [email protected] >
16
 */
17
class MapsMapperTest extends \PHPUnit_Framework_TestCase {
18
19
	public function setUp() {
20
		if ( !defined( 'MEDIAWIKI' ) ) {
21
			$this->markTestSkipped( 'MediaWiki is not available' );
22
		}
23
	}
24
25
    public function imageUrlProvider() {
26
        return [
27
            ['markerImage.png', 'markerImage.png'],
28
            ['/w/images/c/ce/Green_marker.png', '/w/images/c/ce/Green_marker.png'],
29
            ['//semantic-mediawiki.org/w/images/c/ce/Green_marker.png', '//semantic-mediawiki.org/w/images/c/ce/Green_marker.png'],
30
            ['Cat2.jpg', 'Cat2.jpg'],
31
        ];
32
    }
33
34
    /**
35
     * Tests MapsMapperTest::getFileUrl()
36
     *
37
     * @dataProvider imageUrlProvider
38
     */
39
    public function testGetFileUrl($file, $expected) {
40
        $this->assertSame( $expected, MapsMapper::getFileUrl($file) );
0 ignored issues
show
Deprecated Code introduced by
The method MapsMapper::getFileUrl() has been deprecated.

This method has been deprecated.

Loading history...
41
    }
42
43
    /**
44
     * Tests MapsMapperTest::getFileUrl()
45
     */
46
    public function testGivenNull_getFileUrlReturnsNull() {
47
        $this->assertNull( MapsMapper::getFileUrl(null));
0 ignored issues
show
Deprecated Code introduced by
The method MapsMapper::getFileUrl() has been deprecated.

This method has been deprecated.

Loading history...
48
    }
49
50
    // TODO test with existing imagePage
51
}
52