Failed Conditions
Push — master ( b089ad...aace03 )
by Adrien
07:24
created

BookingRepositoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGetAllToInvoice() 0 19 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Repository;
6
7
use Application\Model\Booking;
8
use Application\Model\User;
9
use Application\Repository\BookingRepository;
10
11
class BookingRepositoryTest extends AbstractRepositoryTest
12
{
13
    /**
14
     * @var BookingRepository
15
     */
16
    private $repository;
17
18
    public function setUp(): void
19
    {
20
        parent::setUp();
21
        $this->repository = _em()->getRepository(Booking::class);
22
    }
23
24
    public function testGetAllToInvoice(): void
25
    {
26
        $user = _em()->getRepository(User::class)->getByLogin('administrator');
27
        User::setCurrent($user);
28
29
        $bookings = $this->repository->getAllToInvoice();
30
        $actual = [];
31
        foreach ($bookings as $a) {
32
            $actual[] = $a->getId();
33
        }
34
35
        $expected = [
36
            4004,
37
            4003,
38
            4005,
39
            4006,
40
        ];
41
42
        self::assertSame($expected, $actual);
43
    }
44
}
45