-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
484b1aa
commit 998a690
Showing
8 changed files
with
138 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 9 additions & 3 deletions
12
SemanticMaps/src/SM_GeoCoordsValue.php → src/Semantic/DataValues/CoordinateValue.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/Integration/Semantic/ValueDescriptions/AreaDescriptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Maps\Tests\Semantic\ValueDescriptions; | ||
|
||
use Maps\Semantic\ValueDescriptions\AreaDescription; | ||
use Maps\Semantic\ValueDescriptions\CoordinateDescription; | ||
use CoordinateValue; | ||
use SMW\DataValueFactory; | ||
use SMWDataItem; | ||
use SMWDIGeoCoord; | ||
|
||
/** | ||
* @covers \Maps\Semantic\ValueDescriptions\AreaDescription | ||
* | ||
* @licence GNU GPL v2+ | ||
* @author Jeroen De Dauw < jeroendedauw@gmail.com > | ||
*/ | ||
class AreaDescriptionTest extends \PHPUnit_Framework_TestCase { | ||
|
||
public function setUp() { | ||
if ( !defined( 'SMW_VERSION' ) ) { | ||
$this->markTestSkipped( 'SMW is not available' ); | ||
} | ||
} | ||
|
||
public function testGetBoundingBox() { | ||
$area = new AreaDescription( | ||
new SMWDIGeoCoord( 0, 0 ), | ||
SMW_CMP_EQ, | ||
'10 km' | ||
); | ||
|
||
$this->assertEquals( | ||
[ | ||
'north' => 0.089932160591873, | ||
'east' => 0.089932160591873, | ||
'south' => -0.089932160591873, | ||
'west' => -0.089932160591873 | ||
], | ||
$area->getBoundingBox() | ||
); | ||
} | ||
|
||
public function testGetSQLCondition() { | ||
$area = new AreaDescription( | ||
new SMWDIGeoCoord( 0, 0 ), | ||
SMW_CMP_EQ, | ||
'10 km' | ||
); | ||
|
||
$this->assertSame( | ||
'geo_table.lat_field < \'0.089932160591873\' AND geo_table.lat_field > \'-0.089932160591873\' ' | ||
. 'AND geo_table.long_field < \'0.089932160591873\' AND geo_table.long_field > \'-0.089932160591873\'', | ||
$area->getSQLCondition( 'geo_table', ['id_field', 'lat_field', 'long_field'], wfGetDB( DB_MASTER ) ) | ||
); | ||
} | ||
|
||
} |
Oops, something went wrong.