From c735c27559da47b4d53867da59cd706e8048f4a0 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Fri, 19 Jan 2018 13:43:19 -0500 Subject: [PATCH] Update file headers --- .gitignore | 132 +++++++++++++++++++- .gitlab-ci.yml | 9 +- build/header_comment.txt | 6 +- build/update_header_comments.php | 107 ++++++++-------- composer.json | 2 +- phpstan.neon | 6 + src/Query/AbstractQueryBuilder.php | 5 +- src/Query/BadDBDriverException.php | 4 +- src/Query/ConnectionManager.php | 4 +- src/Query/Drivers/AbstractDriver.php | 5 +- src/Query/Drivers/AbstractSQL.php | 5 +- src/Query/Drivers/AbstractUtil.php | 5 +- src/Query/Drivers/DriverInterface.php | 4 +- src/Query/Drivers/Firebird/Driver.php | 4 +- src/Query/Drivers/Firebird/Result.php | 4 +- src/Query/Drivers/Firebird/SQL.php | 4 +- src/Query/Drivers/Firebird/Util.php | 4 +- src/Query/Drivers/Mysql/Driver.php | 4 +- src/Query/Drivers/Mysql/SQL.php | 4 +- src/Query/Drivers/Mysql/Util.php | 4 +- src/Query/Drivers/PDOInterface.php | 4 +- src/Query/Drivers/PDOStatementInterface.php | 5 +- src/Query/Drivers/Pgsql/Driver.php | 4 +- src/Query/Drivers/Pgsql/SQL.php | 4 +- src/Query/Drivers/Pgsql/Util.php | 4 +- src/Query/Drivers/SQLInterface.php | 5 +- src/Query/Drivers/Sqlite/Driver.php | 4 +- src/Query/Drivers/Sqlite/SQL.php | 4 +- src/Query/Drivers/Sqlite/Util.php | 4 +- src/Query/QueryBuilder.php | 4 +- src/Query/QueryBuilderInterface.php | 5 +- src/Query/QueryParser.php | 4 +- tests/bootstrap.php | 21 +--- tests/databases/sqlite/SQLiteTest.php | 26 ++-- tests/index.php | 51 +++----- 35 files changed, 285 insertions(+), 186 deletions(-) create mode 100644 phpstan.neon diff --git a/.gitignore b/.gitignore index 9c2a389..c6b05f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,133 @@ + +# Created by https://www.gitignore.io/api/linux,macos,windows,jetbrains+all + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Ruby plugin and RubyMine +/.rakeTasks + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### JetBrains+all Patch ### +# Ignores the whole idea folder +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +# End of https://www.gitignore.io/api/linux,macos,windows,jetbrains+all + + test_config.json index.html tests/db_files/* @@ -15,4 +145,4 @@ vendor/* composer.lock docs/phpdoc* .project -all_tests \ No newline at end of file +all_tests diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84438a6..7ec4944 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,8 +19,13 @@ test:7: image: php:7 script: - phpunit -c build --no-coverage - + test:7.1: image: php:7.1 script: - - phpunit -c build --no-coverage \ No newline at end of file + - phpunit -c build --no-coverage + +test:7.2: + image: php:7.2 + script: + - phpunit -c build --no-coverage diff --git a/build/header_comment.txt b/build/header_comment.txt index 6f87c80..3a2caa5 100644 --- a/build/header_comment.txt +++ b/build/header_comment.txt @@ -3,11 +3,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query - */ \ No newline at end of file + */ diff --git a/build/update_header_comments.php b/build/update_header_comments.php index 55ff43b..80645cb 100644 --- a/build/update_header_comments.php +++ b/build/update_header_comments.php @@ -2,81 +2,90 @@ declare(strict_types=1); $file_patterns = [ - 'src/*.php', - 'tests/**/*.php', + 'src/**/*.php', + 'src/*.php', + 'tests/**/*.php', + 'tests/*.php', + 'Robofile.php' ]; if ( ! function_exists('glob_recursive')) { - // Does not support flag GLOB_BRACE + // Does not support flag GLOB_BRACE - function glob_recursive($pattern, $flags = 0) - { - $files = glob($pattern, $flags); + function glob_recursive($pattern, $flags = 0) + { + $files = glob($pattern, $flags); - foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) - { - $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags)); - } + foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) + { + $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags)); + } - return $files; - } + return $files; + } } function get_text_to_replace($tokens) { - if ($tokens[0][0] !== T_OPEN_TAG) - { - return NULL; - } + $output = ''; - // If there is already a docblock, as the second token after the - // open tag, get the contents of that token to replace - if ($tokens[1][0] === T_DOC_COMMENT) - { - return " token type constant + // [1] => raw sytax parsed to that token + // [2] => line number + foreach($tokens as $token) + { + // Since we only care about opening docblocks, + // bail out when we get to the namespace token + if (is_array($token) && $token[0] === T_NAMESPACE) + { + break; + } + + if (is_array($token)) + { + $token = $token[1]; + } + + $output .= $token; + } + + return $output; } function get_tokens($source) { - return token_get_all($source); + return token_get_all($source); } function replace_files(array $files, $template) { - foreach ($files as $file) - { - $source = file_get_contents($file); - $tokens = get_tokens($source); -//print_r($tokens); - $text_to_replace = get_text_to_replace($tokens); + print_r($files); + foreach ($files as $file) + { + $source = file_get_contents($file); - $header = file_get_contents(__DIR__ . $template); - $new_text = " - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query; use PDOStatement; diff --git a/src/Query/BadDBDriverException.php b/src/Query/BadDBDriverException.php index e53fa83..2c059e5 100644 --- a/src/Query/BadDBDriverException.php +++ b/src/Query/BadDBDriverException.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/ConnectionManager.php b/src/Query/ConnectionManager.php index f894bda..81f76f0 100644 --- a/src/Query/ConnectionManager.php +++ b/src/Query/ConnectionManager.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/AbstractDriver.php b/src/Query/Drivers/AbstractDriver.php index 1f881ae..4c706a7 100644 --- a/src/Query/Drivers/AbstractDriver.php +++ b/src/Query/Drivers/AbstractDriver.php @@ -4,15 +4,14 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query\Drivers; use InvalidArgumentException; diff --git a/src/Query/Drivers/AbstractSQL.php b/src/Query/Drivers/AbstractSQL.php index cb04d09..46f7503 100644 --- a/src/Query/Drivers/AbstractSQL.php +++ b/src/Query/Drivers/AbstractSQL.php @@ -4,15 +4,14 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query\Drivers; /** diff --git a/src/Query/Drivers/AbstractUtil.php b/src/Query/Drivers/AbstractUtil.php index 15e2120..8b781a1 100644 --- a/src/Query/Drivers/AbstractUtil.php +++ b/src/Query/Drivers/AbstractUtil.php @@ -4,15 +4,14 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query\Drivers; /** diff --git a/src/Query/Drivers/DriverInterface.php b/src/Query/Drivers/DriverInterface.php index 55d7ce2..3eef138 100644 --- a/src/Query/Drivers/DriverInterface.php +++ b/src/Query/Drivers/DriverInterface.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Firebird/Driver.php b/src/Query/Drivers/Firebird/Driver.php index 1e3ccef..a0f5990 100644 --- a/src/Query/Drivers/Firebird/Driver.php +++ b/src/Query/Drivers/Firebird/Driver.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Firebird/Result.php b/src/Query/Drivers/Firebird/Result.php index 21672e2..c79aef3 100644 --- a/src/Query/Drivers/Firebird/Result.php +++ b/src/Query/Drivers/Firebird/Result.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Firebird/SQL.php b/src/Query/Drivers/Firebird/SQL.php index 4028948..98f7164 100644 --- a/src/Query/Drivers/Firebird/SQL.php +++ b/src/Query/Drivers/Firebird/SQL.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Firebird/Util.php b/src/Query/Drivers/Firebird/Util.php index fe8ccd3..42c81bc 100644 --- a/src/Query/Drivers/Firebird/Util.php +++ b/src/Query/Drivers/Firebird/Util.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Mysql/Driver.php b/src/Query/Drivers/Mysql/Driver.php index 6660142..8465e51 100644 --- a/src/Query/Drivers/Mysql/Driver.php +++ b/src/Query/Drivers/Mysql/Driver.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Mysql/SQL.php b/src/Query/Drivers/Mysql/SQL.php index 4f60a65..da1746e 100644 --- a/src/Query/Drivers/Mysql/SQL.php +++ b/src/Query/Drivers/Mysql/SQL.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Mysql/Util.php b/src/Query/Drivers/Mysql/Util.php index 633aa06..3b51988 100644 --- a/src/Query/Drivers/Mysql/Util.php +++ b/src/Query/Drivers/Mysql/Util.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/PDOInterface.php b/src/Query/Drivers/PDOInterface.php index 8593fb8..6518576 100644 --- a/src/Query/Drivers/PDOInterface.php +++ b/src/Query/Drivers/PDOInterface.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/PDOStatementInterface.php b/src/Query/Drivers/PDOStatementInterface.php index e465623..0b39eb3 100644 --- a/src/Query/Drivers/PDOStatementInterface.php +++ b/src/Query/Drivers/PDOStatementInterface.php @@ -4,15 +4,14 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query\Drivers; use PDO; diff --git a/src/Query/Drivers/Pgsql/Driver.php b/src/Query/Drivers/Pgsql/Driver.php index cb78626..6ead87c 100644 --- a/src/Query/Drivers/Pgsql/Driver.php +++ b/src/Query/Drivers/Pgsql/Driver.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Pgsql/SQL.php b/src/Query/Drivers/Pgsql/SQL.php index bf367b7..274945a 100644 --- a/src/Query/Drivers/Pgsql/SQL.php +++ b/src/Query/Drivers/Pgsql/SQL.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Pgsql/Util.php b/src/Query/Drivers/Pgsql/Util.php index f7d4aea..791c205 100644 --- a/src/Query/Drivers/Pgsql/Util.php +++ b/src/Query/Drivers/Pgsql/Util.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/SQLInterface.php b/src/Query/Drivers/SQLInterface.php index c5a1bad..abe81bf 100644 --- a/src/Query/Drivers/SQLInterface.php +++ b/src/Query/Drivers/SQLInterface.php @@ -4,15 +4,14 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query\Drivers; /** diff --git a/src/Query/Drivers/Sqlite/Driver.php b/src/Query/Drivers/Sqlite/Driver.php index 3584796..186aae6 100644 --- a/src/Query/Drivers/Sqlite/Driver.php +++ b/src/Query/Drivers/Sqlite/Driver.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Sqlite/SQL.php b/src/Query/Drivers/Sqlite/SQL.php index 2ded78a..93c1e1d 100644 --- a/src/Query/Drivers/Sqlite/SQL.php +++ b/src/Query/Drivers/Sqlite/SQL.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/Drivers/Sqlite/Util.php b/src/Query/Drivers/Sqlite/Util.php index 818ab47..f590131 100644 --- a/src/Query/Drivers/Sqlite/Util.php +++ b/src/Query/Drivers/Sqlite/Util.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/QueryBuilder.php b/src/Query/QueryBuilder.php index 490207b..91e9bf2 100644 --- a/src/Query/QueryBuilder.php +++ b/src/Query/QueryBuilder.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/src/Query/QueryBuilderInterface.php b/src/Query/QueryBuilderInterface.php index 859c04a..676d941 100644 --- a/src/Query/QueryBuilderInterface.php +++ b/src/Query/QueryBuilderInterface.php @@ -4,15 +4,14 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ - namespace Query; use PDOStatement; diff --git a/src/Query/QueryParser.php b/src/Query/QueryParser.php index c673161..4cccdb7 100644 --- a/src/Query/QueryParser.php +++ b/src/Query/QueryParser.php @@ -4,11 +4,11 @@ * * SQL Query Builder / Database Abstraction Layer * - * PHP version 7 + * PHP version 7.1 * * @package Query * @author Timothy J. Warren - * @copyright 2012 - 2016 Timothy J. Warren + * @copyright 2012 - 2018 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link https://git.timshomepage.net/aviat4ion/Query */ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c5b9d73..c02df2b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -21,27 +21,10 @@ define('QBASE_DIR', realpath(QTEST_DIR.'/../') . '/'); define('QDS', DIRECTORY_SEPARATOR); // Set up autoloader -require_once(QBASE_DIR . 'vendor/autoload.php'); +require_once QBASE_DIR . 'vendor/autoload.php'; // -------------------------------------------------------------------------- -/** - * Quercus detection for workarounds - */ -if ( ! defined('IS_QUERCUS')) -{ - if ( ! isset($_sERVERSOFTWARE)) - { - define('IS_QUERCUS', FALSE); - } - else - { - $test = strpos($_sERVER["SERVER_SOFTWARE"],'Quercus') !== FALSE; - define('IS_QUERCUS', $test); - unset($test); - } -} - function get_json_config() { $files = array( @@ -123,4 +106,4 @@ require_once(QTEST_DIR . '/core/base_db_test.php'); require_once(QTEST_DIR . '/core/base_query_builder_test.php'); -// End of bootstrap.php \ No newline at end of file +// End of bootstrap.php diff --git a/tests/databases/sqlite/SQLiteTest.php b/tests/databases/sqlite/SQLiteTest.php index 0c64ba0..619b25d 100644 --- a/tests/databases/sqlite/SQLiteTest.php +++ b/tests/databases/sqlite/SQLiteTest.php @@ -52,13 +52,13 @@ class SQLiteTest extends DBTest { //Check $dbs = self::$db->getTables(); - $this->assertTrue(in_array('TEST1', $dbs)); - $this->assertTrue(in_array('TEST2', $dbs)); - $this->assertTrue(in_array('NUMBERS', $dbs)); - $this->assertTrue(in_array('NEWTABLE', $dbs)); - $this->assertTrue(in_array('create_test', $dbs)); - $this->assertTrue(in_array('create_join', $dbs)); - $this->assertTrue(in_array('create_delete', $dbs)); + $this->assertTrue(in_array('TEST1', $dbs, TRUE)); + $this->assertTrue(in_array('TEST2', $dbs, TRUE)); + $this->assertTrue(in_array('NUMBERS', $dbs, TRUE)); + $this->assertTrue(in_array('NEWTABLE', $dbs, TRUE)); + $this->assertTrue(in_array('create_test', $dbs, TRUE)); + $this->assertTrue(in_array('create_join', $dbs, TRUE)); + $this->assertTrue(in_array('create_delete', $dbs, TRUE)); } // -------------------------------------------------------------------------- @@ -224,11 +224,6 @@ SQL; public function testCommitTransaction() { - if (IS_QUERCUS) - { - $this->markTestSkipped("JDBC Driver doesn't support transactions"); - } - $res = self::$db->beginTransaction(); $sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)'; @@ -242,11 +237,6 @@ SQL; public function testRollbackTransaction() { - if (IS_QUERCUS) - { - $this->markTestSkipped("JDBC Driver doesn't support transactions"); - } - $res = self::$db->beginTransaction(); $sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)'; @@ -314,4 +304,4 @@ SQL; { $this->assertNull(self::$db->getProcedures()); } -} \ No newline at end of file +} diff --git a/tests/index.php b/tests/index.php index efd0eeb..9fdb449 100644 --- a/tests/index.php +++ b/tests/index.php @@ -11,23 +11,6 @@ * @license http://philsturgeon.co.uk/code/dbad-license */ -/** - * Quercus detection for workarounds - */ -if ( ! defined('IS_QUERCUS')) -{ - if ( ! array_key_exists('SERVER_SOFTWARE', $_SERVER)) - { - define('IS_QUERCUS', FALSE); - } - else - { - $test = strpos($_SERVER["SERVER_SOFTWARE"],'Quercus') !== FALSE; - define('IS_QUERCUS', $test); - unset($test); - } -} - function get_json_config() { $files = array( @@ -49,8 +32,8 @@ function get_json_config() // -------------------------------------------------------------------------- // Set up autoloaders -require_once(__DIR__ . '/../vendor/autoload.php'); -require_once(__DIR__ . '/../vendor/simpletest/simpletest/autorun.php'); +require_once __DIR__ . '/../vendor/autoload.php'; +require_once __DIR__ . '/../vendor/simpletest/simpletest/autorun.php'; /** * Base class for TestCases @@ -150,11 +133,11 @@ define('QDS', DIRECTORY_SEPARATOR); $testPath = QTEST_DIR.'/databases/'; // Require base testing classes -require_once(QTEST_DIR . '/core/core_test.php'); -require_once(QTEST_DIR . '/core/connection_manager_test.php'); -require_once(QTEST_DIR . '/core/base_db_test.php'); -require_once(QTEST_DIR . '/core/query_parser_test.php'); -require_once(QTEST_DIR . '/core/base_query_builder_test.php'); +require_once QTEST_DIR . '/core/core_test.php'; +require_once QTEST_DIR . '/core/connection_manager_test.php'; +require_once QTEST_DIR . '/core/base_db_test.php'; +require_once QTEST_DIR . '/core/query_parser_test.php'; +require_once QTEST_DIR . '/core/base_query_builder_test.php'; $drivers = PDO::getAvailableDrivers(); @@ -163,23 +146,23 @@ if (function_exists('fbird_connect')) $drivers[] = 'interbase'; } -$driverTestMap = array( - 'MySQL' => in_array('mysql', $drivers), - 'SQLite' => in_array('sqlite', $drivers), - 'PgSQL' => in_array('pgsql', $drivers), - 'Firebird' => in_array('interbase', $drivers), +$driverTestMap = [ + 'MySQL' => in_array('mysql', $drivers, TRUE), + 'SQLite' => in_array('sqlite', $drivers, TRUE), + 'PgSQL' => in_array('pgsql', $drivers, TRUE), + // 'Firebird' => in_array('interbase', $drivers), //'PDOFirebird' => in_array('firebird', $drivers) -); +]; // Determine which testcases to load foreach($driverTestMap as $name => $doLoad) { $path = $testPath . strtolower($name) . '/'; - if ($doLoad && (! IS_QUERCUS)) + if ($doLoad) { - require_once("{$path}{$name}Test.php"); - require_once("{$path}{$name}QBTest.php"); + require_once "{$path}{$name}Test.php"; + require_once "{$path}{$name}QBTest.php"; } } -// End of index.php \ No newline at end of file +// End of index.php