Browse Source

Fix tests and geometry recognition in SQLServer

Maurits van der Schee 8 years ago
parent
commit
acf7dc15be
2 changed files with 11 additions and 3 deletions
  1. 1
    1
      api.php
  2. 10
    2
      tests/tests.php

+ 1
- 1
api.php View File

@@ -599,7 +599,7 @@ class SQLServer implements DatabaseInterface {
599 599
 	}
600 600
 
601 601
 	public function isGeometryType($field) {
602
-		return false;
602
+		return ($field->type==-151);
603 603
 	}
604 604
 
605 605
 	public function getDefaultCharset() {

+ 10
- 2
tests/tests.php View File

@@ -464,14 +464,22 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
464 464
 		$test->put('/users/1','{"location":"POINT(30 20)"}');
465 465
 		$test->expect('1');
466 466
 		$test->get('/users/1?columns=id,location');
467
-		$test->expect('{"id":"1","location":"POINT(30 20)"}');
467
+		if (PHP_CRUD_API_Config::$dbengine=='SQLServer') {
468
+			$test->expect('{"id":"1","location":"POINT (30 20)"}');
469
+		} else {
470
+			$test->expect('{"id":"1","location":"POINT(30 20)"}');
471
+		}
468 472
 	}
469 473
 
470 474
 	public function testListUserLocations()
471 475
 	{
472 476
 		$test = new API($this);
473 477
 		$test->get('/users?columns=id,location');
474
-		$test->expect('{"users":{"columns":["id","location"],"records":[["1","POINT(30 20)"]]}}');
478
+		if (PHP_CRUD_API_Config::$dbengine=='SQLServer') {
479
+			$test->expect('{"users":{"columns":["id","location"],"records":[["1","POINT (30 20)"]]}}');
480
+		} else {
481
+			$test->expect('{"users":{"columns":["id","location"],"records":[["1","POINT(30 20)"]]}}');
482
+		}
475 483
 	}
476 484
 
477 485
 	public function testEditUserWithId()

Loading…
Cancel
Save