<?php

declare(strict_types=1);
namespace Tests\Adawolfa\Fucktura\Entity\Party;
use Adawolfa\Fucktura\Entity\Party;
use Adawolfa\Fucktura\I18n\Country;
use Tests\Adawolfa\Fucktura\TestCase;

final class InfoTest extends TestCase
{

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

		$party = $this->getEntityFactory()->createParty(info: $this->getEntityFactory()->createInfo(cin: null));

		$em->persist($party);
		$em->flush();
		$em->clear();

		$party = $em->find(Party::class, 1);
		$this->assertSame('Party', $party->info->name);
		$this->assertNull($party->info->cin);
		$this->assertNull($party->info->tin);

		$party = $this->getEntityFactory()->createParty(info: $this->getEntityFactory()->createInfo(tin: 'CZ12345678'));

		$em->persist($party);
		$em->flush();
		$em->clear();

		$party = $em->find(Party::class, 2);
		$this->assertSame('Party', $party->info->name);
		$this->assertSame('12345678', $party->info->cin);
		$this->assertSame('CZ12345678', $party->info->tin);
	}

}