Update file headers
This commit is contained in:
parent
f0373e468e
commit
c735c27559
130
.gitignore
vendored
130
.gitignore
vendored
@ -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/*
|
||||
|
@ -24,3 +24,8 @@ test:7.1:
|
||||
image: php:7.1
|
||||
script:
|
||||
- phpunit -c build --no-coverage
|
||||
|
||||
test:7.2:
|
||||
image: php:7.2
|
||||
script:
|
||||
- phpunit -c build --no-coverage
|
||||
|
@ -3,11 +3,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
@ -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 "<?php\n" . $tokens[1][1];
|
||||
}
|
||||
// If there is a declare strict types,
|
||||
else if ($tokens[1][0] === T_DECLARE && $tokens[9][0] === T_DOC_COMMENT)
|
||||
{
|
||||
// '<?php' and 'declare(strict_types=1);' makes for 8 tokens
|
||||
// replace it all
|
||||
return "<?php\ndeclare(strict_types=1);\n" . $tokens[9][1];
|
||||
}
|
||||
else if ($tokens[1][0] !== T_DOC_COMMENT)
|
||||
{
|
||||
return "<?php";
|
||||
}
|
||||
// Tokens have the follow structure if arrays:
|
||||
// [0] => 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 = "<?php declare(strict_types=1);\n{$header}";
|
||||
if (stripos($source, 'namespace') === FALSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_source = str_replace($text_to_replace, $new_text, $source);
|
||||
file_put_contents($file, $new_source);
|
||||
$tokens = get_tokens($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)
|
||||
{
|
||||
$files = glob_recursive($glob);
|
||||
replace_files($files, '/header_comment.txt');
|
||||
$files = glob_recursive($glob);
|
||||
replace_files($files, '/header_comment.txt');
|
||||
}
|
||||
|
||||
echo "Successfully updated headers \n";
|
@ -44,7 +44,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"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"
|
||||
},
|
||||
"scripts-descriptions": {
|
||||
|
6
phpstan.neon
Normal file
6
phpstan.neon
Normal 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_]+\(\)#'
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query;
|
||||
|
||||
use PDOStatement;
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query\Drivers;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query\Drivers;
|
||||
|
||||
/**
|
||||
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query\Drivers;
|
||||
|
||||
/**
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query\Drivers;
|
||||
|
||||
use PDO;
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query\Drivers;
|
||||
|
||||
/**
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -4,15 +4,14 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
||||
namespace Query;
|
||||
|
||||
use PDOStatement;
|
||||
|
@ -4,11 +4,11 @@
|
||||
*
|
||||
* SQL Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* PHP version 7
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @package Query
|
||||
* @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
|
||||
* @link https://git.timshomepage.net/aviat4ion/Query
|
||||
*/
|
||||
|
@ -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(
|
||||
|
@ -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)';
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user