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
 	}
599
 	}
600
 
600
 
601
 	public function isGeometryType($field) {
601
 	public function isGeometryType($field) {
602
-		return false;
602
+		return ($field->type==-151);
603
 	}
603
 	}
604
 
604
 
605
 	public function getDefaultCharset() {
605
 	public function getDefaultCharset() {

+ 10
- 2
tests/tests.php View File

464
 		$test->put('/users/1','{"location":"POINT(30 20)"}');
464
 		$test->put('/users/1','{"location":"POINT(30 20)"}');
465
 		$test->expect('1');
465
 		$test->expect('1');
466
 		$test->get('/users/1?columns=id,location');
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
 	public function testListUserLocations()
474
 	public function testListUserLocations()
471
 	{
475
 	{
472
 		$test = new API($this);
476
 		$test = new API($this);
473
 		$test->get('/users?columns=id,location');
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
 	public function testEditUserWithId()
485
 	public function testEditUserWithId()

Loading…
Cancel
Save