diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63b8035..af165c6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,6 @@ jobs: strategy: matrix: php-version: - - "8.0" - "8.1" - "8.2" - "8.3" @@ -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 @@ -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:postgres@127.0.0.1:5432/odm?serverVersion=14&charset=utf8 run: php vendor/bin/simple-phpunit diff --git a/composer.json b/composer.json index 67307aa..9ad2fd4 100644 --- a/composer.json +++ b/composer.json @@ -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.", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b8ed247..145e682 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,30 +1,23 @@ - - - - - - - - - - - - tests - - - - - - . - - tests - vendor - - - + + + + . + + + tests + vendor + + + + + + + + + + + tests + + diff --git a/tests/Fixtures/TestBundle/Document/ScalarValueTrait.php b/tests/Fixtures/TestBundle/Document/ScalarValueTrait.php index e9e5f1c..bb16400 100644 --- a/tests/Fixtures/TestBundle/Document/ScalarValueTrait.php +++ b/tests/Fixtures/TestBundle/Document/ScalarValueTrait.php @@ -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; } } diff --git a/tests/Fixtures/TestBundle/Document/TypedScalarValueTrait.php b/tests/Fixtures/TestBundle/Document/TypedScalarValueTrait.php index 91054a4..b16d3c2 100644 --- a/tests/Fixtures/TestBundle/Document/TypedScalarValueTrait.php +++ b/tests/Fixtures/TestBundle/Document/TypedScalarValueTrait.php @@ -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; } } diff --git a/tests/Fixtures/TestBundle/Entity/Foo.php b/tests/Fixtures/TestBundle/Entity/Foo.php index 68f0dcb..fb17e0b 100644 --- a/tests/Fixtures/TestBundle/Entity/Foo.php +++ b/tests/Fixtures/TestBundle/Entity/Foo.php @@ -16,23 +16,33 @@ * * @author Kévin Dunglas */ +#[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() diff --git a/tests/Fixtures/TestBundle/Entity/Product.php b/tests/Fixtures/TestBundle/Entity/Product.php index 6b64c7f..e46463c 100644 --- a/tests/Fixtures/TestBundle/Entity/Product.php +++ b/tests/Fixtures/TestBundle/Entity/Product.php @@ -16,22 +16,32 @@ * * @author Kévin Dunglas */ +#[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; }