Skip to content

Commit

Permalink
Add PHPCR ODM 2.x compat
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Oct 12, 2023
1 parent 2630234 commit d16630a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,26 @@ jobs:
fail-fast: true
matrix:
php: ['8.1', '8.2']
odm: ['']
composer-flags: ['--prefer-stable --prefer-dist']
next-php: [false]
patch-packages: [false]
include:
- php: '8.1'
odm: ''
composer-flags: '--prefer-stable --prefer-dist --prefer-lowest'
next-php: false
- php: '8.2'
odm: '^2.0@beta'
composer-flags: '--prefer-dist --prefer-lowest'
next-php: false
- php: '8.2'
odm: ''
composer-flags: '--prefer-stable --prefer-dist'
next-php: false
patch-packages: true

name: Doctrine PHPCR ODM - PHP ${{ matrix.php }} - Composer ${{ matrix.composer-flags }}${{ matrix.patch-packages && ' (Patched Packages)' || '' }}
name: Doctrine PHPCR ODM${{ matrix.odm != '' && format(' {0}', matrix.odm) || '' }} - PHP ${{ matrix.php }} - Composer ${{ matrix.composer-flags }}${{ matrix.patch-packages && ' (Patched Packages)' || '' }}

steps:
- name: Checkout code
Expand All @@ -263,6 +270,10 @@ jobs:
if: ${{ matrix.patch-packages }}
run: php .github/patch-packages.php

- name: Restrict ODM version
if: ${{ matrix.odm }}
run: (cd lib/Adapter/Doctrine/PHPCRODM && composer require --no-update doctrine/phpcr-odm:${{ matrix.odm }})

- name: Install dependencies
run: (cd lib/Adapter/Doctrine/PHPCRODM && composer update ${{ matrix.composer-flags }})

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"doctrine/dbal": "^3.5",
"doctrine/mongodb-odm": "^2.4",
"doctrine/orm": "^2.14",
"doctrine/phpcr-odm": "^1.7",
"doctrine/phpcr-odm": "^1.7 || ^2.0",
"dg/bypass-finals": "^1.5.1",
"jackalope/jackalope-doctrine-dbal": "^1.9",
"phpstan/extension-installer": "^1.3.1",
Expand Down
11 changes: 11 additions & 0 deletions lib/Adapter/Doctrine/PHPCRODM/Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php declare(strict_types=1);

use DG\BypassFinals;

require __DIR__.'/../vendor/autoload.php';

BypassFinals::setWhitelist([
'*/Doctrine/ODM/PHPCR/*',
]);

BypassFinals::enable(bypassReadOnly: false);
2 changes: 1 addition & 1 deletion lib/Adapter/Doctrine/PHPCRODM/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"doctrine/phpcr-odm": "^1.7",
"doctrine/phpcr-odm": "^1.7|| ^2.0",
"pagerfanta/core": "^3.7 || ^4.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion lib/Adapter/Doctrine/PHPCRODM/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="Tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
>
<testsuites>
Expand Down
1 change: 1 addition & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

BypassFinals::setWhitelist([
'*/Doctrine/ODM/MongoDB/*',
'*/Doctrine/ODM/PHPCR/*',
]);

BypassFinals::enable(bypassReadOnly: false);

0 comments on commit d16630a

Please sign in to comment.