ENH Add CMS5 compatibility and re-enable builds (#69)

This commit is contained in:
Sabina Talipova 2023-03-03 10:50:02 +13:00 committed by GitHub
parent d45ec79b07
commit 83feb62e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 24 deletions

View File

@ -14,3 +14,21 @@ jobs:
# Only run cron on the silverstripe account
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
# set phpunit to false to prevent automatic generation of mysql phpunit jobs
phpunit: false
preserve_vendor_tests: true
extra_jobs: |
- php: 8.1
db: sqlite3
composer_args: --prefer-lowest
phpunit: true
phpunit_suite: all
- php: 8.1
db: sqlite3
phpunit: true
phpunit_suite: all
- php: 8.2
db: sqlite3
phpunit: true
phpunit_suite: all

View File

@ -1 +0,0 @@
<?php

0
_config/config.yml Normal file
View File

View File

@ -627,9 +627,9 @@ class SQLite3Database extends Database
// GLOB uses asterisks as wildcards.
// Replace them in search string, without replacing escaped percetage signs.
$comp = 'GLOB';
$value = preg_replace('/^%([^\\\\])/', '*$1', $value);
$value = preg_replace('/([^\\\\])%$/', '$1*', $value);
$value = preg_replace('/([^\\\\])%/', '$1*', $value);
$value = preg_replace('/^%([^\\\\])/', '*$1', $value ?? '');
$value = preg_replace('/([^\\\\])%$/', '$1*', $value ?? '');
$value = preg_replace('/([^\\\\])%/', '$1*', $value ?? '');
} else {
$comp = 'LIKE';
}

View File

@ -4,6 +4,7 @@ namespace SilverStripe\SQLite;
use SilverStripe\ORM\Connect\Query;
use SQLite3Result;
use Traversable;
/**
* A result-set from a SQLite3 database.
@ -43,16 +44,6 @@ class SQLite3Query extends Query
}
}
public function seek($row)
{
$this->handle->reset();
$i=0;
while ($i <= $row && $result = @$this->handle->fetchArray(SQLITE3_ASSOC)) {
$i++;
}
return $result;
}
/**
* @todo This looks terrible but there is no SQLite3::get_num_rows() implementation
*/
@ -62,7 +53,7 @@ class SQLite3Query extends Query
if (!$this->handle->numColumns()) {
return 0;
}
$this->handle->reset();
$c=0;
while ($this->handle->fetchArray()) {
@ -72,13 +63,10 @@ class SQLite3Query extends Query
return $c;
}
#[\ReturnTypeWillChange]
public function getIterator()
public function getIterator(): Traversable
{
if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
return $data;
} else {
return false;
while ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
yield $data;
}
}
}

View File

@ -692,7 +692,7 @@ class SQLite3SchemaManager extends DBSchemaManager
return (bool)$this->preparedQuery(
'SELECT "name" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?',
array('table', $tableName)
)->first();
)->record();
}
/**
@ -715,7 +715,7 @@ class SQLite3SchemaManager extends DBSchemaManager
$classnameinfo = $this->preparedQuery(
"SELECT EnumList FROM SQLiteEnums WHERE TableColumn = ?",
array($tablefield)
)->first();
)->record();
if ($classnameinfo) {
$valueList = $classnameinfo['EnumList'];
$this->enum_map[$tablefield] = $valueList;

View File

@ -18,7 +18,8 @@
"silverstripe/vendor-plugin": "^2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3"
"squizlabs/php_codesniffer": "^3",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {

8
phpunit.xml.dist Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="framework">
<directory>vendor/silverstripe/framework/tests/php</directory>
</testsuite>
</testsuites>
</phpunit>