-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccountRepositoryTest.php
46 lines (34 loc) · 1.28 KB
/
AccountRepositoryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace App\Tests\Repository;
use App\Entity\Account;
use App\Entity\Other;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class AccountRepositoryTest extends KernelTestCase
{
public function testAccount(): void
{
$entityManager = self::getContainer()->get(EntityManagerInterface::class);
$other1 = new Other();
$entityManager->persist($other1);
$other2 = new Other();
$entityManager->persist($other2);
$account = new Account();
$entityManager->persist($account);
$entityManager->flush();
$accountId = $account->getId();
$this->assertNotNull($accountId);
$this->assertStringContainsString($accountId, $account->getNumber());
$this->assertNotNull($account->getCreated());
$this->assertNotNull($account->getChanged());
// another account
$account = new Account();
$entityManager->persist($account);
$entityManager->flush();
$accountId = $account->getId();
$this->assertNotNull($accountId);
$this->assertStringContainsString($accountId, $account->getNumber());
$this->assertNotNull($account->getCreated());
$this->assertNotNull($account->getChanged());
}
}