Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Bump Drupal to 11.x #324

Merged
merged 13 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: "0 6 * * 2"

env:
DRUDBAL_DRUPAL_VERSION: "10.1.x"
DRUDBAL_DRUPAL_VERSION: "11.x"

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- cron: "0 6 * * 2"

env:
DRUDBAL_DRUPAL_VERSION: "10.1.x"
DRUDBAL_DRUPAL_VERSION: "11.x"
DRUDBAL_DRUPAL_PROFILE: "standard"
SIMPLETEST_BASE_URL: "http://localhost:8080"
PHPUNIT_SKIP_CLASS: '[
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysqli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- cron: "0 6 * * 2"

env:
DRUDBAL_DRUPAL_VERSION: "10.1.x"
DRUDBAL_DRUPAL_VERSION: "11.x"
DRUDBAL_DRUPAL_PROFILE: "standard"
SIMPLETEST_BASE_URL: "http://localhost:8080"
PHPUNIT_SKIP_CLASS: '[
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ on:
- cron: "0 6 * * 2"

env:
DRUDBAL_DRUPAL_VERSION: "10.1.x"
DRUDBAL_DRUPAL_VERSION: "11.x"
DRUDBAL_DRUPAL_PROFILE: "standard"
SIMPLETEST_BASE_URL: "http://localhost:8080"
PHPUNIT_SKIP_CLASS: '[
"Drupal\\KernelTests\\Core\\Cache\\ApcuBackendTest",
"Drupal\\Tests\\file\\Functional\\FileAddPermissionsUpdateTest",
"Drupal\\KernelTests\\Core\\Database\\SchemaUniquePrefixedKeysIndexTest"
"Drupal\\Tests\\file\\Functional\\FileAddPermissionsUpdateTest"
]'

jobs:
Expand Down
174 changes: 77 additions & 97 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,103 +5,83 @@ on:
branches: [ master ]

env:
DRUDBAL_DRUPAL_VERSION: "10.1.x"
DRUDBAL_DRUPAL_PROFILE: "standard"
SIMPLETEST_BASE_URL: "http://localhost:8080"
PHPUNIT_SKIP_CLASS: '[
"Drupal\\KernelTests\\Core\\Cache\\ApcuBackendTest",
"Drupal\\Tests\\file\\Functional\\FileAddPermissionsUpdateTest",
"Drupal\\KernelTests\\Core\\Database\\SchemaUniquePrefixedKeysIndexTest"
]'
DRUDBAL_DRUPAL_VERSION: "11.x"
DRUDBAL_DRUPAL_PROFILE: "standard"
SIMPLETEST_BASE_URL: "http://localhost:8080"
PHPUNIT_SKIP_CLASS: '[
"Drupal\\KernelTests\\Core\\Cache\\ApcuBackendTest",
"Drupal\\Tests\\file\\Functional\\FileAddPermissionsUpdateTest",
"Drupal\\Tests\\file\\Functional\\DownloadTest"
]'

jobs:

#################################

oracle-oci8:
name: "Oracle on Oci8"
runs-on: ubuntu-20.04
env:
DRUDBAL_ENV: "dbal/oci8"
DBAL_URL: "oci8://DRUDBAL:[email protected]:1521/XE"
SIMPLETEST_DB: "dbal://DRUDBAL:[email protected]:1521/XE?module=drudbal&dbal_driver=oci8#dru"

services:
oracle:
image: gvenzl/oracle-xe:slim-faststart
env:
ORACLE_PASSWORD: oracle
ports:
- "1521:1521"
options: >-
--health-cmd healthcheck.sh
--health-interval 20s
--health-timeout 10s
--health-retries 10

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
test-args:
# - "-v modules/contrib/drudbal/tests/src/Kernel/dbal/SchemaTest.php"
- "--group Database"
# - "--group Entity"
# - "--group Cache,Config"
# - "--group field,Field"
# - "--group file"
# - "--group views"

