Skip to content

Commit 3ed5923

Browse files
authored
Test for PHP 7.2 and 7.3, fix style format identification (#14)
1 parent aa97efe commit 3ed5923

3 files changed

Lines changed: 52 additions & 1 deletion

File tree

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ sudo: false
1313

1414
php:
1515
- 7.1
16+
- 7.2
17+
- 7.3
1618

1719
env:
1820
global:

src/Support/TypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static function identify($path)
104104
}
105105
} elseif ($mimeType === 'image/tiff' && BinaryReader::isGeoTiff($path)) {
106106
$format = GeoFormat::GEOTIFF;
107-
} elseif ($mimeType === 'application/xml') {
107+
} elseif ($mimeType === 'application/xml' || $mimeType === 'text/xml') {
108108

109109
// check if Style tag is present
110110
$data = join('', TextReader::readLines($path, 2));

tests/Unit/StyleFileTest.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/*
3+
* GeoServer PHP Client
4+
*
5+
* Copyright (c) 2018 Oneoff-tech UG, Germany, www.oneofftech.xyz
6+
*
7+
* This program is Free Software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Affero General Public License as
9+
* published by the Free Software Foundation, either version 3 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/>.
20+
*/
21+
22+
namespace Tests\Unit;
23+
24+
use Tests\TestCase;
25+
use OneOffTech\GeoServer\GeoFile;
26+
use OneOffTech\GeoServer\GeoType;
27+
use OneOffTech\GeoServer\GeoFormat;
28+
use OneOffTech\GeoServer\StyleFile;
29+
30+
class StyleFileTest extends TestCase
31+
{
32+
public function test_style_is_supported()
33+
{
34+
$supported = StyleFile::isSupported(__DIR__ . '/../fixtures/style.sld');
35+
$this->assertTrue($supported);
36+
}
37+
38+
public function test_style_file_load()
39+
{
40+
$styleName = 'style_test';
41+
$file = StyleFile::from(__DIR__ . '/../fixtures/style.sld')->name($styleName);
42+
43+
$this->assertInstanceOf(StyleFile::class, $file);
44+
$this->assertEquals('application/vnd.ogc.sld+xml', $file->mimeType);
45+
$this->assertEquals('sld', $file->extension);
46+
$this->assertEquals('style_test', $file->name);
47+
$this->assertEquals('style.sld', $file->originalName);
48+
}
49+
}

0 commit comments

Comments
 (0)