Skip to content

Commit

Permalink
chore: Symfony 7 compatibility and deps bump (#133)
Browse files Browse the repository at this point in the history
* Bump minimum deps compatibility

* Add symfony/validator in dev dependencies

* Upgrade phpunit.xml.dist format

* Fix style
  • Loading branch information
amenophis authored Jan 16, 2024
1 parent 18a4d61 commit 2c0be0e
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 59 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
Expand All @@ -23,25 +22,25 @@ jobs:
fail-fast: false

services:
database:
mysql:
image: mysql:8
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
env:
MYSQL_ROOT_PASSWORD: odmroot
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: odm
MYSQL_USER: odm
MYSQL_PASSWORD: odm

steps:
- name: Start PostgreSQL
run: |
sudo systemctl start postgresql.service
pg_isready
sudo -u postgres psql -c "create user odm WITH PASSWORD 'odm';"
sudo -u postgres psql -c "create database odm OWNER odm;"
postgres:
image: postgres:14
ports:
- 5432:5432
options: --health-cmd "/usr/bin/pg_isready" --health-interval 10s --health-timeout 5s --health-retries 10
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: odm

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

Expand All @@ -61,10 +60,10 @@ jobs:

- name: Run tests (MySQL)
env:
DATABASE_URL: mysql://odm:odm@127.0.0.1/odm?serverVersion=8.0
DATABASE_URL: mysql://root:root@127.0.0.1:3306/odm?serverVersion=8.0
run: php vendor/bin/simple-phpunit

- name: Run tests (PostgreSQL)
env:
DATABASE_URL: postgresql://odm:odm@localhost/odm?serverVersion=14&charset=utf8
DATABASE_URL: postgresql://postgres:[email protected]:5432/odm?serverVersion=14&charset=utf8
run: php vendor/bin/simple-phpunit
20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@
}
],
"require": {
"php": ">=8.0",
"php": ">=8.1",
"doctrine/orm": "^2.6.3",
"symfony/property-access": "^4.4 || ^5.4 || ^6.0",
"symfony/property-info": "^4.4 || ^5.4 || ^6.0",
"symfony/serializer": "^4.4 || ^5.4 || ^6.0"
"symfony/property-access": "^5.4 || ^6.0 || ^7.0",
"symfony/property-info": "^5.4 || ^6.0 || ^7.0",
"symfony/serializer": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^1.12.13 || ^2.2",
"doctrine/dbal": "^2.7 || ^3.3",
"symfony/finder": "^4.4 || ^5.4 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/phpunit-bridge": "^6.0",
"symfony/uid": "^5.4 || ^6.0"
},
"conflict": {
"symfony/doctrine-bridge": ">=7.0.0"
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^6.0 || ^7.0",
"symfony/uid": "^5.4 || ^6.0 || ^7.0",
"symfony/validator": "^5.4 || ^6.0 || ^7.0"
},
"suggest": {
"symfony/framework-bundle": "To use the provided bundle.",
Expand Down
49 changes: 21 additions & 28 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="tests/Fixtures" />
<server name="KERNEL_CLASS" value="AppKernel" />
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=7" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>.</directory>
<exclude>
<directory>tests</directory>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>.</directory>
</include>
<exclude>
<directory>tests</directory>
<directory>vendor</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_DIR" value="tests/Fixtures"/>
<server name="KERNEL_CLASS" value="AppKernel"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=7"/>
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 0 additions & 2 deletions tests/Fixtures/TestBundle/Document/ScalarValueTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,5 @@ public function normalize(NormalizerInterface $normalizer, $format = null, array
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = [])
{
$this->value = $data;

return $this;
}
}
4 changes: 1 addition & 3 deletions tests/Fixtures/TestBundle/Document/TypedScalarValueTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ public function normalize(NormalizerInterface $normalizer, string $format = null
return $this->value;
}

public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = [])
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = []): void
{
$this->value = $data;

return $this;
}
}
10 changes: 10 additions & 0 deletions tests/Fixtures/TestBundle/Entity/Foo.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,33 @@
*
* @author Kévin Dunglas <[email protected]>
*/
#[ORM\Entity]
class Foo
{
/**
* @ORM\Column(type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[
ORM\Column(type: 'integer'),
ORM\Id,
ORM\GeneratedValue(strategy: 'AUTO'),
]
private $id;

/**
* @ORM\Column(type="string")
*/
#[ORM\Column(type: 'string')]
private $name;

/**
* @ORM\Column(type="json_document", options={"jsonb": true})
*/
#[ORM\Column(type: 'json_document', options: ['jsonb' => true])]
private $misc;

public function getId()
Expand Down
12 changes: 11 additions & 1 deletion tests/Fixtures/TestBundle/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,32 @@
*
* @author Kévin Dunglas <[email protected]>
*/
#[ORM\Entity]
class Product
{
/**
* @ORM\Column(type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[
ORM\Column(type: 'integer'),
ORM\Id,
ORM\GeneratedValue(strategy: 'AUTO'),
]
public $id;

/**
* @ORM\Column(type="string")
* @ORM\Column(type="string")
*/
#[ORM\Column(type: 'string')]
public $name;

/**
* @ORM\Column(type="json_document", options={"jsonb": true}, nullable=true)
*/
#[ORM\Column(type: 'json_document', nullable: true, options: ['jsonb' => true])]
public $attributes;
}

0 comments on commit 2c0be0e

Please sign in to comment.