steps:
- name: Install PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
extensions: "oci8"
ini-values: "zend.assertions=1"

- name: Checkout Drupal
run: git clone --depth=5 --branch=$DRUDBAL_DRUPAL_VERSION http://git.drupal.org/project/drupal.git .

- name: Checkout DruDbal
uses: actions/checkout@v3
with:
path: drudbal_staging

- name: Patch Drupal
run: ./drudbal_staging/tests/github/drupal_patch.sh

- name: Install Composer dependencies
run: |
composer install --no-progress --ansi
composer config --no-plugins allow-plugins.composer/package-versions-deprecated true

- name: Composer require DruDbal from local staging
run: |
git -C drudbal_staging checkout -b test-run-branch
composer config repositories.test-run '{"type": "path", "url": "drudbal_staging", "options": {"symlink": false}}'
composer require "mondrake/drudbal:dev-test-run-branch" --no-progress --ansi

- name: Create Oracle schema
run: |
cp modules/contrib/drudbal/tests/github/install_* .
php install_oracle.php

- name: Install Drupal
run: |
vendor/bin/drush site-install standard --db-url=$SIMPLETEST_DB -y
vendor/bin/drush runserver localhost:8080 --default-server=localhost:8080 &
sleep 5s

- name: Report installation
continue-on-error: true
run: |
php install_report.php
vendor/bin/drush core:status
vendor/bin/drush core:requirements
vendor/bin/drush pml --type=module --no-core

- name: Run test ${{ matrix.test-args }}
run: vendor/bin/phpunit -c core --color=always ${{ matrix.test-args }}
#################################

sqlite-pdo:
name: "SQLite with PDO"
runs-on: ubuntu-20.04
env:
DRUDBAL_ENV: "dbal/sqlite/file"
DBAL_URL: "sqlite://localhost/sites/drudbal.sqlite"
SIMPLETEST_DB: "dbal://localhost/sites/drudbal.sqlite?module=drudbal&dbal_driver=pdo_sqlite"

strategy:
fail-fast: false
matrix:
php-version:
# - "8.1"
- "8.2"
test-args:
- "--group Database"
# - "--group Entity"
# - "--group Cache,Config"
# - "--group field,Field"
# - "--group file"
# - "--group views"

steps:
- name: Install PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
ini-values: "zend.assertions=1"

- name: Checkout Drupal
run: git clone --depth=5 --branch=$DRUDBAL_DRUPAL_VERSION http://git.drupal.org/project/drupal.git .

- name: Checkout DruDbal
uses: actions/checkout@v3
with:
path: drudbal_staging

- name: Patch Drupal
run: ./drudbal_staging/tests/github/drupal_patch.sh

- name: Install Composer dependencies
run: |
composer install --no-progress --ansi

- name: Composer require DruDbal from local staging
run: |
git -C drudbal_staging checkout -b test-run-branch
composer config repositories.test-run '{"type": "path", "url": "drudbal_staging", "options": {"symlink": false}}'
composer require "mondrake/drudbal:dev-test-run-branch" --no-progress --ansi

- name: Install Drupal
run: |
cp modules/contrib/drudbal/tests/github/install_* .
vendor/bin/drush site-install standard --db-url=$SIMPLETEST_DB -y
vendor/bin/drush runserver localhost:8080 --default-server=localhost:8080 &
sleep 1s

- name: Report installation
run: |
php install_report.php
vendor/bin/drush core:status
vendor/bin/drush core:requirements
vendor/bin/drush pml --type=module --no-core

- name: Run test ${{ matrix.test-args }}
run: vendor/bin/phpunit -c core --color=always ${{ matrix.test-args }}
5 changes: 2 additions & 3 deletions .github/workflows/sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ on:
- cron: "0 6 * * 2"

