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

BookingRepositoryTest::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\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