diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..182bc79 Binary files /dev/null and b/.DS_Store differ diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index fc6cd2e..0000000 --- a/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -indent_style = tab -indent_size = 4 -tab_width = 4 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3211485..0000000 --- a/.gitignore +++ /dev/null @@ -1,112 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -vendor -composer.lock - -.DS_Store -.github/ -doc/ - -.phpunit.result.cache - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 74dc9fc..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - /tests/* - /vendor/* - /.github/* - - diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index bcc5fa8..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - ./tests - - - \ No newline at end of file diff --git a/tests/CreateTest.php b/tests/CreateTest.php deleted file mode 100644 index 3d5d0e7..0000000 --- a/tests/CreateTest.php +++ /dev/null @@ -1,41 +0,0 @@ -column('ID')->bigInt()->unsigned()->autoIncrement()->primary()->required() - ->column('name')->string(255)->required() - ->column('email')->string(255)->default('nil') - ->index(['ID']) - ->getSql(); - - $this->assertSame($sql, $query); - } - - public function test_nullable() - { - $sql = "CREATE TABLE IF NOT EXISTS wp_test (secondary_email VARCHAR(255) DEFAULT 'NULL')"; - - $query = CreateApi::create('test') - ->column('secondary_email')->string(255)->default('NULL') - ->getSql(); - - $this->assertSame($sql, $query); - - $query = CreateApi::create('test') - ->column('secondary_email')->string(255)->nullable() - ->getSql(); - - $this->assertSame($sql, $query); - - } -} diff --git a/tests/SelectTest.php b/tests/SelectTest.php deleted file mode 100644 index fec6552..0000000 --- a/tests/SelectTest.php +++ /dev/null @@ -1,32 +0,0 @@ -from('posts') - ->getSql(); - - $this->assertSame($sql, $query); - } - - public function testDistinct() - { - $sql = 'SELECT DISTINCT * FROM wp_posts'; - $query = - SelectApi::select('*') - ->distinct() - ->from('posts') - ->getSql(); - - $this->assertSame($sql, $query); - } -} diff --git a/tests/Statement/CreateApi.php b/tests/Statement/CreateApi.php deleted file mode 100644 index dd52dba..0000000 --- a/tests/Statement/CreateApi.php +++ /dev/null @@ -1,36 +0,0 @@ -db = $db; - $this->table_name = $table_name; - $this->wpdb_object = new \stdClass; - $this->wpdb_object->prefix = 'wp_'; - - $this->start(); - $this->sql['table_name'] = $this->get_table_name(); - } - - public static function create($table_name) - { - $driver = new \stdClass; - $create = new self($driver, $table_name); - return $create; - } - - public function getSql() - { - $this->start(); - $query = SqlGenerator::create($this->sql); - - return $query; - } -} diff --git a/tests/Statement/SelectApi.php b/tests/Statement/SelectApi.php deleted file mode 100644 index 07b13ba..0000000 --- a/tests/Statement/SelectApi.php +++ /dev/null @@ -1,35 +0,0 @@ -db = $db; - $this->wpdb_object = new \stdClass; - $this->wpdb_object->prefix = 'wp_'; - } - - public static function select($colmns) - { - $driver = new \stdClass; - $select = new self($driver); - $select->columns($colmns); - return $select; - } - - public function getSql() - { - $this->start(); - $this->setAlias(); - $this->setStartExpression(); - $query = SqlGenerator::select($this->sql); - - return $query; - } -} diff --git a/tests/Statement/UpdateApi.php b/tests/Statement/UpdateApi.php deleted file mode 100644 index ad0c59c..0000000 --- a/tests/Statement/UpdateApi.php +++ /dev/null @@ -1,39 +0,0 @@ -db = $db; - $this->data = $data; - $this->wpdb_object = new \stdClass; - - $this->table_name = 'wp_' . $table_name; - $this->sql['set_columns'] = $this->set_columns(); - } - - public static function update(string $table_name, array $data) - { - $driver = new \stdClass; - $update = new self($driver, $table_name, $data); - return $update; - } - - public function getSql() - { - $this->start(); - $query = SqlGenerator::update($this->sql); - - return $query; - } - - public function getParams() - { - return $this->params; - } -} diff --git a/tests/UpdateTest.php b/tests/UpdateTest.php deleted file mode 100644 index 63756ff..0000000 --- a/tests/UpdateTest.php +++ /dev/null @@ -1,50 +0,0 @@ - 'Keramot UL', - 'email' => 'keramotul.islam@gmail.com' - ]) - ->getSql(); - - $this->assertEquals($sql, $query); - } - - public function testWhere() - { - $sql = 'UPDATE wp_querybuilders SET name=?, email=? WHERE ID = ?'; - $query = - UpdateApi::update('querybuilders', [ - 'name' => 'Keramot UL', - 'email' => 'keramotul.islam@gmail.com' - ]) - ->where('ID', '=', 1) - ->getSql(); - - $this->assertEquals($sql, $query); - } - - public function testParams() - { - $params = ['Keramot UL', 'keramotul.islam@gmail.com', 1]; - $query = - UpdateApi::update('querybuilders', [ - 'name' => 'Keramot UL', - 'email' => 'keramotul.islam@gmail.com' - ]) - ->where('ID', '=', 1) - ->getParams(); - - $this->assertEquals($params, $query); - } -}