Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
Get tests pass in php7
Browse files Browse the repository at this point in the history
  • Loading branch information
treffynnon committed Feb 18, 2016
1 parent 5ae81ce commit 669c8ca
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ before_install:
install:
- composer install
script:
- ./vendor/bin/phpunit --colors --bootstrap tests/bootstrap.php --coverage-text tests
- ./vendor/bin/phpunit --coverage-text
12 changes: 12 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<phpunit backupGlobals="true"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
cacheTokens="false"
colors="true">
<testsuites>
<testsuite name="Navigator Test Suite">
<directory suffix="Test.php">tests</directory>
<directory suffix="TestUnder7.php" phpVersion="7.0.0" phpVersionOperator="&lt;">tests</directory>
</testsuite>
</testsuites>
</phpunit>
8 changes: 0 additions & 8 deletions tests/Treffynnon/Navigator/CoordinateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ public function testCorrectParser() {
$this->assertInstanceOf('Treffynnon\Navigator\Coordinate\DecimalParser', $Coordinate->getParser());
}

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testIncorrectParser() {
$Coordinate = new N\Coordinate;
$Coordinate->setParser(new stdClass());
}

public function testDefaultParser() {
$Coordinate = new N\Coordinate;
$this->assertInstanceOf('Treffynnon\Navigator\Coordinate\DecimalParser', $Coordinate->getParser());
Expand Down
23 changes: 23 additions & 0 deletions tests/Treffynnon/Navigator/CoordinateTestUnder7.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Navigator: a geographic calculation library for PHP
* @link http://navigator.simonholywell.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @copyright 2012, Simon Holywell
* @author Simon Holywell <treffynnon@php.net>
*/
use Treffynnon\Navigator as N;
use Treffynnon\Navigator\Coordinate as C;

class CoordinateTestUnder7 extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testIncorrectParser() {
$Coordinate = new N\Coordinate;
$Coordinate->setParser(new stdClass());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@

class CosineLawTest extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$CosineLaw = new C\CosineLaw;
$CosineLaw->calculate(new stdClass, new stdClass);
}

public function testCalculate() {
$CosineLaw = new C\CosineLaw;
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Navigator: a geographic calculation library for PHP
* @link http://navigator.simonholywell.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @copyright 2012, Simon Holywell
* @author Simon Holywell <treffynnon@php.net>
*/
use Treffynnon\Navigator as N;
use Treffynnon\Navigator\Distance\Calculator as C;

class CosineLawTestUnder7 extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$CosineLaw = new C\CosineLaw;
$CosineLaw->calculate(new stdClass, new stdClass);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@

class GreatCircleTest extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$GreatCircle = new C\GreatCircle;
$GreatCircle->calculate(new stdClass, new stdClass);
}

public function testCalculate() {
$GreatCircle = new C\GreatCircle;
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Navigator: a geographic calculation library for PHP
* @link http://navigator.simonholywell.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @copyright 2012, Simon Holywell
* @author Simon Holywell <treffynnon@php.net>
*/
use Treffynnon\Navigator as N;
use Treffynnon\Navigator\Distance\Calculator as C;

class GreatCircleTestUnder7 extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$GreatCircle = new C\GreatCircle;
$GreatCircle->calculate(new stdClass, new stdClass);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@

class HaversineTest extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$Haversine = new C\Haversine;
$Haversine->calculate(new stdClass, new stdClass);
}

public function testCalculate() {
$Haversine = new C\Haversine;
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Navigator: a geographic calculation library for PHP
* @link http://navigator.simonholywell.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @copyright 2012, Simon Holywell
* @author Simon Holywell <treffynnon@php.net>
*/
use Treffynnon\Navigator as N;
use Treffynnon\Navigator\Distance\Calculator as C;

class HaversineTestUnder7 extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$Haversine = new C\Haversine;
$Haversine->calculate(new stdClass, new stdClass);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@

class VincentyTest extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$Vincenty = new C\Vincenty;
$Vincenty->calculate(new stdClass, new stdClass);
}

public function testCalculate() {
$Vincenty = new C\Vincenty;
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Navigator: a geographic calculation library for PHP
* @link http://navigator.simonholywell.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @copyright 2012, Simon Holywell
* @author Simon Holywell <treffynnon@php.net>
*/
use Treffynnon\Navigator as N;
use Treffynnon\Navigator\Distance\Calculator as C;

class VincentyTestUnder7 extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedCalculator() {
$Vincenty = new C\Vincenty;
$Vincenty->calculate(new stdClass, new stdClass);
}

}
17 changes: 0 additions & 17 deletions tests/Treffynnon/Navigator/DistanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@

class DistanceTest extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedGet() {
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
$point2 = new N\LatLong(new N\Coordinate(20.1), new N\Coordinate(80.9));
$Distance = new N\Distance($point1, $point2);
$metres = $Distance->get(new stdClass, new stdClass);
}

public function testGet() {
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
$point2 = new N\LatLong(new N\Coordinate(20.1), new N\Coordinate(80.9));
Expand Down Expand Up @@ -48,13 +38,6 @@ public function testConstructorWithProvider($coord) {
$this->assertGreaterThan(20, $metres);
}

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedConstructor() {
$Distance = new N\Distance(new stdClass, new stdClass);
}

public function coordValidProvider() {
return NavigatorTestData::coordData_decimal_valid();
}
Expand Down
31 changes: 31 additions & 0 deletions tests/Treffynnon/Navigator/DistanceTestUnder7.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* Navigator: a geographic calculation library for PHP
* @link http://navigator.simonholywell.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @copyright 2012, Simon Holywell
* @author Simon Holywell <treffynnon@php.net>
*/
use Treffynnon\Navigator as N;

class DistanceTestUnder7 extends PHPUnit_Framework_TestCase {

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedGet() {
$point1 = new N\LatLong(new N\Coordinate(80.9), new N\Coordinate(20.1));
$point2 = new N\LatLong(new N\Coordinate(20.1), new N\Coordinate(80.9));
$Distance = new N\Distance($point1, $point2);
$metres = $Distance->get(new stdClass, new stdClass);
}

/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFailedConstructor() {
$Distance = new N\Distance(new stdClass, new stdClass);
}

}

0 comments on commit 669c8ca

Please sign in to comment.