Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Symfony 6 #821

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7d33e0d
Allow Symfony 6
jordisala1991 Nov 18, 2021
65e36ab
Add workflow
jordisala1991 Nov 19, 2021
a5a4edf
Add mysql service
jordisala1991 Nov 19, 2021
0a08498
Update .github/workflows/test-application.yaml
dbu Nov 19, 2021
5495279
Add transport to all builds
jordisala1991 Nov 20, 2021
8c6d4df
Try to fix
jordisala1991 Nov 20, 2021
77e4da9
fix host for database
jordisala1991 Nov 20, 2021
301721e
Split jackrabbit and doctrine dbal
jordisala1991 Nov 20, 2021
aa4e72f
Fix
jordisala1991 Nov 20, 2021
8827ab2
try again
jordisala1991 Nov 20, 2021
341d6ae
fix
jordisala1991 Nov 20, 2021
f726adc
try to fix broken tests
jordisala1991 Nov 20, 2021
2a3c737
fix risky tests
jordisala1991 Nov 20, 2021
a59f0e3
more fixes
jordisala1991 Nov 20, 2021
58d9f9b
fix tests
jordisala1991 Nov 20, 2021
e19e93e
fix deprecations
jordisala1991 Nov 20, 2021
243f883
fix again
jordisala1991 Nov 20, 2021
11c2704
fix deprecations
jordisala1991 Nov 20, 2021
32dc4f5
Fix tests
jordisala1991 Nov 20, 2021
c6e5801
fix
jordisala1991 Nov 20, 2021
bba81c6
fix lowest build
jordisala1991 Nov 20, 2021
b11cc01
Add phpbench
jordisala1991 Nov 20, 2021
9efbd80
phpbench requires php 7.*
jordisala1991 Nov 20, 2021
cfaf347
Allow phpunit 7
jordisala1991 Nov 20, 2021
d479b68
try to fix jackrabbit
jordisala1991 Nov 20, 2021
533de88
Up phpunit min version
jordisala1991 Nov 20, 2021
a57eaf3
Add transport to phpbench
jordisala1991 Nov 20, 2021
24f2037
Add setup java
jordisala1991 Nov 20, 2021
3b249bc
try with latest stable of jackrabbit
jordisala1991 Nov 20, 2021
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
199 changes: 199 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: Test application

on:
pull_request:
push:
branches:
- 'master'

jobs:
phpunit-doctrine_dbal:
name: 'PHP ${{ matrix.php-version }} Doctrine DBAL ${{ matrix.dependencies }} ${{ matrix.symfony-require }}'

runs-on: ubuntu-20.04

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: phpcr_odm_tests
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

env:
SYMFONY_REQUIRE: ${{ matrix.symfony-require }}

strategy:
fail-fast: false

matrix:
php-version:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
dependencies: [highest]
symfony-require: ['']
include:
- php-version: '7.1'
dependencies: lowest
- php-version: '7.4'
dependencies: highest
symfony-require: 2.3.*
- php-version: '7.4'
dependencies: highest
symfony-require: 3.4.*
- php-version: '7.4'
dependencies: highest
symfony-require: 4.4.*
php-bench: true
- php-version: '8.0'
dependencies: highest
symfony-require: 5.0.*
- php-version: '8.0'
dependencies: highest
symfony-require: 6.0.*

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: 'composer:v2'

- name: Globally install symfony/flex
if: matrix.symfony-require != ''
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex

- name: Allow unstable dependencies
if: matrix.symfony-require == '6.0.*'
run: composer config minimum-stability dev

- name: Remove dev dependencies not compatible with Symfony 6
if: matrix.symfony-require == '6.0.*'
run: composer remove liip/rmt --dev --no-update --no-interaction

- name: Install Jackalope Doctrine DBAL transport
run: composer require jackalope/jackalope-doctrine-dbal:"~1.0" --no-update

- name: Install PHPBench
if: matrix.php-bench == true
run: composer require phpbench/phpbench:"~0.16" --no-update

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Run configuration script
run: ./tests/script_doctrine_dbal.sh

