Skip to content

Commit

Permalink
NTR - Added doctrine uuid test case
Browse files Browse the repository at this point in the history
  • Loading branch information
cyl3x committed Nov 20, 2024
1 parent 4c37be9 commit 15da9cf
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/integration/DoctrineUuidTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php declare(strict_types=1);

namespace Swag\Braintree\Tests\Integration;

use Swag\Braintree\Entity\ConfigEntity;

class DoctrineUuidTest extends SwagBraintreeTestCase
{
public function testPersistTwice(): void
{
$em = $this->getEntityManager();

$shop = $this->createShop();
$config = (new ConfigEntity())
->setShop($shop);

$em->persist($config);
$em->flush();

static::assertNotNull($config->getId());
$id = (string) $config->getId();

$em->persist($config);
$em->flush();

static::assertSame($id, (string) $config->getId());
}

public function testWithRef(): void
{
$em = $this->getEntityManager();

$shop = $this->createShop();
$config = (new ConfigEntity())
->setShop($shop);

$em->persist($config);
$em->flush();

static::assertNotNull($config->getId());
$id = (string) $config->getId();

$configRef = $em->getReference(ConfigEntity::class, $id);
$configRef->setThreeDSecureEnforced(true);

$em->persist($configRef);
$em->flush();

$config = $em->find(ConfigEntity::class, $id);

static::assertSame($id, (string) $config->getId());
static::assertTrue($config->isThreeDSecureEnforced());
}
}

0 comments on commit 15da9cf

Please sign in to comment.