env:
DRUDBAL_DRUPAL_VERSION: "10.1.x"
DRUDBAL_DRUPAL_VERSION: "11.x"
DRUDBAL_DRUPAL_PROFILE: "standard"
SIMPLETEST_BASE_URL: "http://localhost:8080"
PHPUNIT_SKIP_CLASS: '[
"Drupal\\KernelTests\\Core\\Cache\\ApcuBackendTest",
"Drupal\\Tests\\file\\Functional\\FileAddPermissionsUpdateTest",
"Drupal\\Tests\\file\\Functional\\DownloadTest",
"Drupal\\KernelTests\\Core\\Database\\SchemaUniquePrefixedKeysIndexTest"
"Drupal\\Tests\\file\\Functional\\DownloadTest"
]'

jobs:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ under the hood:

1. Requirements:
* PHP 8.1+
* latest Drupal development branch code, 10.1.x
* latest Drupal development branch code, 11.x
* codebase built via Composer

2. Get the DruDbal module from Packagist via Composer, it will install Doctrine
Expand Down Expand Up @@ -93,6 +93,5 @@ tbd | Add tests for
tbd | Ensure that when INSERTing a NULL value in a database column, SELECTing it back returns NULL and not empty string - for all fetch modes |
tbd | UpdateTestBase::runUpdate should reset database schema after updating |
[#2992274](https://www.drupal.org/project/drupal/issues/2992274) | Installer tests fail if contrib driver hides database credentials form fields |
[#3256642](https://www.drupal.org/project/drupal/issues/3256642) | Autoload classes of database drivers modules' dependencies |
[#3347497](https://www.drupal.org/project/drupal/issues/3347497) | Introduce a FetchModeTrait to allow emulating PDO fetch modes |
[#3355841](https://www.drupal.org/project/drupal/issues/3355841) | Allow DriverSpecificSchemaTestBase::testChangePrimaryKeyToSerial to execute for non-core drivers |
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"license": "LGPL-3.0-or-later",
"require": {
"php": ">=8.1",
"drupal/core": "^10.1",
"doctrine/dbal": "^3.5",
"drush/drush": "^11",
"drupal/core": "^11",
"doctrine/dbal": "^3.6",
"drush/drush": "^12",
"composer-runtime-api": "^2.0.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion drudbal.info.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: module
core_version_requirement: ^10.1
core_version_requirement: ^11
name: DruDbal
description: 'Drupal driver for Doctrine DBAL.'
lifecycle: experimental
Expand Down
9 changes: 9 additions & 0 deletions src/Driver/Database/dbal/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ public function mapConditionOperator($operator) {
* {@inheritdoc}
*/
public function nextId($existing_id = 0) {
@trigger_error('Drupal\Core\Database\Connection::nextId() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
$id = is_numeric($existing_id ?? 0) ? ($existing_id ?? 0) : 0;
return $this->dbalExtension->delegateNextId($id);
}
Expand Down Expand Up @@ -691,4 +692,12 @@ public function expandArrayParameters(string $sql, array $params, array $types):
$visitor->getTypes(),
];
}

public function query($query, array $args = [], $options = []) {
if ($this->dbalExtension->getDebugging()) {
dump([$query, $args]);
}
return parent::query($query, $args, $options);
}

}
7 changes: 4 additions & 3 deletions src/Driver/Database/dbal/DbalExtension/AbstractExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ public function delegateMapConditionOperator(string $operator): ?array {
* {@inheritdoc}
*/
public function delegateNextId(int $existing_id = 0): int {
throw new \LogicException("Method " . __METHOD__ . " not implemented.");
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
throw new \LogicException("Method " . __METHOD__ . " not implemented.");
}

/**
Expand Down Expand Up @@ -550,7 +551,7 @@ public function postDropTable(DbalSchema $dbal_schema, string $drupal_table_name
/**
* {@inheritdoc}
*/
public function delegateAddField(&$primary_key_processed_by_extension, DbalSchema $dbal_schema, $drupal_table_name, $field_name, array $drupal_field_specs, array $keys_new_specs, array $dbal_column_options) {
public function delegateAddField(bool &$primary_key_processed_by_extension, bool &$indexes_processed_by_extension, DbalSchema $dbal_schema, string $drupal_table_name, string $field_name, array $drupal_field_specs, array $keys_new_specs, array $dbal_column_options) {
return FALSE;
}

Expand Down Expand Up @@ -588,7 +589,7 @@ public function delegateDropField(bool &$delegatedResult, DbalSchema $dbal_schem
/**
* {@inheritdoc}
*/
public function delegateChangeField(&$primary_key_processed_by_extension, DbalSchema $dbal_schema, $drupal_table_name, $field_name, $field_new_name, array $drupal_field_new_specs, array $keys_new_specs, array $dbal_column_options) {
public function delegateChangeField(bool &$primary_key_processed_by_extension, bool &$indexes_processed_by_extension, DbalSchema $dbal_schema, string $drupal_table_name, string $field_name, string $field_new_name, array $drupal_field_new_specs, array $keys_new_specs, array $dbal_column_options) {
throw new \LogicException("Method " . __METHOD__ . " not implemented.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public function postCreateDatabase($database_name) {
* {@inheritdoc}
*/
public function delegateNextId(int $existing_id = 0): int {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
$this->connection->query('INSERT INTO {sequences} () VALUES ()');
$new_id = $this->connection->lastInsertId();
// This should only happen after an import or similar event.
Expand All @@ -227,6 +228,7 @@ public function delegateNextId(int $existing_id = 0): int {
* Cleanup next ID.
*/
protected function nextIdDelete() {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
// While we want to clean up the table to keep it up from occupying too
// much storage and memory, we must keep the highest value in the table
// because InnoDB uses an in-memory auto-increment counter as long as the
Expand Down Expand Up @@ -626,7 +628,7 @@ public function alterDbalColumnDefinition($context, &$dbal_column_definition, ar
/**
* {@inheritdoc}
*/
public function delegateAddField(&$primary_key_processed_by_extension, DbalSchema $dbal_schema, $drupal_table_name, $field_name, array $drupal_field_specs, array $keys_new_specs, array $dbal_column_options) {
public function delegateAddField(bool &$primary_key_processed_by_extension, bool &$indexes_processed_by_extension, DbalSchema $dbal_schema, string $drupal_table_name, string $field_name, array $drupal_field_specs, array $keys_new_specs, array $dbal_column_options) {
if (!empty($keys_new_specs['primary key']) && isset($drupal_field_specs['type']) && $drupal_field_specs['type'] == 'serial') {
$sql = 'ALTER TABLE {' . $drupal_table_name . '} ADD `' . $field_name . '` ' . $dbal_column_options['columnDefinition'];
$keys_sql = $this->createKeysSql(['primary key' => $keys_new_specs['primary key']]);
Expand All @@ -641,7 +643,7 @@ public function delegateAddField(&$primary_key_processed_by_extension, DbalSchem
/**
* {@inheritdoc}
*/
public function delegateChangeField(&$primary_key_processed_by_extension, DbalSchema $dbal_schema, $drupal_table_name, $field_name, $field_new_name, array $drupal_field_new_specs, array $keys_new_specs, array $dbal_column_options) {
public function delegateChangeField(bool &$primary_key_processed_by_extension, bool &$indexes_processed_by_extension, DbalSchema $dbal_schema, string $drupal_table_name, string $field_name, string $field_new_name, array $drupal_field_new_specs, array $keys_new_specs, array $dbal_column_options) {
$sql = 'ALTER TABLE {' . $drupal_table_name . '} CHANGE `' . $field_name . '` `' . $field_new_name . '` ' . $dbal_column_options['columnDefinition'];
if (!empty($keys_new_specs['primary key'])) {
$keys_sql = $this->createKeysSql(['primary key' => $keys_new_specs['primary key']]);
Expand Down
Loading