- name: Execute test cases
run: vendor/bin/phpunit -c tests/phpunit_doctrine_dbal.xml.dist

- name: Execute PHPBench
if: matrix.php-bench == true
run: vendor/bin/phpbench run --report=all
env:
TRANSPORT: doctrine_dbal

phpunit-jackrabbit:
name: 'PHP ${{ matrix.php-version }} Jackrabbit ${{ matrix.dependencies }} ${{ matrix.symfony-require }}'

runs-on: ubuntu-20.04

env:
SYMFONY_REQUIRE: ${{ matrix.symfony-require }}

strategy:
fail-fast: false

matrix:
php-version:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
dependencies: [highest]
symfony-require: ['']
include:
- php-version: '7.1'
dependencies: lowest
- php-version: '7.4'
dependencies: highest
symfony-require: 2.3.*
- php-version: '7.4'
dependencies: highest
symfony-require: 3.4.*
php-bench: true
- php-version: '7.4'
dependencies: highest
symfony-require: 4.4.*
php-bench: true
- php-version: '8.0'
dependencies: highest
symfony-require: 5.0.*
- php-version: '8.0'
dependencies: highest
symfony-require: 6.0.*

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: 'composer:v2'

- name: Install and configure Java
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: '8'

- name: Globally install symfony/flex
if: matrix.symfony-require != ''
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex

- name: Allow unstable dependencies
if: matrix.symfony-require == '6.0.*'
run: composer config minimum-stability dev

- name: Remove dev dependencies not compatible with Symfony 6
if: matrix.symfony-require == '6.0.*'
run: composer remove liip/rmt --dev --no-update --no-interaction

- name: Install Jackalope Jackrabbit
run: composer require jackalope/jackalope-jackrabbit:~1.0 --no-update

- name: Install PHPBench
if: matrix.php-bench == true
run: composer require phpbench/phpbench:"~0.16" --no-update

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Run configuration script
run: ./tests/script_jackrabbit.sh

- name: Execute test cases
run: vendor/bin/phpunit -c tests/phpunit_jackrabbit.xml.dist

- name: Execute PHPBench
if: matrix.php-bench == true
run: vendor/bin/phpbench run --report=all
env:
TRANSPORT: jackrabbit
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion cli-config.doctrine_dbal.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $extraCommands[] = new \Jackalope\Tools\Console\Command\InitDoctrineDbalCommand(

$params = array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'host' => '127.0.0.1',
'user' => 'root',
'password' => '',
'dbname' => 'phpcr_odm_tests',
Expand Down
2 changes: 1 addition & 1 deletion cli-config.jackrabbit.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (! isset($argv[1])
}

$params = array(
'jackalope.jackrabbit_uri' => 'http://localhost:8080/server/',
'jackalope.jackrabbit_uri' => 'http://127.0.0.1:8080/server/',
);

$workspace = 'default';
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"phpcr/phpcr-implementation": "^2.1",
"phpcr/phpcr-utils": "^1.3.0",
"doctrine/instantiator": "^1.0.1",
"symfony/console": "^3.4 || ^4.3 || ^5.0"
"symfony/console": "^3.4 || ^4.3 || ^5.0 || ^6.0"
},
"require-dev": {
"symfony/yaml": "^3.4 || ^4.3 || ^5.0",
"symfony/yaml": "^3.4 || ^4.3 || ^5.0 || ^6.0",
"symfony/phpunit-bridge": "^5.0",
"liip/rmt": "^1.3",
"phpunit/phpunit": "^7.0 || ^8.0"
"phpunit/phpunit": "^7.5 || ^8.0"
},
"suggest": {
"symfony/yaml": "^3.4 || ^4.3 || ^5.0",
"symfony/yaml": "^3.4 || ^4.3 || ^5.0 || ^6.0",
"jackalope/jackalope-doctrine-dbal": "^1.3",
"jackalope/jackalope-jackrabbit": "^1.3"
},
Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Doctrine\ODM\PHPCR\Mapping;

