diff --git a/src/core/Directus/Database/Query/Builder.php b/src/core/Directus/Database/Query/Builder.php index c5815d0f8c..3add38dcd7 100644 --- a/src/core/Directus/Database/Query/Builder.php +++ b/src/core/Directus/Database/Query/Builder.php @@ -267,9 +267,9 @@ public function orWhereIn($column, $values, $not = false) * * @return Builder */ - public function whereNotIn($column, array $values) + public function whereNotIn($column, $values, $not = false, $logical = 'and') { - return $this->whereIn($column, $values, true); + return $this->whereIn($column, $values, true, $logical); } public function whereBetween($column, array $values, $not = false, $logical = 'and') @@ -277,9 +277,9 @@ public function whereBetween($column, array $values, $not = false, $logical = 'a return $this->where($column, 'between', $values, $not, $logical); } - public function whereNotBetween($column, array $values) + public function whereNotBetween($column, $values, $not = false, $logical = 'and') { - return $this->whereBetween($column, $values, true); + return $this->whereBetween($column, $values, true, $logical); } public function whereEqualTo($column, $value, $not = false, $logical = 'and') @@ -292,29 +292,29 @@ public function orWhereEqualTo($column, $value, $not = false) return $this->where($column, '=', $value, $not, 'or'); } - public function whereNotEqualTo($column, $value) + public function whereNotEqualTo($column, $value, $not = false, $logical = 'and') { - return $this->whereEqualTo($column, $value, true); + return $this->whereEqualTo($column, $value, true, $logical); } - public function whereLessThan($column, $value) + public function whereLessThan($column, $value, $not = false, $logical = 'and') { - return $this->where($column, '<', $value); + return $this->where($column, '<', $value, $not, $logical); } - public function whereLessThanOrEqual($column, $value) + public function whereLessThanOrEqual($column, $value, $not = false, $logical = 'and') { - return $this->where($column, '<=', $value); + return $this->where($column, '<=', $value, $not, $logical); } - public function whereGreaterThan($column, $value) + public function whereGreaterThan($column, $value, $not = false, $logical = 'and') { - return $this->where($column, '>', $value); + return $this->where($column, '>', $value, $not, $logical); } - public function whereGreaterThanOrEqual($column, $value) + public function whereGreaterThanOrEqual($column, $value, $not = false, $logical = 'and') { - return $this->where($column, '>=', $value); + return $this->where($column, '>=', $value, $not, $logical); } public function whereNull($column, $not = false, $logical = 'and') @@ -342,9 +342,9 @@ public function orWhereLike($column, $value, $not = false) return $this->whereLike($column, $value, $not, 'or'); } - public function whereNotLike($column, $value) + public function whereNotLike($column, $value, $not = false, $logical = 'and') { - return $this->whereLike($column, $value, true); + return $this->whereLike($column, $value, true, $logical); } public function whereAll($column, $table, $columnLeft, $columnRight, $values) @@ -759,6 +759,8 @@ protected function buildConditionExpression($condition) $operator = $notChar . $condition['operator']; $column = $condition['column']; + echo "hiii
";
+        print_r($column);
         $identifier = $this->getIdentifier($column);
         $value = $condition['value'];
 
diff --git a/tests/api/AuthTest.php b/tests/api/AuthTest.php
deleted file mode 100644
index 9e590b6a23..0000000000
--- a/tests/api/AuthTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-http = new GuzzleHttp\Client([
-            'base_uri' => 'http://localhost/directus-api/public/_/',
-            'exceptions' => false
-        ]);
-    }
-
-    public function tearDown() {
-        $this->http = null;
-    }
-    
-    public function testAuthentication()
-    {
-
-        $data = [
-            'form_params' => [
-                'email' => "admin@example.com",
-                'password' => "password"
-            ]
-        ];
-        
-        $response = $this->http->request('POST', 'auth/authenticate', $data);
-        
-        $this->assertEquals(200, $response->getStatusCode());
-        $data = json_decode($response->getBody(true), true);
-        $this->assertArrayHasKey('token', $data['data']);
-        $this->assertTrue(!empty($data['data']['token']));
-        
-    }
-    
-    public function testForgotPassword()
-    {
-
-        $data = [
-            'form_params' => [
-                'email' => "admin@example.com"
-            ]
-        ];
-        
-        $response = $this->http->request('POST', 'auth/password/request', $data);
-        
-        $this->assertEquals(200, $response->getStatusCode());
-        $data = json_decode($response->getBody(true), true);
-        $this->assertTrue($data['public']);
-        
-    }
-}
\ No newline at end of file
diff --git a/tests/api/CollectionTest.php b/tests/api/CollectionTest.php
deleted file mode 100644
index c97cf7f681..0000000000
--- a/tests/api/CollectionTest.php
+++ /dev/null
@@ -1,156 +0,0 @@
-http = new GuzzleHttp\Client([
-            'base_uri' => 'http://localhost/directus-api/public/_/',
-            'exceptions' => false
-        ]);
-        
-        //Get token
-        $data = [
-            'form_params' => [
-                'email' => "admin@example.com",
-                'password' => "password"
-            ]
-        ];
-        
-        $response = $this->http->request('POST', 'auth/authenticate', $data);
-        $data = json_decode($response->getBody(true), true);
-        $this->token = $data['data']['token'];
-        
-    }
-
-    public function tearDown() {
-        $this->http = null;
-    }
-    
-    public function testCreateCollection()
-    {
-        $data = [
-            'headers' => ['Authorization' => 'bearer '.$this->token],
-            'form_params' => json_decode('{
-                    "collection": "test111_collection",
-                    "hidden": 0,
-                    "fields": [{
-                        "type": "integer",
-                        "datatype": "INT",
-                        "length": 15,
-                        "field": "id",
-                        "interface": "primary-key",
-                        "auto_increment": true,
-                        "primary_key": true,
-                        "hidden_detail": true,
-                        "hidden_browse": true
-                    }, {
-                        "type": "status",
-                        "datatype": "VARCHAR",
-                        "length": 20,
-                        "field": "status",
-                        "interface": "status",
-                        "options": {
-                            "status_mapping": {
-                                "published": {
-                                    "name": "Published",
-                                    "text_color": "white",
-                                    "background_color": "accent",
-                                    "browse_subdued": false,
-                                    "browse_badge": true,
-                                    "soft_delete": false,
-                                    "published": true
-                                },
-                                "draft": {
-                                    "name": "Draft",
-                                    "text_color": "white",
-                                    "background_color": "blue-grey-200",
-                                    "browse_subdued": true,
-                                    "browse_badge": true,
-                                    "soft_delete": false,
-                                    "published": false
-                                },
-                                "deleted": {
-                                    "name": "Deleted",
-                                    "text_color": "white",
-                                    "background_color": "red",
-                                    "browse_subdued": true,
-                                    "browse_badge": true,
-                                    "soft_delete": true,
-                                    "published": false
-                                }
-                            }
-                        }
-                    }, {
-                        "type": "sort",
-                        "datatype": "INT",
-                        "field": "sort",
-                        "interface": "sort"
-                    }, {
-                        "type": "user_created",
-                        "datatype": "INT",
-                        "field": "created_by",
-                        "interface": "user-created",
-                        "options": {
-                                "template": "{{first_name}} {{last_name}}",
-                                "display": "both"
-                        },
-                        "readonly": true,
-                        "hidden_detail": true,
-                        "hidden_browse": true
-                    }, {
-                        "type": "datetime_created",
-                        "datatype": "DATETIME",
-                        "field": "created_on",
-                        "interface": "datetime-created",
-                        "readonly": true,
-                        "hidden_detail": true,
-                        "hidden_browse": true
-                    }, {
-                        "type": "user_updated",
-                        "datatype": "INT",
-                        "field": "modified_by",
-                        "interface": "user-updated",
-                        "options": {
-                            "template": "{{first_name}} {{last_name}}",
-                            "display": "both"
-                        },
-                        "readonly": true,
-                        "hidden_detail": true,
-                        "hidden_browse": true
-                    }, {
-                        "type": "datetime_updated",
-                        "datatype": "DATETIME",
-                        "field": "modified_on",
-                        "interface": "datetime-updated",
-                        "readonly": true,
-                        "hidden_detail": true,
-                        "hidden_browse": true
-                    }]
-                }',true)
-        ];
-        
-        //echo "
";
-        //print_r($data);exit;
-        $response = $this->http->request('POST', 'collections', $data);
-        $this->assertEquals(200, $response->getStatusCode());
-        $data = json_decode($response->getBody(true), true);
-        $this->assertArrayHasKey('collection', $data['data']);
-        $this->assertTrue(!empty($data['data']['collection']));
-    }
-    
-    public function testDeleteCollection()
-    {
-        $data = [
-            'headers' => ['Authorization' => 'bearer '.$this->token],
-        ];
-        
-        $response = $this->http->request('DELETE', 'collections/test111_collection', $data);
-        
-        $this->assertEquals(204, $response->getStatusCode());        
-    }
-    
-}
\ No newline at end of file