Skip to content

Commit 4d60e3a

Browse files
committed
Add a Travis-ci configuration
And modify test classes so they can be tested using Travis-CI.
1 parent 478a1a0 commit 4d60e3a

11 files changed

+38
-14
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor

.travis.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# docs available at http://docs.travis-ci.com/user/languages/php/
2+
# example available at https://github.com/travis-ci/travis-ci-php-example
3+
language: php
4+
5+
before_script:
6+
- composer self-update
7+
8+
install:
9+
- composer install
10+
# TODO optionally install geos library
11+
# TODO optionally set up a postgis database for testing
12+
13+
script: cd tests && phpunit --verbose --colors --stderr tests
14+
15+
# run tests on the following versions
16+
php:
17+
- 5.5
18+
- 5.4
19+
- 5.3
20+
- hhvm

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
{
1212
"name":"Patrick Hayes"
1313
}
14-
]
14+
],
15+
"require-dev": {
16+
"phpunit/phpunit": "4.1.*"
17+
}
1518
}

tests/input/an_empty_polygon.wkt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
POLYGON EMPTY
1+
POLYGON EMPTY

tests/tests/20120702Test.php

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
require_once('../geoPHP.inc');
3-
require_once('PHPUnit/Autoload.php');
4-
53
class Tests_20120702 extends PHPUnit_Framework_TestCase {
64

75
function setUp() {

tests/tests/adaptersTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
require_once('../geoPHP.inc');
3-
require_once('PHPUnit/Autoload.php');
4-
53
class AdaptersTests extends PHPUnit_Framework_TestCase {
64

75
function setUp() {
@@ -14,6 +12,7 @@ function testAdapters() {
1412
if ($parts[0]) {
1513
$format = $parts[1];
1614
$input = file_get_contents('./input/'.$file);
15+
echo "\nloading: " . $file . " for format: " . $format;
1716
$geometry = geoPHP::load($input, $format);
1817

1918
// Test adapter output and input. Do a round-trip and re-test

tests/tests/aliasesTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
require_once('../geoPHP.inc');
3-
require_once('PHPUnit/Autoload.php');
4-
53
class AliasesTests extends PHPUnit_Framework_TestCase {
64

75
function setUp() {
@@ -14,6 +12,7 @@ function testAliases() {
1412
if ($parts[0]) {
1513
$format = $parts[1];
1614
$value = file_get_contents('./input/'.$file);
15+
echo "\nloading: " . $file . " for format: " . $format;
1716
$geometry = geoPHP::load($value, $format);
1817

1918
$aliases = array(

tests/tests/bootstrap.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
require_once ('../geoPHP.inc');
3+
if (!@include __DIR__ . '/../../vendor/autoload.php') {
4+
die('You must set up the project dependencies, run the following commands:
5+
wget http://getcomposer.org/composer.phar
6+
php composer.phar install');
7+
}

tests/tests/geosTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
require_once('../geoPHP.inc');
3-
require_once('PHPUnit/Autoload.php');
4-
53
class GeosTests extends PHPUnit_Framework_TestCase {
64

75
function setUp() {
@@ -14,6 +12,7 @@ function testGeos() {
1412
if ($parts[0]) {
1513
$format = $parts[1];
1614
$value = file_get_contents('./input/'.$file);
15+
echo "\nloading: " . $file . " for format: " . $format;
1716
$geometry = geoPHP::load($value, $format);
1817

1918
$geosMethods = array(

tests/tests/methodsTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
require_once('../geoPHP.inc');
3-
require_once('PHPUnit/Autoload.php');
4-
53
class MethodsTests extends PHPUnit_Framework_TestCase {
64

75
function setUp() {
@@ -14,6 +12,7 @@ function testMethods() {
1412
if ($parts[0]) {
1513
$format = $parts[1];
1614
$value = file_get_contents('./input/'.$file);
15+
echo "\nloading: " . $file . " for format: " . $format;
1716
$geometry = geoPHP::load($value, $format);
1817

1918
$methods = array(

tests/tests/placeholdersTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
require_once('../geoPHP.inc');
3-
require_once('PHPUnit/Autoload.php');
4-
53
class PlaceholdersTests extends PHPUnit_Framework_TestCase {
64

75
function setUp() {
@@ -14,6 +12,7 @@ function testPlaceholders() {
1412
if ($parts[0]) {
1513
$format = $parts[1];
1614
$value = file_get_contents('./input/'.$file);
15+
echo "\nloading: " . $file . " for format: " . $format;
1716
$geometry = geoPHP::load($value, $format);
1817

1918
$placeholders = array(

0 commit comments

Comments
 (0)