Skip to content

Commit 2c0be0e

Browse files
authored
chore: Symfony 7 compatibility and deps bump (#133)
* Bump minimum deps compatibility * Add symfony/validator in dev dependencies * Upgrade phpunit.xml.dist format * Fix style
1 parent 18a4d61 commit 2c0be0e

File tree

7 files changed

+65
-59
lines changed

7 files changed

+65
-59
lines changed

.github/workflows/tests.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
php-version:
14-
- "8.0"
1514
- "8.1"
1615
- "8.2"
1716
- "8.3"
@@ -23,25 +22,25 @@ jobs:
2322
fail-fast: false
2423

2524
services:
26-
database:
25+
mysql:
2726
image: mysql:8
2827
ports:
2928
- 3306:3306
3029
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
3130
env:
32-
MYSQL_ROOT_PASSWORD: odmroot
31+
MYSQL_ROOT_PASSWORD: root
3332
MYSQL_DATABASE: odm
34-
MYSQL_USER: odm
35-
MYSQL_PASSWORD: odm
3633

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

43+
steps:
4544
- name: Checkout
4645
uses: actions/checkout@v2
4746

@@ -61,10 +60,10 @@ jobs:
6160

6261
- name: Run tests (MySQL)
6362
env:
64-
DATABASE_URL: mysql://odm:odm@127.0.0.1/odm?serverVersion=8.0
63+
DATABASE_URL: mysql://root:root@127.0.0.1:3306/odm?serverVersion=8.0
6564
run: php vendor/bin/simple-phpunit
6665

6766
- name: Run tests (PostgreSQL)
6867
env:
69-
DATABASE_URL: postgresql://odm:odm@localhost/odm?serverVersion=14&charset=utf8
68+
DATABASE_URL: postgresql://postgres:[email protected]:5432/odm?serverVersion=14&charset=utf8
7069
run: php vendor/bin/simple-phpunit

composer.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,21 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=8.0",
16+
"php": ">=8.1",
1717
"doctrine/orm": "^2.6.3",
18-
"symfony/property-access": "^4.4 || ^5.4 || ^6.0",
19-
"symfony/property-info": "^4.4 || ^5.4 || ^6.0",
20-
"symfony/serializer": "^4.4 || ^5.4 || ^6.0"
18+
"symfony/property-access": "^5.4 || ^6.0 || ^7.0",
19+
"symfony/property-info": "^5.4 || ^6.0 || ^7.0",
20+
"symfony/serializer": "^5.4 || ^6.0 || ^7.0"
2121
},
2222
"require-dev": {
2323
"doctrine/annotations": "^1.0",
2424
"doctrine/doctrine-bundle": "^1.12.13 || ^2.2",
2525
"doctrine/dbal": "^2.7 || ^3.3",
26-
"symfony/finder": "^4.4 || ^5.4 || ^6.0",
27-
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
28-
"symfony/phpunit-bridge": "^6.0",
29-
"symfony/uid": "^5.4 || ^6.0"
30-
},
31-
"conflict": {
32-
"symfony/doctrine-bridge": ">=7.0.0"
26+
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
27+
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
28+
"symfony/phpunit-bridge": "^6.0 || ^7.0",
29+
"symfony/uid": "^5.4 || ^6.0 || ^7.0",
30+
"symfony/validator": "^5.4 || ^6.0 || ^7.0"
3331
},
3432
"suggest": {
3533
"symfony/framework-bundle": "To use the provided bundle.",

phpunit.xml.dist

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit
4-
backupGlobals="false"
5-
colors="true"
6-
bootstrap="tests/bootstrap.php"
7-
>
8-
<php>
9-
<ini name="error_reporting" value="-1" />
10-
<server name="KERNEL_DIR" value="tests/Fixtures" />
11-
<server name="KERNEL_CLASS" value="AppKernel" />
12-
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=7" />
13-
</php>
14-
15-
<testsuites>
16-
<testsuite name="Project Test Suite">
17-
<directory>tests</directory>
18-
</testsuite>
19-
</testsuites>
20-
21-
<filter>
22-
<whitelist>
23-
<directory>.</directory>
24-
<exclude>
25-
<directory>tests</directory>
26-
<directory>vendor</directory>
27-
</exclude>
28-
</whitelist>
29-
</filter>
2+
<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">
3+
<coverage>
4+
<include>
5+
<directory>.</directory>
6+
</include>
7+
<exclude>
8+
<directory>tests</directory>
9+
<directory>vendor</directory>
10+
</exclude>
11+
</coverage>
12+
<php>
13+
<ini name="error_reporting" value="-1"/>
14+
<server name="KERNEL_DIR" value="tests/Fixtures"/>
15+
<server name="KERNEL_CLASS" value="AppKernel"/>
16+
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=7"/>
17+
</php>
18+
<testsuites>
19+
<testsuite name="Project Test Suite">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
3023
</phpunit>

tests/Fixtures/TestBundle/Document/ScalarValueTrait.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,5 @@ public function normalize(NormalizerInterface $normalizer, $format = null, array
3434
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = [])
3535
{
3636
$this->value = $data;
37-
38-
return $this;
3937
}
4038
}

tests/Fixtures/TestBundle/Document/TypedScalarValueTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ public function normalize(NormalizerInterface $normalizer, string $format = null
1919
return $this->value;
2020
}
2121

22-
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = [])
22+
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = []): void
2323
{
2424
$this->value = $data;
25-
26-
return $this;
2725
}
2826
}

tests/Fixtures/TestBundle/Entity/Foo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,33 @@
1616
*
1717
* @author Kévin Dunglas <[email protected]>
1818
*/
19+
#[ORM\Entity]
1920
class Foo
2021
{
2122
/**
2223
* @ORM\Column(type="integer")
24+
*
2325
* @ORM\Id
26+
*
2427
* @ORM\GeneratedValue(strategy="AUTO")
2528
*/
29+
#[
30+
ORM\Column(type: 'integer'),
31+
ORM\Id,
32+
ORM\GeneratedValue(strategy: 'AUTO'),
33+
]
2634
private $id;
2735

2836
/**
2937
* @ORM\Column(type="string")
3038
*/
39+
#[ORM\Column(type: 'string')]
3140
private $name;
3241

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

3848
public function getId()

tests/Fixtures/TestBundle/Entity/Product.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,32 @@
1616
*
1717
* @author Kévin Dunglas <[email protected]>
1818
*/
19+
#[ORM\Entity]
1920
class Product
2021
{
2122
/**
2223
* @ORM\Column(type="integer")
24+
*
2325
* @ORM\Id
26+
*
2427
* @ORM\GeneratedValue(strategy="AUTO")
2528
*/
29+
#[
30+
ORM\Column(type: 'integer'),
31+
ORM\Id,
32+
ORM\GeneratedValue(strategy: 'AUTO'),
33+
]
2634
public $id;
2735

2836
/**
29-
* @ORM\Column(type="string")
37+
* @ORM\Column(type="string")
3038
*/
39+
#[ORM\Column(type: 'string')]
3140
public $name;
3241

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

0 commit comments

Comments
 (0)