Browse Source

Update file headers

keep-around/c735c27559da47b4d53867da59cd706e8048f4a0
Timothy Warren 1 year ago
parent
commit
c735c27559
35 changed files with 286 additions and 187 deletions
  1. +131
    -1
      .gitignore
  2. +7
    -2
      .gitlab-ci.yml
  3. +3
    -3
      build/header_comment.txt
  4. +59
    -50
      build/update_header_comments.php
  5. +1
    -1
      composer.json
  6. +6
    -0
      phpstan.neon
  7. +2
    -3
      src/Query/AbstractQueryBuilder.php
  8. +2
    -2
      src/Query/BadDBDriverException.php
  9. +2
    -2
      src/Query/ConnectionManager.php
  10. +2
    -3
      src/Query/Drivers/AbstractDriver.php
  11. +2
    -3
      src/Query/Drivers/AbstractSQL.php
  12. +2
    -3
      src/Query/Drivers/AbstractUtil.php
  13. +2
    -2
      src/Query/Drivers/DriverInterface.php
  14. +2
    -2
      src/Query/Drivers/Firebird/Driver.php
  15. +2
    -2
      src/Query/Drivers/Firebird/Result.php
  16. +2
    -2
      src/Query/Drivers/Firebird/SQL.php
  17. +2
    -2
      src/Query/Drivers/Firebird/Util.php
  18. +2
    -2
      src/Query/Drivers/Mysql/Driver.php
  19. +2
    -2
      src/Query/Drivers/Mysql/SQL.php
  20. +2
    -2
      src/Query/Drivers/Mysql/Util.php
  21. +2
    -2
      src/Query/Drivers/PDOInterface.php
  22. +2
    -3
      src/Query/Drivers/PDOStatementInterface.php
  23. +2
    -2
      src/Query/Drivers/Pgsql/Driver.php
  24. +2
    -2
      src/Query/Drivers/Pgsql/SQL.php
  25. +2
    -2
      src/Query/Drivers/Pgsql/Util.php
  26. +2
    -3
      src/Query/Drivers/SQLInterface.php
  27. +2
    -2
      src/Query/Drivers/Sqlite/Driver.php
  28. +2
    -2
      src/Query/Drivers/Sqlite/SQL.php
  29. +2
    -2
      src/Query/Drivers/Sqlite/Util.php
  30. +2
    -2
      src/Query/QueryBuilder.php
  31. +2
    -3
      src/Query/QueryBuilderInterface.php
  32. +2
    -2
      src/Query/QueryParser.php
  33. +2
    -19
      tests/bootstrap.php
  34. +8
    -18
      tests/databases/sqlite/SQLiteTest.php
  35. +17
    -34
      tests/index.php

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

+ 7
- 2
.gitlab-ci.yml View File

@@ -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
- phpunit -c build --no-coverage

test:7.2:
image: php:7.2
script:
- phpunit -c build --no-coverage

+ 3
- 3
build/header_comment.txt View File

@@ -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
*/
*/

+ 59
- 50
build/update_header_comments.php View File

@@ -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;
}

// 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";
}
$output = '';

// 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);

if (stripos($source, 'namespace') === FALSE)
{
continue;
}

$header = file_get_contents(__DIR__ . $template);
$new_text = "<?php declare(strict_types=1);\n{$header}";
$tokens = get_tokens($source);
$text_to_replace = get_text_to_replace($tokens);

$new_source = str_replace($text_to_replace, $new_text, $source);
file_put_contents($file, $new_source);
$header = file_get_contents(__DIR__ . $template);
$new_text = "<?php declare(strict_types=1);\n{$header}";

//break;
}
$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";
echo "Successfully updated headers \n";

+ 1
- 1
composer.json View File

@@ -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
- 0
phpstan.neon 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_]+\(\)#'

+ 2
- 3
src/Query/AbstractQueryBuilder.php View File

@@ -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;

+ 2
- 2
src/Query/BadDBDriverException.php View File

@@ -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
*/

+ 2
- 2
src/Query/ConnectionManager.php View File

@@ -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
*/

+ 2
- 3
src/Query/Drivers/AbstractDriver.php View File

@@ -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;

+ 2
- 3
src/Query/Drivers/AbstractSQL.php View File

@@ -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;

/**

+ 2
- 3
src/Query/Drivers/AbstractUtil.php View File

@@ -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;

/**

+ 2
- 2
src/Query/Drivers/DriverInterface.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Firebird/Driver.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Firebird/Result.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Firebird/SQL.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Firebird/Util.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Mysql/Driver.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Mysql/SQL.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Mysql/Util.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/PDOInterface.php View File

@@ -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
*/

+ 2
- 3
src/Query/Drivers/PDOStatementInterface.php View File

@@ -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;

+ 2
- 2
src/Query/Drivers/Pgsql/Driver.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Pgsql/SQL.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Pgsql/Util.php View File

@@ -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
*/

+ 2
- 3
src/Query/Drivers/SQLInterface.php View File

@@ -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;

/**

+ 2
- 2
src/Query/Drivers/Sqlite/Driver.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Sqlite/SQL.php View File

@@ -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
*/

+ 2
- 2
src/Query/Drivers/Sqlite/Util.php View File

@@ -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
*/

+ 2
- 2
src/Query/QueryBuilder.php View File

@@ -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
*/

+ 2
- 3
src/Query/QueryBuilderInterface.php View File

@@ -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;

+ 2
- 2
src/Query/QueryParser.php View File

@@ -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
*/

+ 2
- 19
tests/bootstrap.php View File

@@ -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
// End of bootstrap.php

+ 8
- 18
tests/databases/sqlite/SQLiteTest.php View File

@@ -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());
}
}
}

+ 17
- 34
tests/index.php View File

@@ -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
// End of index.php

Loading…
Cancel
Save