Skip to content

Commit

Permalink
refactor tests dir structure; enable coveralls upload in travis.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Péter Báthory committed Apr 1, 2020
1 parent ad26095 commit 62f3058
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 25 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ language: php
before_script:
- composer self-update

env: GEOPHP_RUN_TESTS=1

cache:
directories:
- $HOME/.composer/cache/files
Expand All @@ -16,10 +14,11 @@ install:
# TODO Install geos library -- as a matrix test
# TODO optionally set up a postgis database for testing

script:
script:
- GEOS_DISABLED=1 vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- cd tests
- GEOS_DISABLED=1 ../vendor/bin/phpunit
- php test.php
- php performanceTest.php

# run tests on the following versions
php:
Expand All @@ -32,3 +31,6 @@ php:

matrix:
fast_finish: false

after_success:
- vendor/bin/php-coveralls -v
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"geoPHP\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"geoPHP\\": "tests/"
}
},
"require": {
"php": ">=5.5.0"
},
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit.xml → phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
>
<testsuites>
<testsuite name="funiQ\geoPHP tests">
<directory>unitTests/Geometry</directory>
<directory>tests/unit/Geometry</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>../src/</directory>
<directory>src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout"/>
<!--<log type="coverage-html" target="coverage" />-->
<!--<log type="coverage-clover" target="coverage/clover.xml" />-->
<!--<log type="coverage-html" target="build/coverage" />-->
<!--<log type="coverage-clover" target="build/logs/clover.xml" />-->
</logging>
</phpunit>
8 changes: 1 addition & 7 deletions tests/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@

use \geoPHP\geoPHP;

// Uncomment to test
if (getenv("GEOPHP_RUN_TESTS") == 1) {
run_test();
}
else {
print "Skipping tests. Please set GEOPHP_RUN_TESTS=1 environment variable if you wish to run tests\n";
}
run_test();

function run_test() {
set_time_limit(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests;

use \geoPHP\geoPHP;
use \geoPHP\Geometry\Geometry;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests\Adapter;

use \geoPHP\Adapter\GeoHash;
use PHPUnit\Framework\TestCase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @since 2020-03-19
*/

namespace geoPHP\Tests\Geometry;

use \geoPHP\Geometry\Collection;
use \geoPHP\Geometry\Point;
use \geoPHP\Geometry\LineString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests\Geometry;

use \geoPHP\Exception\InvalidGeometryException;
use \geoPHP\Geometry\Point;
use \geoPHP\Geometry\LineString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace geoPHP\Tests\Geometry;

use \geoPHP\Exception\InvalidGeometryException;
use \geoPHP\Geometry\Point;
use \geoPHP\geoPHP;
use \geoPHP\Geometry\MultiPoint;
use \PHPUnit\Framework\TestCase;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests\Geometry;

use \geoPHP\Exception\InvalidGeometryException;
use \geoPHP\Geometry\Point;
use \PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests;

use \geoPHP\geoPHP;
use PHPUnit\Framework\TestCase;

Expand Down
2 changes: 2 additions & 0 deletions tests/unitTests/geosTest.php → tests/unit/geosTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests;

use \geoPHP\geoPHP;
use PHPUnit\Framework\TestCase;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests;

use \geoPHP\geoPHP;
use PHPUnit\Framework\TestCase;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace geoPHP\Tests;

use \geoPHP\geoPHP;
use PHPUnit\Framework\TestCase;

Expand Down
9 changes: 0 additions & 9 deletions tests/unitTests/bootstrap.php

This file was deleted.

0 comments on commit 62f3058

Please sign in to comment.