CounterpartFinderTest.php 2.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
<?php

namespace LQDN\Tests\Functional\Finder;

use LQDN\Tests\Functional\FunctionalTest;

class CounterpartFinderTest extends FunctionalTest
{
    public function testFindByUserId()
    {
        $counterparts = $this->container['counterpart_finder']->findByUserId(2);
12
        $this->assertCount(3, $counterparts);
13
14
15
16
17
18
19
20
21

        $firstCounterpart = reset($counterparts);

        // Check the first counterpart
        $expectedCounterpart = [
            'id' => '2',
            'user_id' => '2',
            'datec' => '2016-06-22 12:34:00',
            'quoi' => 'piplome',
22
            'taille' => '2',
23
            'status' => '2',
24
            'adresse_id' => null,
Okhin's avatar
Okhin committed
25
            'pdf_id' => '1',
26
            'pdf_nom' => 'Main',
Okhin's avatar
Okhin committed
27
            'pdf_url' => 'pdf',
28
            'commentaire' => '',
29
30
31
        ];
        $this->assertEquals($expectedCounterpart, $firstCounterpart);
    }
32
33
34
35
36
37
38
39
40
41
42
43
44
45

    public function testFindByQuoi()
    {
        $counterparts = $this->container['counterpart_finder']->findByQuoi('piplome');
        $this->assertCount(1, $counterparts);
        $firstCounterpart = reset($counterparts);

        // Check the first counterpart
        $expectedCounterpart = [
            'id' => '2',
            'user_id' => '2',
            'datec' => '2016-06-22 12:34:00',
            'quoi' => 'piplome',
            'taille' => '2',
46
            'status' => '2',
47
48
49
50
51
52
53
54
55
56
57
58
59
            'adresse_id' => null,
            'pdf_id' => '1',
            'pdf_nom' => 'Main',
            'pdf_url' => 'pdf',
            'commentaire' => '',
        ];
        $this->assertEquals($expectedCounterpart, $firstCounterpart);

    }

    public function testFindById()
    {
        $counterparts = $this->container['counterpart_finder']->findByStatus(1);
60
        $this->assertCount(1, $counterparts);
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

        $firstCounterpart = reset($counterparts);
        $expectedCounterpart = [
            'id' => '1',
            'datec' => '2016-06-22 12:34:00',
            'user_id' => '1',
            'quoi' => 'pishirt', // [piplome|pibag|pishirt|hoodie]
            'taille' => '8',
            'status' => '1',
            'adresse_id' => '1',
            'pdf_id' => '',
            'pdf_nom' => '',
            'pdf_url' => '',
            'commentaire' => '',
        ];
        $this->assertEquals($expectedCounterpart, $firstCounterpart);
    }
78
}