From 10466dba9d7322ed55165dd9224edb2153c9b27a Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 15 Apr 2024 11:24:16 +0100
Subject: [PATCH] Issue #3420972 by quietone, andypost, smustgrave, catch,
 daffie: Add testing wtih SQLite 3.45

---
 .gitlab-ci.yml                                     | 14 +++++++-------
 .../src/Driver/Database/sqlite/Install/Tasks.php   |  2 +-
 .../BuildTests/TestSiteApplication/InstallTest.php |  5 +++++
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3ee9412967c6..c700aa6b507a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -229,10 +229,10 @@ default:
     _TARGET_PHP: "8.3"
     _TARGET_DB: "pgsql-16"
 
-'PHP 8.3 SQLite 3':
+'PHP 8.3 SQLite 3.45':
   <<: [ *default-stage, *run-on-mr ]
   variables:
-    _TARGET_PHP: "8.3"
+    _TARGET_PHP: "8.3-ubuntu"
     _TARGET_DB: "sqlite-3"
 
 # Jobs running on commits.
@@ -247,8 +247,8 @@ default:
   needs: [ '[Commit] PHP 8.3 MySQL 5.7' ]
   <<: [ *run-on-commit ]
 
-'[Commit] PHP 8.3 SQLite 3':
-  extends: 'PHP 8.3 SQLite 3'
+'[Commit] PHP 8.3 SQLite 3.45':
+  extends: 'PHP 8.3 SQLite 3.45'
   needs: [ '[Commit] PHP 8.3 PostgreSQL 16' ]
   <<: [ *run-on-commit ]
 
@@ -259,14 +259,14 @@ default:
   needs: [ 'DEFAULT: PHP 8.3 MySQL 8' ]
   <<: [ *run-daily ]
 
-'[Daily] PHP 8.3 SQLite 3':
-  extends: 'PHP 8.3 SQLite 3'
+'[Daily] PHP 8.3 SQLite 3.45':
+  extends: 'PHP 8.3 SQLite 3.45'
   needs: [ '[Daily] PHP 8.3 PostgreSQL 16' ]
   <<: [ *run-daily ]
 
 '[Daily] PHP 8.3 MariaDB 10.3.22':
   extends: 'PHP 8.3 MariaDB 10.3.22'
-  needs: [ '[Daily] PHP 8.3 SQLite 3' ]
+  needs: [ '[Daily] PHP 8.3 SQLite 3.45' ]
   <<: [ *run-daily ]
 
 ################
diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php b/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
index 4d262a5ac4a0..050dd2c3ceb6 100644
--- a/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
+++ b/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
@@ -18,7 +18,7 @@ class Tasks extends InstallTasks {
    * Use to build sqlite library with json1 option for JSON datatype support.
    * @see https://www.sqlite.org/json1.html
    */
-  const SQLITE_MINIMUM_VERSION = '3.26';
+  const SQLITE_MINIMUM_VERSION = '3.45';
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php b/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php
index a97099ecb1d1..f16e3b15c38c 100644
--- a/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php
+++ b/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php
@@ -5,6 +5,7 @@
 namespace Drupal\BuildTests\TestSiteApplication;
 
 use Drupal\BuildTests\Framework\BuildTestBase;
+use Drupal\sqlite\Driver\Database\sqlite\Install\Tasks;
 use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Process\PhpExecutableFinder;
 
@@ -15,6 +16,10 @@
 class InstallTest extends BuildTestBase {
 
   public function testInstall() {
+    $sqlite = (new \PDO('sqlite::memory:'))->query('select sqlite_version()')->fetch()[0];
+    if (version_compare($sqlite, Tasks::SQLITE_MINIMUM_VERSION) < 0) {
+      $this->markTestSkipped();
+    }
     $this->copyCodebase();
     $fs = new Filesystem();
     $fs->chmod($this->getWorkspaceDirectory() . '/sites/default', 0700, 0000);
-- 
GitLab