Failed Conditions
Push — master ( 7ddf51...0a0c4a )
by Adrien
06:37
created

AccountRepositoryTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Repository;
6
7
use Application\Model\Account;
8
use Application\Repository\AccountRepository;
9
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
10
11
/**
12
 * @group Repository
13
 */
14
class AccountRepositoryTest extends AbstractRepositoryTest
15
{
16
    /**
17
     * @var AccountRepository
18
     */
19
    private $repository;
20
21
    public function setUp(): void
22
    {
23
        parent::setUp();
24
        $this->repository = _em()->getRepository(Account::class);
25
    }
26
27
    public function testOneUserCanHaveOnlyOneAccount(): void
28
    {
29
        $this->getEntityManager()->getConnection()->insert('account', ['owner_id' => 1000, 'iban' => uniqid()]);
30
31
        $this->expectException(UniqueConstraintViolationException::class);
32
        $this->getEntityManager()->getConnection()->insert('account', ['owner_id' => 1000, 'iban' => uniqid()]);
33
    }
34
}
35