Skip to content

Commit 3ec1aec

Browse files
authored
Drop PHP 8.1 + test against PHP 8.5 (#48)
* Use ulid instead of uuid to fix the CI * Bump checkout action version * Drop PHP 8.1 * Test against PHP 8.5
1 parent f324e2a commit 3ec1aec

File tree

6 files changed

+51
-47
lines changed

6 files changed

+51
-47
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,23 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [8.1, 8.2, 8.3, 8.4]
11+
php: [8.2, 8.3, 8.4, 8.5]
1212
composer_flags: [ '', '--prefer-lowest' ]
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717

1818
- name: Setup PHP
1919
uses: shivammathur/setup-php@v2
2020
with:
2121
php-version: ${{ matrix.php }}
2222
extensions: pdo, sqlite
2323
coverage: none
24+
# this ini directive seems to be off by default in PHP 8.5
25+
# see https://github.com/php/php-src/issues/20279
26+
# enable it because codeception relies on it.
27+
ini-values: register_argc_argv=1
2428

2529
- name: Validate composer.json and composer.lock
2630
run: composer validate

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"homepage": "https://codeception.com/",
1919
"require": {
20-
"php": "^8.1",
20+
"php": "^8.2",
2121
"ext-json": "*",
2222
"ext-pdo": "*",
2323
"codeception/codeception": "^5.1"

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A Doctrine module for Codeception.
99

1010
## Requirements
1111

12-
* `PHP 8.1` or higher.
12+
* `PHP 8.2` or higher.
1313

1414
## Installation
1515

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Doctrine\ORM\Mapping as ORM;
4+
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
5+
use Symfony\Component\Uid\Ulid;
6+
7+
/**
8+
* @ORM\Entity
9+
*/
10+
#[ORM\Entity]
11+
class EntityWithUlid
12+
{
13+
/**
14+
* @ORM\Id
15+
* @ORM\Column(type="ulid", unique=true)
16+
* @ORM\GeneratedValue(strategy="CUSTOM")
17+
* @ORM\CustomIdGenerator(class="Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator")
18+
*/
19+
#[ORM\Id]
20+
#[ORM\Column(type: 'ulid', unique: true)]
21+
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
22+
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
23+
private ?Ulid $id = null;
24+
25+
public function __construct()
26+
{
27+
$this->id = new Ulid();
28+
}
29+
30+
public function getId(): Ulid
31+
{
32+
return $this->id;
33+
}
34+
}

tests/data/doctrine_entities/EntityWithUuid.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

tests/unit/Codeception/Module/Doctrine2Test.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
use QuirkyFieldName\AssociationHost;
2626
use QuirkyFieldName\Embeddable;
2727
use QuirkyFieldName\EmbeddableHost;
28-
use Symfony\Bridge\Doctrine\Types\UuidType;
29-
use Symfony\Component\Uid\Uuid;
28+
use Symfony\Bridge\Doctrine\Types\UlidType;
29+
use Symfony\Component\Uid\Ulid;
3030

3131
final class DoctrineTest extends Unit
3232
{
@@ -36,8 +36,8 @@ final class DoctrineTest extends Unit
3636

3737
protected static function _setUpBeforeClass()
3838
{
39-
if (!Type::hasType('uuid')) {
40-
Type::addType('uuid', UuidType::class);
39+
if (!Type::hasType('ulid')) {
40+
Type::addType('ulid', UlidType::class);
4141
}
4242
}
4343

@@ -69,7 +69,7 @@ protected function _setUp()
6969
require_once $dir . "/CircularRelations/A.php";
7070
require_once $dir . "/CircularRelations/B.php";
7171
require_once $dir . "/CircularRelations/C.php";
72-
require_once $dir . '/EntityWithUuid.php';
72+
require_once $dir . '/EntityWithUlid.php';
7373

7474
$sqliteDriver = 'sqlite3';
7575
// The driver "sqlite3" is only available as-of doctrine/dbal:3.5
@@ -111,7 +111,7 @@ protected function _setUp()
111111
$this->em->getClassMetadata(\CircularRelations\A::class),
112112
$this->em->getClassMetadata(\CircularRelations\B::class),
113113
$this->em->getClassMetadata(\CircularRelations\C::class),
114-
$this->em->getClassMetadata(EntityWithUuid::class),
114+
$this->em->getClassMetadata(EntityWithUlid::class),
115115
]);
116116

117117
$container = Stub::make(ModuleContainer::class);
@@ -435,13 +435,13 @@ public function testCompositePrimaryKeyWithEntities()
435435

436436
/**
437437
* The purpose of this test is to verify that entites with object @id, that are
438-
* not entites itself, e.g. Symfony\Component\Uid\Uuid, don't break the debug message.
438+
* not entites itself, e.g. Symfony\Component\Uid\Ulid, don't break the debug message.
439439
*/
440440
public function testDebugEntityWithNonEntityButObjectId()
441441
{
442-
$pk = $this->module->haveInRepository(EntityWithUuid::class);
442+
$pk = $this->module->haveInRepository(EntityWithUlid::class);
443443

444-
self::assertInstanceOf(Uuid::class, $pk);
444+
self::assertInstanceOf(Ulid::class, $pk);
445445
}
446446

447447
public function testRefresh()

0 commit comments

Comments
 (0)