use Doctrine\Common\ClassLoader;
use Doctrine\Instantiator\Instantiator;
use Doctrine\Instantiator\InstantiatorInterface;
use Doctrine\ODM\PHPCR\Event;
Expand Down Expand Up @@ -541,7 +540,7 @@ public function validateReferences()
{
foreach ($this->referenceMappings as $fieldName) {
$mapping = $this->mappings[$fieldName];
if (!empty($mapping['targetDocument']) && !ClassLoader::classExists($mapping['targetDocument'])) {
if (!empty($mapping['targetDocument']) && !class_exists($mapping['targetDocument']) && !interface_exists($mapping['targetDocument'])) {
throw MappingException::invalidTargetDocumentClass($mapping['targetDocument'], $this->name, $mapping['fieldName']);
}
}
Expand Down Expand Up @@ -1131,7 +1130,7 @@ public function validateClassMapping()
foreach ($this->referrersMappings as $referrerName) {
$mapping = $this->mappings[$referrerName];
// only a santiy check with reflection. otherwise we could run into endless loops
if (!ClassLoader::classExists($mapping['referringDocument'])) {
if (!class_exists($mapping['referringDocument']) && !interface_exists($mapping['referringDocument'])) {
throw new MappingException(sprintf(
'Invalid referrer mapping on document "%s" for field "%s": The referringDocument class "%s" does not exist',
$this->name,
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/ODM/PHPCR/Mapping/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ private function addReferenceMapping(PhpcrClassMetadata $class, $reference, $typ
protected function loadMappingFile($file)
{
$result = [];
$entity = libxml_disable_entity_loader(true);
$xmlElement = simplexml_load_string(file_get_contents($file));
libxml_disable_entity_loader($entity);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is deprecated on php > 7.2 I think (or 7.3/7.4)


foreach (['document', 'mapped-superclass'] as $type) {
if (isset($xmlElement->$type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testComputingBetweenEvents()
$this->dm->flush();

$this->assertInstanceOf('stdClass', $entity->status);
$this->assertAttributeNotEmpty('value', $entity->status);
$this->assertObjectHasAttribute('value', $entity->status);
$this->assertEquals($entity->status->value, 'active');
$this->assertObjectNotHasAttribute('foo', $entity->status);

Expand All @@ -65,7 +65,7 @@ public function testComputingBetweenEvents()
$this->dm->flush();

$this->assertInstanceOf('stdClass', $entity->status);
$this->assertAttributeNotEmpty('value', $entity->status);
$this->assertObjectHasAttribute('value', $entity->status);
$this->assertEquals($entity->status->value, 'inactive');
$this->assertObjectNotHasAttribute('foo', $entity->status);
$this->assertEquals($entity->text, 'test2');
Expand All @@ -75,7 +75,7 @@ public function testComputingBetweenEvents()
$entity = $this->dm->find(null, $entity->id);

$this->assertInstanceOf('stdClass', $entity->status);
$this->assertAttributeNotEmpty('value', $entity->status);
$this->assertObjectHasAttribute('value', $entity->status);
$this->assertEquals($entity->status->value, 'inactive');
$this->assertObjectNotHasAttribute('foo', $entity->status);
$this->assertEquals($entity->text, 'test2');
Expand All @@ -85,7 +85,7 @@ public function testComputingBetweenEvents()
$this->dm->flush();

$this->assertInstanceOf('stdClass', $entity->status);
$this->assertAttributeNotEmpty('value', $entity->status);
$this->assertObjectHasAttribute('value', $entity->status);
$this->assertEquals($entity->status->value, 'active');
$this->assertEquals($entity->text, 'test2');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function testGetLocalesFor()
$strategy = new AttributeTranslationStrategy($this->dm);
$locales = $strategy->getLocalesFor($doc, $node, $this->metadata);

$this->assertInternalType('array', $locales);
$this->assertIsArray($locales);
$this->assertCount(3, $locales);
$this->assertContains('fr', $locales);
$this->assertContains('en', $locales);
Expand Down
Loading