Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions tests/data/doctrine_entities/EntityWithUlid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
use Symfony\Component\Uid\Ulid;

/**
* @ORM\Entity
*/
#[ORM\Entity]
class EntityWithUlid
{
/**
* @ORM\Id
* @ORM\Column(type="ulid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator")
*/
#[ORM\Id]
#[ORM\Column(type: 'ulid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
private ?Ulid $id = null;

public function __construct()
{
$this->id = new Ulid();
}

public function getId(): Ulid
{
return $this->id;
}
}
34 changes: 0 additions & 34 deletions tests/data/doctrine_entities/EntityWithUuid.php

This file was deleted.

18 changes: 9 additions & 9 deletions tests/unit/Codeception/Module/Doctrine2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use QuirkyFieldName\AssociationHost;
use QuirkyFieldName\Embeddable;
use QuirkyFieldName\EmbeddableHost;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
use Symfony\Bridge\Doctrine\Types\UlidType;
use Symfony\Component\Uid\Ulid;

final class DoctrineTest extends Unit
{
Expand All @@ -36,8 +36,8 @@ final class DoctrineTest extends Unit

protected static function _setUpBeforeClass()
{
if (!Type::hasType('uuid')) {
Type::addType('uuid', UuidType::class);
if (!Type::hasType('ulid')) {
Type::addType('ulid', UlidType::class);
}
}

Expand Down Expand Up @@ -69,7 +69,7 @@ protected function _setUp()
require_once $dir . "/CircularRelations/A.php";
require_once $dir . "/CircularRelations/B.php";
require_once $dir . "/CircularRelations/C.php";
require_once $dir . '/EntityWithUuid.php';
require_once $dir . '/EntityWithUlid.php';

$sqliteDriver = 'sqlite3';
// The driver "sqlite3" is only available as-of doctrine/dbal:3.5
Expand Down Expand Up @@ -111,7 +111,7 @@ protected function _setUp()
$this->em->getClassMetadata(\CircularRelations\A::class),
$this->em->getClassMetadata(\CircularRelations\B::class),
$this->em->getClassMetadata(\CircularRelations\C::class),
$this->em->getClassMetadata(EntityWithUuid::class),
$this->em->getClassMetadata(EntityWithUlid::class),
]);

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

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

self::assertInstanceOf(Uuid::class, $pk);
self::assertInstanceOf(Ulid::class, $pk);
}

public function testRefresh()
Expand Down