Skip to content

Commit 9b28263

Browse files
committed
Cleanup after merge of #244
1 parent 4a517b9 commit 9b28263

11 files changed

+2
-2496
lines changed

tests/MysqlTest.php

Lines changed: 1 addition & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public function getCapabilities($db)
7979
public function seedDatabase($db, $capabilities)
8080
{
8181
$fixture = __DIR__.'/data/blog_mysql.sql';
82+
8283
$contents = file_get_contents($fixture);
8384

8485
if (!($capabilities & self::GIS)) {
@@ -98,121 +99,4 @@ public function seedDatabase($db, $capabilities)
9899
die("Loading '$fixture' failed on statemement #$i with error:\n".mysqli_error($db)."\n");
99100
}
100101
}
101-
102-
/**
103-
* Gets the path to the seed file based on the version of MySQL
104-
*
105-
* @return string
106-
*/
107-
protected static function getSeedFile()
108-
{
109-
if (static::$mysql_version >= self::MYSQL_57) {
110-
return __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']).'_57.sql';
111-
} elseif (static::$mysql_version >= self::MYSQL_56) {
112-
return __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']).'_56.sql';
113-
}
114-
return __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']).'_55.sql';
115-
}
116-
117-
public function testHidingPasswordColumn()
118-
{
119-
parent::testHidingPasswordColumn();
120-
}
121-
122-
public function testMissingIntermediateTable()
123-
{
124-
$test = new API($this, static::$config);
125-
$test->get('/users?include=posts,tags');
126-
$test->expect('{"users":{"columns":["id","username","location"],"records":[[1,"user1",null]]},"posts":{"relations":{"user_id":"users.id"},"columns":["id","user_id","category_id","content"],"records":[[1,1,1,"blog started"],[2,1,2,"It works!"]]},"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"]]}}');
127-
}
128-
129-
public function testEditUserPassword()
130-
{
131-
parent::testEditUserPassword();
132-
}
133-
134-
public function testEditUserLocation()
135-
{
136-
parent::testEditUserLocation();
137-
}
138-
139-
public function testListUserLocations()
140-
{
141-
parent::testListUserLocations();
142-
}
143-
144-
public function testEditUserWithId()
145-
{
146-
parent::testEditUserWithId();
147-
}
148-
149-
public function testReadOtherUser()
150-
{
151-
parent::testReadOtherUser();
152-
}
153-
154-
public function testEditOtherUser()
155-
{
156-
parent::testEditOtherUser();
157-
}
158-
159-
public function testSpatialFilterWithin()
160-
{
161-
if (static::$mysql_version < self::MYSQL_56) {
162-
$this->markTestSkipped("MySQL < 5.6 does not support JSON fields.");
163-
}
164-
parent::testSpatialFilterWithin();
165-
}
166-
167-
168-
public function testListProductsProperties()
169-
{
170-
if (static::$mysql_version < self::MYSQL_57) {
171-
$this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
172-
}
173-
parent::testListProductsProperties();
174-
}
175-
176-
public function testReadProductProperties()
177-
{
178-
if (static::$mysql_version < self::MYSQL_57) {
179-
$this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
180-
}
181-
parent::testReadProductProperties();
182-
}
183-
184-
public function testWriteProductProperties()
185-
{
186-
if (static::$mysql_version < self::MYSQL_57) {
187-
$this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
188-
}
189-
parent::testWriteProductProperties();
190-
}
191-
192-
public function testListProducts()
193-
{
194-
parent::testListProducts();
195-
}
196-
197-
public function testAddProducts()
198-
{
199-
if (static::$mysql_version < self::MYSQL_57) {
200-
$this->markTestSkipped("MySQL < 5.7 does not support JSON fields.");
201-
}
202-
parent::testAddProducts();
203-
}
204-
205-
public function testSoftDeleteProducts()
206-
{
207-
if (static::$mysql_version < self::MYSQL_57) {
208-
$test = new API($this, static::$config);
209-
$test->delete('/products/1');
210-
$test->expect('1');
211-
$test->get('/products?columns=id,deleted_at');
212-
$test->expect('{"products":{"columns":["id","deleted_at"],"records":[[1,"2013-12-11 11:10:09"]]}}');
213-
} else {
214-
parent::testSoftDeleteProducts();
215-
}
216-
}
217-
218102
}

