Skip to content

[DoctrineBridge] fix and replace namespace to Uid #38419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Types;
namespace Symfony\Bridge\Doctrine\IdGenerator;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Id\AbstractIdGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Types;
namespace Symfony\Bridge\Doctrine\IdGenerator;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Id\AbstractIdGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Types;
namespace Symfony\Bridge\Doctrine\IdGenerator;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Id\AbstractIdGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Types;
namespace Symfony\Bridge\Doctrine\IdGenerator;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Id\AbstractIdGenerator;
Expand Down
21 changes: 21 additions & 0 deletions src/Symfony/Bridge/Doctrine/Tests/IdGenerator/EntityManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;

use Doctrine\ORM\EntityManager as DoctrineEntityManager;

class EntityManager extends DoctrineEntityManager
{
public function __construct()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;

use Doctrine\ORM\Mapping\Entity;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
use Symfony\Component\Uid\AbstractUid;
use Symfony\Component\Uid\Ulid;

class UlidGeneratorTest extends TestCase
{
public function testUlidCanBeGenerated()
{
$em = new EntityManager();
$generator = new UlidGenerator();
$ulid = $generator->generate($em, new Entity());

$this->assertInstanceOf(AbstractUid::class, $ulid);
$this->assertInstanceOf(Ulid::class, $ulid);
$this->assertTrue(Ulid::isValid($ulid));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;

use Doctrine\ORM\Mapping\Entity;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\IdGenerator\UuidV1Generator;
use Symfony\Component\Uid\AbstractUid;
use Symfony\Component\Uid\UuidV1;

class UuidV1GeneratorTest extends TestCase
{
public function testUuidv1CanBeGenerated()
{
$em = new EntityManager();
$generator = new UuidV1Generator();

$uuid = $generator->generate($em, new Entity());

$this->assertInstanceOf(AbstractUid::class, $uuid);
$this->assertInstanceOf(UuidV1::class, $uuid);
$this->assertTrue(UuidV1::isValid($uuid));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;

use Doctrine\ORM\Mapping\Entity;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\IdGenerator\UuidV4Generator;
use Symfony\Component\Uid\AbstractUid;
use Symfony\Component\Uid\UuidV4;

class UuidV4GeneratorTest extends TestCase
{
public function testUuidv4CanBeGenerated()
{
$em = new EntityManager();
$generator = new UuidV4Generator();

$uuid = $generator->generate($em, new Entity());

$this->assertInstanceOf(AbstractUid::class, $uuid);
$this->assertInstanceOf(UuidV4::class, $uuid);
$this->assertTrue(UuidV4::isValid($uuid));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Doctrine\Tests\IdGenerator;

use Doctrine\ORM\Mapping\Entity;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\IdGenerator\UuidV6Generator;
use Symfony\Component\Uid\AbstractUid;
use Symfony\Component\Uid\UuidV6;

class UuidV6GeneratorTest extends TestCase
{
public function testUuidv6CanBeGenerated()
{
$em = new EntityManager();
$generator = new UuidV6Generator();

$uuid = $generator->generate($em, new Entity());

$this->assertInstanceOf(AbstractUid::class, $uuid);
$this->assertInstanceOf(UuidV6::class, $uuid);
$this->assertTrue(UuidV6::isValid($uuid));
}
}