Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use composer:autoload:file instead of classmap. Fix tests and travis. #147

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# docs available at http://docs.travis-ci.com/user/languages/php/
# example available at https://github.com/travis-ci/travis-ci-php-example
dist: trusty
sudo: false
language: php

before_script:
Expand All @@ -12,18 +14,20 @@ install:
# TODO Install geos library -- as a matrix test
# TODO optionally set up a postgis database for testing

script:
script:
- ./vendor/bin/phpunit --verbose --colors --stderr --bootstrap tests/tests/bootstrap.php tests
- cd tests
- phpunit --verbose --colors --stderr tests
- php test.php

# run tests on the following versions
php:
- 5.6
- 5.5
- 5.4
- 5.3
- hhvm

matrix:
fast_finish: false
include:
- php: 5.3
dist: precise
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "GeoPHP is a open-source native PHP library for doing geometry operations. It is written entirely in PHP and can therefore run on shared hosts. It can read and write a wide variety of formats: WKT (including EWKT), WKB (including EWKB), GeoJSON, KML, GPX, GeoRSS). It works with all Simple-Feature geometries (Point, LineString, Polygon, GeometryCollection etc.) and can be used to get centroids, bounding-boxes, area, and a wide variety of other useful information.",
"homepage": "https://github.com/phayes/geoPHP",
"autoload": {
"classmap": ["geoPHP.inc"]
"files": ["geoPHP.inc"]
},
"authors":[
{
Expand Down
7 changes: 4 additions & 3 deletions tests/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function run_test() {

header("Content-type: text");

include_once('../geoPHP.inc');
include_once(__DIR__ . '/tests/bootstrap.php');

if (geoPHP::geosInstalled()) {
print "GEOS is installed.\n";
Expand All @@ -24,11 +24,12 @@ function run_test() {
print "GEOS is not installed.\n";
}

foreach (scandir('./input') as $file) {
$input_dir = __DIR__ . '/input/';
foreach (scandir($input_dir) as $file) {
$parts = explode('.',$file);
if ($parts[0]) {
$format = $parts[1];
$value = file_get_contents('./input/'.$file);
$value = file_get_contents($input_dir . $file);
print '---- Testing '.$file."\n";
$geometry = geoPHP::load($value, $format);
test_adapters($geometry, $format, $value);
Expand Down
5 changes: 2 additions & 3 deletions tests/tests/20120702Test.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../geoPHP.inc');

class Tests_20120702 extends PHPUnit_Framework_TestCase {

function setUp() {
Expand All @@ -8,7 +8,7 @@ function setUp() {

function testMethods() {
$format = 'gpx';
$value = file_get_contents('./input/20120702.gpx');
$value = file_get_contents(__DIR__ . '/../input/20120702.gpx');
$geometry = geoPHP::load($value, $format);

$methods = array(
Expand Down Expand Up @@ -284,4 +284,3 @@ function _methods_tester($geometry, $method_name, $argument) {
}
}
}

7 changes: 4 additions & 3 deletions tests/tests/adaptersTest.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php
require_once('../geoPHP.inc');

class AdaptersTests extends PHPUnit_Framework_TestCase {

function setUp() {

}

function testAdapters() {
foreach (scandir('./input') as $file) {
$input_dir = __DIR__ . '/../input/';
foreach (scandir($input_dir) as $file) {
$parts = explode('.',$file);
if ($parts[0]) {
$format = $parts[1];
$input = file_get_contents('./input/'.$file);
$input = file_get_contents($input_dir . $file);
echo "\nloading: " . $file . " for format: " . $format;
$geometry = geoPHP::load($input, $format);

Expand Down
3 changes: 1 addition & 2 deletions tests/tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?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');
}
}
1 change: 0 additions & 1 deletion tests/tests/geohashTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once ('../geoPHP.inc');

class GeoHashTest extends PHPUnit_Framework_TestCase {

Expand Down
5 changes: 2 additions & 3 deletions tests/tests/geosTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../geoPHP.inc');

class GeosTests extends PHPUnit_Framework_TestCase {

function setUp() {
Expand All @@ -8,8 +8,7 @@ function setUp() {

function testGeos() {
if (!geoPHP::geosInstalled()) {
echo "Skipping GEOS -- not installed";
return;
$this->markTestSkipped('Skipping GEOS -- not installed');
}
foreach (scandir('./input') as $file) {
$parts = explode('.',$file);
Expand Down
7 changes: 4 additions & 3 deletions tests/tests/methodsTest.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php
require_once('../geoPHP.inc');

class MethodsTests extends PHPUnit_Framework_TestCase {

function setUp() {

}

function testMethods() {
foreach (scandir('./input') as $file) {
$input_dir = __DIR__ . '/../input/';
foreach (scandir($input_dir) as $file) {
$parts = explode('.',$file);
if ($parts[0]) {
$format = $parts[1];
$value = file_get_contents('./input/'.$file);
$value = file_get_contents($input_dir . $file);
echo "\nloading: " . $file . " for format: " . $format;
$geometry = geoPHP::load($value, $format);

Expand Down
7 changes: 4 additions & 3 deletions tests/tests/placeholdersTest.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php
require_once('../geoPHP.inc');

class PlaceholdersTests extends PHPUnit_Framework_TestCase {

function setUp() {

}

function testPlaceholders() {
foreach (scandir('./input') as $file) {
$input_dir = __DIR__ . '/../input/';
foreach (scandir($input_dir) as $file) {
$parts = explode('.',$file);
if ($parts[0]) {
$format = $parts[1];
$value = file_get_contents('./input/'.$file);
$value = file_get_contents($input_dir . $file);
echo "\nloading: " . $file . " for format: " . $format;
$geometry = geoPHP::load($value, $format);

Expand Down