Skip to content
Snippets Groups Projects
Unverified Commit 3011f112 authored by Frédéric G. Marand's avatar Frédéric G. Marand Committed by GitHub
Browse files

Issue #3301506 by webchick,reenaraghavan,fgm: Drupal 10 compatibility. (#71)

parent 9af07d0e
Branches
Tags 8.x-2.1-alpha2
No related merge requests found
......@@ -177,8 +177,9 @@ build:
analysis:
dependencies:
after:
- composer require --dev squizlabs/php_codesniffer:^3.5
- composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
- composer require --dev squizlabs/php_codesniffer:^3.6 drupal/coder:^8.3
tests:
override:
- command: phpcs-run
- command: php-scrutinizer-run
use_website_config: false
dist: bionic
dist: focal
language: php
sudo: true
os: linux
php:
- 7.4
- 8.0
- 8.1
services:
- mongodb
matrix:
jobs:
allow_failures:
- php: 8.0
- php: ~
fast_finish: true
env:
......@@ -35,26 +34,28 @@ cache:
- vendor
before_install:
# Ensure we have the latest packages, including SQLite
# Ensure we have the latest packages, including SQLite and MongoDB
- wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo tee /etc/apt/trusted.gpg.d/mongodb.asc
- echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
- sudo echo "deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse" >> /etc/apt/sources.list
- sudo apt-get -y update > /dev/null
- sudo apt-get -y install sqlite3/focal
- sudo apt-get -y install sqlite3/focal mongodb-mongosh/focal
- sudo apt-get -y install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
# Composer: update and add to PATH.
- sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
- source $HOME/.bashrc
# Force Composer 1 until all plugins support Composer 2.
- composer self-update --2
# Drush: 9.x prefers using a local version, so don't require it globally.
# MongoDB extension is preinstalled but not enabled by default.
# The MongoDB extension is preinstalled but not enabled by default.
- echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
install:
# install php packages required for running a web server from drush on php 7
# Install php packages required for running a web server from drush on php 8
# - sudo apt-get install -y --force-yes php-cgi php-mysql
- sudo apt-get install -y --force-yes libxml2-utils tidy
- sudo apt-get install -y libxml2-utils tidy
# Disable XDebug for speed.
# https://github.com/travis-ci/travis-ci/issues/1697
......@@ -68,6 +69,10 @@ install:
#- phpenv config-add xdebug.ini
before_script:
# cf. https://docs.travis-ci.com/user/database-setup/#mongodb
- sleep 15
- mongosh mydb_test --eval 'db.createUser({user:"travis",pwd:"test",roles:["readWrite"]});'
# Code runs in /home/travis/build, which is the checkout root.
# Remove Xdebug as we don't need it, is slows everything, and it causes
......@@ -77,14 +82,14 @@ before_script:
- cd ../..
# download Drupal 9 core.
- wget -q -O - https://ftp.drupal.org/files/projects/drupal-9.2.x-dev.tar.gz | tar xz
- cd drupal-9.2.x-dev
- wget -q -O - https://ftp.drupal.org/files/projects/drupal-9.4.x-dev.tar.gz | tar xz
- cd drupal-9.4.x-dev
- mkdir -p modules/contrib
- mv ../fgm/mongodb modules/contrib
# install dependencies (for the module) and Coveralls (for coverage) as part of the root vendors. Get rid of PHPunit < 7 and locked dependencies.
- rm -fr composer.lock vendor
- composer require -v "drush/drush:^10" drupal/console "mongodb/mongodb:^1.5.1" "phpunit/phpunit:^8.5.18" $COVERALLS
- composer require -v "drush/drush:^11" "mongodb/mongodb:^1.12" "phpspec/prophecy-phpunit:^2" "phpunit/phpunit:^9.5" $COVERALLS
- composer show mongodb/mongodb
# create new site, stubbing sendmail path with true to prevent delivery errors and manually resolving drush path
......@@ -96,7 +101,7 @@ before_script:
- tail --lines=+12 modules/contrib/mongodb/example.settings.local.php >> sites/default/settings.php
# Reference and enable mongodb modules in build site
#- ln -s $(readlink -e $(cd -)) drupal-9.1.x-dev/modules/custom/mongodb
#- ln -s $(readlink -e $(cd -)) drupal-9.4.x-dev/modules/custom/mongodb
- vendor/bin/drush -y en mongodb_storage mongodb_watchdog
# Needed for web tests in mongodb_watchdog.
......
......@@ -15,8 +15,8 @@
}
],
"conflict": {
"drupal/core": "< 8.9.0",
"drush/drush": "< 9.7"
"drupal/core": "< 9.4.0",
"drush/drush": "< 11."
},
"description": "Drupal 9.2 driver for MongoDB",
"homepage": "https://www.drupal.org/project/mongodb",
......@@ -26,13 +26,14 @@
"name": "drupal/mongodb",
"prefer-stable": false,
"require": {
"php": ">=7.4.0",
"php": ">=8.0",
"ext-json": "*",
"ext-mongodb": "^1.5.1",
"mongodb/mongodb": "^1.5.1"
"ext-mongodb": "^1.13",
"mongodb/mongodb": "^1.12"
},
"require-dev": {
"phpunit/phpunit": "^8.5.18",
"phpunit/phpunit": "^9.5",
"phpspec/prophecy-phpunit": "^v2.0.1",
"squizlabs/php_codesniffer": "^3.6.0"
},
"support": {
......
core: '8.x'
core_version_requirement: ^8 || ^9
core_version_requirement: ^8 || ^9 || ^10
description: 'Integration between Drupal and MongoDB.'
name: 'MongoDB'
package: 'MongoDB'
......
......@@ -31,7 +31,7 @@ class MongoDb {
*
* @var string
*/
protected static $libraryVersion;
protected static string $libraryVersion;
/**
* Guess an approximation of the library version, to handle API changes.
......
......@@ -21,7 +21,7 @@ class MongoDbTest extends MongoDbTestBase {
*/
public function testLibraryVersion() {
$actual = MongoDb::libraryApiVersion();
$this->assertRegExp('/[\d]\.[\d]+\.[\d]+/', $actual,
$this->assertMatchesRegularExpression('/[\d]\.[\d]+\.[\d]+/', $actual,
'API version matches expected format.');
list(, $minor,) = sscanf($actual, "%d.%d.%d");
$hasWatch = method_exists(Collection::class, 'watch');
......
core: '8.x'
core_version_requirement: ^8 || ^9
core_version_requirement: ^8 || ^9 || ^10
dependencies:
- mongodb:mongodb
description: 'Key-Value storage using MongoDB'
......
core: '8.x'
core_version_requirement: ^8 || ^9
core_version_requirement: ^8 || ^9 || ^10
dependencies:
- mongodb:mongodb
description: 'A logger (watchdog) implementation using MongoDB'
......
......@@ -3,4 +3,4 @@ type: module
description: 'Module to test the MongoDB Watchdog Logger.'
package: MongoDB
hidden: true
core_version_requirement: ^8|^9
core_version_requirement: ^8 || ^9 || ^10
......@@ -456,6 +456,7 @@ class ControllerTest extends BrowserTestBase {
$selector = ['message' => $expectedMessage];
$event = $logger->templateCollection()
->findOne($selector, MongoDb::ID_PROJECTION);
$this->assertNotNull($event);
$eventId = $event['_id'];
// View MongoDB Watchdog event page.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment