prepare for geometry tests
This commit is contained in:
parent
0cd49e0079
commit
8cd1f22250
2 changed files with 20 additions and 7 deletions
|
|
@ -84,11 +84,24 @@ CREATE TABLE `users` (
|
|||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) COLLATE utf8_general_ci NOT NULL,
|
||||
`password` varchar(255) COLLATE utf8_general_ci NOT NULL,
|
||||
`location` point NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
INSERT INTO `users` (`id`, `username`, `password`) VALUES
|
||||
(1, 'user1', 'pass1'),
|
||||
(2, 'user2', 'pass2');
|
||||
INSERT INTO `users` (`id`, `username`, `password`, `location`) VALUES
|
||||
(1, 'user1', 'pass1', ST_GeomFromText('POINT (30 20)')),
|
||||
(2, 'user2', 'pass2', ST_GeomFromText('POINT (70 20)'));
|
||||
|
||||
DROP TABLE IF EXISTS `countries`;
|
||||
CREATE TABLE `countries` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`shape` polygon NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `countries` (`id`, `name`, `shape`) VALUES
|
||||
(1, 'Left', ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
|
||||
(2, 'Right', ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))'));
|
||||
|
||||
-- 2015-02-14 17:55:38
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
|
|||
public function testHidingPasswordColumn()
|
||||
{
|
||||
$test = new API($this);
|
||||
$test->get('/users?filter=id,eq,1&transform=1');
|
||||
$test->get('/users?columns=id,username&filter=id,eq,1&transform=1');
|
||||
$test->expect('{"users":[{"id":"1","username":"user1"}]}');
|
||||
}
|
||||
|
||||
|
|
@ -447,8 +447,8 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
|
|||
public function testMissingIntermediateTable()
|
||||
{
|
||||
$test = new API($this);
|
||||
$test->get('/users?include=posts,tags');
|
||||
$test->expect('{"users":{"columns":["id","username"],"records":[["1","user1"]]},"posts":{"relations":{"user_id":"users.id"},"columns":["id","user_id","category_id","content"],"records":[["1","1","1","blog started"],["2","1","2","\u20ac Hello world, \u039a\u03b1\u03bb\u03b7\u03bc\u1f73\u03c1\u03b1 \u03ba\u1f79\u03c3\u03bc\u03b5, \u30b3\u30f3\u30cb\u30c1\u30cf"],["5","1","1","#1"],["6","1","1","#2"],["7","1","1","#3"],["8","1","1","#4"],["9","1","1","#5"],["10","1","1","#6"],["11","1","1","#7"],["12","1","1","#8"],["14","1","1","#10"]]},"post_tags":{"relations":{"post_id":"posts.id"},"columns":["id","post_id","tag_id"],"records":[["1","1","1"],["2","1","2"],["3","2","1"],["4","2","2"]]},"tags":{"relations":{"id":"post_tags.tag_id"},"columns":["id","name"],"records":[["1","funny"],["2","important"]]}}');
|
||||
$test->get('/users?columns=users.username,posts.*,tags.*&include=posts,tags');
|
||||
$test->expect('{"users":{"columns":["id","username"],"records":[["1","user1"]]},"posts":{"relations":{"user_id":"users.id"},"columns":["id","user_id","category_id","content"],"records":[["1","1","1","blog started"],["2","1","2","\u20ac Hello world, \u039a\u03b1\u03bb\u03b7\u03bc\u1f73\u03c1\u03b1 \u03ba\u1f79\u03c3\u03bc\u03b5, \u30b3\u30f3\u30cb\u30c1\u30cf"],["5","1","1","#1"],["6","1","1","#2"],["7","1","1","#3"],["8","1","1","#4"],["9","1","1","#5"],["10","1","1","#6"],["11","1","1","#7"],["12","1","1","#8"],["14","1","1","#10"]]},"post_tags":{"relations":{"post_id":"posts.id"},"columns":["post_id","tag_id"],"records":[["1","1"],["1","2"],["2","1"],["2","2"]]},"tags":{"relations":{"id":"post_tags.tag_id"},"columns":["id","name"],"records":[["1","funny"],["2","important"]]}}');
|
||||
}
|
||||
|
||||
public function testEditUser()
|
||||
|
|
@ -464,7 +464,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
|
|||
$test = new API($this);
|
||||
$test->put('/users/1','{"id":"2","password":"testtest2"}');
|
||||
$test->expect('1');
|
||||
$test->get('/users/1');
|
||||
$test->get('/users/1?columns=id,username,password');
|
||||
$test->expect('{"id":"1","username":"user1","password":"testtest2"}');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue