Page MenuHomeCode

No OneTemporary

This document is not UTF8. It was detected as Shift JIS and converted to UTF8 for display.
diff --git a/dev/tests/GeoOctocubeTest.php b/dev/tests/GeoOctocubeTest.php
index db598db..1946bdf 100644
--- a/dev/tests/GeoOctocubeTest.php
+++ b/dev/tests/GeoOctocubeTest.php
@@ -1,43 +1,47 @@
<?php
/**
* Unit testing : class GeoOctocube
*
* Zed. The immensity of stars. The HyperShip. The people.
*
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
* @package Zed
* @subpackage Tests
- * @author S饕astien Santoro aka Dereckson <dereckson@espace-win.org>
- * @copyright 2010 S饕astien Santoro aka Dereckson
+ * @author S?スbastien Santoro aka Dereckson <dereckson@espace-win.org>
+ * @copyright 2010 S?スbastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
*/
-require_once('../../includes/geo/octocube.php');
+use PHPUnit\Framework\TestCase;
+
+require_once(__DIR__ . '/../../includes/geo/octocube.php');
/**
* Test cases for the class GeoPlace
*/
-class GeoOctocubeTest extends PHPUnit_Framework_TestCase {
+class GeoOctocubeTest extends TestCase {
+
/**
* Tests the GeoPlace::is_valid_local_location($local_location) method.
*/
public function testGetSector () {
//Testing HyperShip Tower T2C3 format
$this->assertTrue(GeoOctocube::getSector(0, 0, 0) == 0);
$this->assertTrue(GeoOctocube::getSector(-10, 6, -4) == 1);
$this->assertTrue(GeoOctocube::getSector(10, 6, -4) == 2);
$this->assertTrue(GeoOctocube::getSector(-10, -6, -4) == 3);
$this->assertTrue(GeoOctocube::getSector(10, -6, -4) == 4);
$this->assertTrue(GeoOctocube::getSector(-10, 6, 4) == 5);
$this->assertTrue(GeoOctocube::getSector(10, 6, 4) == 6);
$this->assertTrue(GeoOctocube::getSector(-10, -6, 4) == 7);
$this->assertTrue(GeoOctocube::getSector(10, -6, 4) == 8);
}
+
}
diff --git a/dev/tests/GeoPlaceTest.php b/dev/tests/GeoPlaceTest.php
index d730a4a..70c1ed1 100644
--- a/dev/tests/GeoPlaceTest.php
+++ b/dev/tests/GeoPlaceTest.php
@@ -1,74 +1,76 @@
<?php
/**
* Unit testing : class GeoPlace
*
* Zed. The immensity of stars. The HyperShip. The people.
*
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
* @package Zed
* @subpackage Tests
* @author Sテゥbastien Santoro aka Dereckson <dereckson@espace-win.org>
* @copyright 2010 Sテゥbastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
*/
-require_once('../../includes/geo/place.php');
+use PHPUnit\Framework\TestCase;
+
+require_once(__DIR__ . '/../../includes/geo/place.php');
/**
* Test cases for the class GeoPlace
*/
-class GeoPlaceTest extends PHPUnit_Framework_TestCase {
+class GeoPlaceTest extends TestCase {
/**
* Tests the GeoPlace::is_valid_local_location($local_location) method.
*/
public function testIsValidLocation () {
//Testing HyperShip Tower T2C3 format
$p0 = new GeoPlace();
$p0->location_local_format = '/^T[1-9][0-9]*C[1-6]$/';
$this->assertTrue($p0->is_valid_local_location("T1C1")); // 1
$this->assertTrue($p0->is_valid_local_location("T14C1")); // 2
$this->assertTrue($p0->is_valid_local_location("T14C6")); // 3
$this->assertTrue($p0->is_valid_local_location("T140C6")); // 4
$this->assertTrue($p0->is_valid_local_location("T14000C6")); // 5
$this->assertFalse($p0->is_valid_local_location("C1T6")); // 6
$this->assertFalse($p0->is_valid_local_location("T14000 C6")); // 7
$this->assertFalse($p0->is_valid_local_location("T4C7")); // 8
$this->assertFalse($p0->is_valid_local_location("T4C0")); // 9
$this->assertFalse($p0->is_valid_local_location("T0C0")); //10
//Unit testing is useful: this test led to fix the regexp
//from T[0-9]+C[1-6] to T[1-9][0-9]*C[1-6]
$this->assertFalse($p0->is_valid_local_location("T0C1")); //11
//Testing default format
$p1 = new GeoPlace();
$this->assertTrue($p1->is_valid_local_location("(4,62,35)")); //12
$this->assertTrue($p1->is_valid_local_location("(4, 62, 35)")); //13
$this->assertTrue($p1->is_valid_local_location("(4, 62,35)")); //14
$this->assertFalse($p1->is_valid_local_location("(4,62,-35)")); //15
$this->assertFalse($p1->is_valid_local_location("(4, 62)")); //16
//Testing (x, y, -z) format
$p2 = new GeoPlace();
$p2->location_local_format = '/^\(\-?[0-9]+( )*,( )*\-?[0-9]+( )*,( )*\-?[0-9]+\)$/';
$this->assertTrue($p2->is_valid_local_location("(4,62,35)")); //17
$this->assertTrue($p2->is_valid_local_location("(4, 62, 35)")); //18
$this->assertTrue($p2->is_valid_local_location("(4, 62,35)")); //19
$this->assertTrue($p2->is_valid_local_location("(4,62,-35)")); //20
$this->assertFalse($p2->is_valid_local_location("(4,62,- 35)")); //21
$this->assertFalse($p2->is_valid_local_location("(4,62, - 35)")); //22
$this->assertFalse($p2->is_valid_local_location("(4, 62)")); //23
}
}
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..3d85e64
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="vendor/autoload.php"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ stopOnFailure="false">
+ <php>
+ <ini name="display_errors" value="On" />
+ <ini name="display_startup_errors" value="On" />
+ <ini name="error_reporting" value="On" />
+ </php>
+ <testsuites>
+ <testsuite name="Unit tests">
+ <directory suffix="Test.php">./dev/tests</directory>
+ </testsuite>
+ </testsuites>
+ <filter>
+ <whitelist processUncoveredFilesFromWhitelist="true">
+ <directory suffix=".php">controllers/</directory>
+ <directory suffix=".php">Engines/</directory>
+ <directory suffix=".php">includes/</directory>
+ </whitelist>
+ </filter>
+</phpunit>

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 15:38 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21091
Default Alt Text
(6 KB)

Event Timeline