Skip to content

Commit

Permalink
Add a Travis-ci configuration
Browse files Browse the repository at this point in the history
And modify test classes so they can be tested using Travis-CI.
  • Loading branch information
mprins committed Jun 16, 2014
1 parent 478a1a0 commit 4d60e3a
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# docs available at http://docs.travis-ci.com/user/languages/php/
# example available at https://github.com/travis-ci/travis-ci-php-example
language: php

before_script:
- composer self-update

install:
- composer install
# TODO optionally install geos library
# TODO optionally set up a postgis database for testing

script: cd tests && phpunit --verbose --colors --stderr tests

# run tests on the following versions
php:
- 5.5
- 5.4
- 5.3
- hhvm
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
{
"name":"Patrick Hayes"
}
]
],
"require-dev": {
"phpunit/phpunit": "4.1.*"
}
}
2 changes: 1 addition & 1 deletion tests/input/an_empty_polygon.wkt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
POLYGON EMPTY
POLYGON EMPTY
2 changes: 0 additions & 2 deletions tests/tests/20120702Test.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
require_once('../geoPHP.inc');
require_once('PHPUnit/Autoload.php');

class Tests_20120702 extends PHPUnit_Framework_TestCase {

function setUp() {
Expand Down
3 changes: 1 addition & 2 deletions tests/tests/adaptersTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
require_once('../geoPHP.inc');
require_once('PHPUnit/Autoload.php');

class AdaptersTests extends PHPUnit_Framework_TestCase {

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

// Test adapter output and input. Do a round-trip and re-test
Expand Down
3 changes: 1 addition & 2 deletions tests/tests/aliasesTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
require_once('../geoPHP.inc');
require_once('PHPUnit/Autoload.php');

class AliasesTests extends PHPUnit_Framework_TestCase {

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

$aliases = array(
Expand Down
7 changes: 7 additions & 0 deletions tests/tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require_once ('../geoPHP.inc');
if (!@include __DIR__ . '/../../vendor/autoload.php') {
die('You must set up the project dependencies, run the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install');
}
3 changes: 1 addition & 2 deletions tests/tests/geosTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
require_once('../geoPHP.inc');
require_once('PHPUnit/Autoload.php');

class GeosTests extends PHPUnit_Framework_TestCase {

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

$geosMethods = array(
Expand Down
3 changes: 1 addition & 2 deletions tests/tests/methodsTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
require_once('../geoPHP.inc');
require_once('PHPUnit/Autoload.php');

class MethodsTests extends PHPUnit_Framework_TestCase {

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

$methods = array(
Expand Down
3 changes: 1 addition & 2 deletions tests/tests/placeholdersTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
require_once('../geoPHP.inc');
require_once('PHPUnit/Autoload.php');

class PlaceholdersTests extends PHPUnit_Framework_TestCase {

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

$placeholders = array(
Expand Down

0 comments on commit 4d60e3a

Please sign in to comment.