Update file headers

This commit is contained in:
Timothy Warren 2018-01-19 13:43:19 -05:00
parent f0373e468e
commit c735c27559
35 changed files with 285 additions and 186 deletions

132
.gitignore vendored
View File

@ -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 test_config.json
index.html index.html
tests/db_files/* tests/db_files/*
@ -15,4 +145,4 @@ vendor/*
composer.lock composer.lock
docs/phpdoc* docs/phpdoc*
.project .project
all_tests all_tests

View File

@ -19,8 +19,13 @@ test:7:
image: php:7 image: php:7
script: script:
- phpunit -c build --no-coverage - phpunit -c build --no-coverage
test:7.1: test:7.1:
image: php:7.1 image: php:7.1
script: script:
- phpunit -c build --no-coverage - phpunit -c build --no-coverage
test:7.2:
image: php:7.2
script:
- phpunit -c build --no-coverage

View File

@ -3,11 +3,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -2,81 +2,90 @@
declare(strict_types=1); declare(strict_types=1);
$file_patterns = [ $file_patterns = [
'src/*.php', 'src/**/*.php',
'tests/**/*.php', 'src/*.php',
'tests/**/*.php',
'tests/*.php',
'Robofile.php'
]; ];
if ( ! function_exists('glob_recursive')) if ( ! function_exists('glob_recursive'))
{ {
// Does not support flag GLOB_BRACE // Does not support flag GLOB_BRACE
function glob_recursive($pattern, $flags = 0) function glob_recursive($pattern, $flags = 0)
{ {
$files = glob($pattern, $flags); $files = glob($pattern, $flags);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir)
{ {
$files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags)); $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags));
} }
return $files; return $files;
} }
} }
function get_text_to_replace($tokens) function get_text_to_replace($tokens)
{ {
if ($tokens[0][0] !== T_OPEN_TAG) $output = '';
{
return NULL;
}
// If there is already a docblock, as the second token after the // Tokens have the follow structure if arrays:
// open tag, get the contents of that token to replace // [0] => token type constant
if ($tokens[1][0] === T_DOC_COMMENT) // [1] => raw sytax parsed to that token
{ // [2] => line number
return "<?php\n" . $tokens[1][1]; foreach($tokens as $token)
} {
// If there is a declare strict types, // Since we only care about opening docblocks,
else if ($tokens[1][0] === T_DECLARE && $tokens[9][0] === T_DOC_COMMENT) // bail out when we get to the namespace token
{ if (is_array($token) && $token[0] === T_NAMESPACE)
// '<?php' and 'declare(strict_types=1);' makes for 8 tokens {
// replace it all break;
return "<?php\ndeclare(strict_types=1);\n" . $tokens[9][1]; }
}
else if ($tokens[1][0] !== T_DOC_COMMENT) if (is_array($token))
{ {
return "<?php"; $token = $token[1];
} }
$output .= $token;
}
return $output;
} }
function get_tokens($source) function get_tokens($source)
{ {
return token_get_all($source); return token_get_all($source);
} }
function replace_files(array $files, $template) function replace_files(array $files, $template)
{ {
foreach ($files as $file) print_r($files);
{ foreach ($files as $file)
$source = file_get_contents($file); {
$tokens = get_tokens($source); $source = file_get_contents($file);
//print_r($tokens);
$text_to_replace = get_text_to_replace($tokens);
$header = file_get_contents(__DIR__ . $template); if (stripos($source, 'namespace') === FALSE)
$new_text = "<?php declare(strict_types=1);\n{$header}"; {
continue;
}
$new_source = str_replace($text_to_replace, $new_text, $source); $tokens = get_tokens($source);
file_put_contents($file, $new_source); $text_to_replace = get_text_to_replace($tokens);
//break; $header = file_get_contents(__DIR__ . $template);
} $new_text = "<?php declare(strict_types=1);\n{$header}";
$new_source = str_replace($text_to_replace, $new_text, $source);
file_put_contents($file, $new_source);
}
} }
foreach ($file_patterns as $glob) foreach ($file_patterns as $glob)
{ {
$files = glob_recursive($glob); $files = glob_recursive($glob);
replace_files($files, '/header_comment.txt'); replace_files($files, '/header_comment.txt');
} }
echo "Successfully updated headers \n"; echo "Successfully updated headers \n";

View File