tests/PostgresqlTest.php

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -95,108 +95,8 @@ public function seedDatabase($db,$capabilities)
9595
foreach ($queries as $i=>$query) {
9696
if (!pg_query($db, $query.';')) {
9797
$i++;
98-
die("Loading '$seed_file' failed on statemement #$i with error:\n".print_r( pg_last_error($db), true)."\n");
98+
die("Loading '$fixture' failed on statemement #$i with error:\n".print_r( pg_last_error($db), true)."\n");
9999
}
100100
}
101101
}
102-
103-
/**
104-
* Gets the path to the seed file based on the version of Postgres and GIS extension
105-
*
106-
* @return string
107-
*/
108-
protected function getSeedFile()
109-
{
110-
$filepath = __DIR__.'/data/blog_'.strtolower(static::$config['dbengine']);
111-
112-
if (version_compare(static::$pg_server_version, '9.4.0') >= 0 ) {
113-
$filepath .= '_94';
114-
} elseif (version_compare(static::$pg_server_version, '9.2.0') >= 0 ) {
115-
$filepath .= '_92';
116-
} else {
117-
$filepath .= '_91';
118-
}
119-
if (static::$gis_installed) {
120-
$filepath .= '_gis';
121-
}
122-
return $filepath.'.sql';
123-
}
124-
125-
/**
126-
* Determines whether the GIS extension is installed or not based on array of extensions.
127-
*
128-
* @return boolean
129-
*/
130-
protected function isGisInstalled($extensions = [])
131-
{
132-
static::$gis_installed = false;
133-
if ($extensions) {
134-
foreach ($extensions as $extension) {
135-
if ($extension['extname'] === 'postgis') {
136-
static::$gis_installed = true;
137-
break;
138-
}
139-
}
140-
}
141-
return static::$gis_installed;
142-
}
143-
144-
public function testSpatialFilterWithin()
145-
{
146-
if (!static::$gis_installed) {
147-
$this->markTestSkipped("Postgis not installed");
148-
}
149-
parent::testSpatialFilterWithin();
150-
}
151-
152-
public function testListProductsProperties()
153-
{
154-
if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
155-
$this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
156-
}
157-
parent::testListProductsProperties();
158-
}
159-
160-
public function testReadProductProperties()
161-
{
162-
if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
163-
$this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
164-
}
165-
parent::testReadProductProperties();
166-
}
167-
168-
public function testWriteProductProperties()
169-
{
170-
if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
171-
$this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
172-
}
173-
parent::testWriteProductProperties();
174-
}
175-
176-
public function testListProducts()
177-
{
178-
parent::testListProducts();
179-
}
180-
181-
public function testAddProducts()
182-
{
183-
if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
184-
$this->markTestSkipped("Postgres < 9.2.0 does not support JSON fields.");
185-
}
186-
parent::testAddProducts();
187-
}
188-
189-
public function testSoftDeleteProducts()
190-
{
191-
if (version_compare(static::$pg_server_version, '9.2.0') < 0) {
192-
$test = new API($this, static::$config);
193-
$test->delete('/products/1');
194-
$test->expect('1');
195-
$test->get('/products?columns=id,deleted_at');
196-
$test->expect('{"products":{"columns":["id","deleted_at"],"records":[[1,"2013-12-11 11:10:09"]]}}');
197-
} else {
198-
parent::testSoftDeleteProducts();
199-
}
200-
}
201-
202102
}
File renamed without changes.

tests/data/blog_mysql_55.sql

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)