@ -44,7 +44,7 @@
}, },
"scripts": { "scripts": {
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build", "coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
"phpstan": "phpstan analyse src tests", "phpstan": "phpstan analyse -l 3 -c phpstan.neon src tests",
"test": "vendor/bin/phpunit" "test": "vendor/bin/phpunit"
}, },
"scripts-descriptions": { "scripts-descriptions": {

6
phpstan.neon Normal file
View File

@ -0,0 +1,6 @@
parameters:
autoload_files:
- %rootDir%/../../../tests/bootstrap.php
ignoreErrors:
- '#Access to an undefined property Aviat\\\Ion\\\Friend::\$[a-zA-Z0-9_]+#'
- '#Call to an undefined method Aviat\\\Ion\\\Friend::[a-zA-Z0-9_]+\(\)#'

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query; namespace Query;
use PDOStatement; use PDOStatement;

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query\Drivers; namespace Query\Drivers;
use InvalidArgumentException; use InvalidArgumentException;

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query\Drivers; namespace Query\Drivers;
/** /**

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query\Drivers; namespace Query\Drivers;
/** /**

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query\Drivers; namespace Query\Drivers;
use PDO; use PDO;

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query\Drivers; namespace Query\Drivers;
/** /**

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -4,15 +4,14 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */
namespace Query; namespace Query;
use PDOStatement; use PDOStatement;

View File

@ -4,11 +4,11 @@
* *
* SQL Query Builder / Database Abstraction Layer * SQL Query Builder / Database Abstraction Layer
* *
* PHP version 7 * PHP version 7.1
* *
* @package Query * @package Query
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2012 - 2016 Timothy J. Warren * @copyright 2012 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link https://git.timshomepage.net/aviat4ion/Query * @link https://git.timshomepage.net/aviat4ion/Query
*/ */

View File

@ -21,27 +21,10 @@ define('QBASE_DIR', realpath(QTEST_DIR.'/../') . '/');
define('QDS', DIRECTORY_SEPARATOR); define('QDS', DIRECTORY_SEPARATOR);
// Set up autoloader // 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() function get_json_config()
{ {
$files = array( $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'); require_once(QTEST_DIR . '/core/base_query_builder_test.php');
// End of bootstrap.php // End of bootstrap.php

View File

@ -52,13 +52,13 @@ class SQLiteTest extends DBTest {
//Check //Check
$dbs = self::$db->getTables(); $dbs = self::$db->getTables();
$this->assertTrue(in_array('TEST1', $dbs)); $this->assertTrue(in_array('TEST1', $dbs, TRUE));
$this->assertTrue(in_array('TEST2', $dbs)); $this->assertTrue(in_array('TEST2', $dbs, TRUE));
$this->assertTrue(in_array('NUMBERS', $dbs)); $this->assertTrue(in_array('NUMBERS', $dbs, TRUE));
$this->assertTrue(in_array('NEWTABLE', $dbs)); $this->assertTrue(in_array('NEWTABLE', $dbs, TRUE));
$this->assertTrue(in_array('create_test', $dbs)); $this->assertTrue(in_array('create_test', $dbs, TRUE));
$this->assertTrue(in_array('create_join', $dbs)); $this->assertTrue(in_array('create_join', $dbs, TRUE));
$this->assertTrue(in_array('create_delete', $dbs)); $this->assertTrue(in_array('create_delete', $dbs, TRUE));
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -224,11 +224,6 @@ SQL;
public function testCommitTransaction() public function testCommitTransaction()
{ {
if (IS_QUERCUS)
{
$this->markTestSkipped("JDBC Driver doesn't support transactions");
}
$res = self::$db->beginTransaction(); $res = self::$db->beginTransaction();
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)'; $sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (10, 12, 14)';
@ -242,11 +237,6 @@ SQL;
public function testRollbackTransaction() public function testRollbackTransaction()
{ {
if (IS_QUERCUS)
{
$this->markTestSkipped("JDBC Driver doesn't support transactions");
}
$res = self::$db->beginTransaction(); $res = self::$db->beginTransaction();
$sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)'; $sql = 'INSERT INTO "create_test" ("id", "key", "val") VALUES (182, 96, 43)';
@ -314,4 +304,4 @@ SQL;
{ {
$this->assertNull(self::$db->getProcedures()); $this->assertNull(self::$db->getProcedures());
} }
} }

View File

@ -11,23 +11,6 @@
* @license http://philsturgeon.co.uk/code/dbad-license * @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() function get_json_config()
{ {
$files = array( $files = array(
@ -49,8 +32,8 @@ function get_json_config()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Set up autoloaders // Set up autoloaders
require_once(__DIR__ . '/../vendor/autoload.php'); require_once __DIR__ . '/../vendor/autoload.php';
require_once(__DIR__ . '/../vendor/simpletest/simpletest/autorun.php'); require_once __DIR__ . '/../vendor/simpletest/simpletest/autorun.php';
/** /**
* Base class for TestCases * Base class for TestCases
@ -150,11 +133,11 @@ define('QDS', DIRECTORY_SEPARATOR);
$testPath = QTEST_DIR.'/databases/'; $testPath = QTEST_DIR.'/databases/';
// Require base testing classes // Require base testing classes
require_once(QTEST_DIR . '/core/core_test.php'); require_once QTEST_DIR . '/core/core_test.php';
require_once(QTEST_DIR . '/core/connection_manager_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/base_db_test.php';
require_once(QTEST_DIR . '/core/query_parser_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/base_query_builder_test.php';
$drivers = PDO::getAvailableDrivers(); $drivers = PDO::getAvailableDrivers();
@ -163,23 +146,23 @@ if (function_exists('fbird_connect'))
$drivers[] = 'interbase'; $drivers[] = 'interbase';
} }
$driverTestMap = array( $driverTestMap = [
'MySQL' => in_array('mysql', $drivers), 'MySQL' => in_array('mysql', $drivers, TRUE),
'SQLite' => in_array('sqlite', $drivers), 'SQLite' => in_array('sqlite', $drivers, TRUE),
'PgSQL' => in_array('pgsql', $drivers), 'PgSQL' => in_array('pgsql', $drivers, TRUE),
'Firebird' => in_array('interbase', $drivers), // 'Firebird' => in_array('interbase', $drivers),
//'PDOFirebird' => in_array('firebird', $drivers) //'PDOFirebird' => in_array('firebird', $drivers)
); ];
// Determine which testcases to load // Determine which testcases to load
foreach($driverTestMap as $name => $doLoad) foreach($driverTestMap as $name => $doLoad)
{ {
$path = $testPath . strtolower($name) . '/'; $path = $testPath . strtolower($name) . '/';
if ($doLoad && (! IS_QUERCUS)) if ($doLoad)
{ {
require_once("{$path}{$name}Test.php"); require_once "{$path}{$name}Test.php";
require_once("{$path}{$name}QBTest.php"); require_once "{$path}{$name}QBTest.php";
} }
} }
// End of index.php // End of index.php