CounterpartFinderTest.php 1.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<?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);
        $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',
Okhin's avatar
Okhin committed
22
            'taille' => '1',
23 24
            'status' => '1',
            'adresse_id' => null,
Okhin's avatar
Okhin committed
25
            'pdf_id' => '1',
Okhin's avatar
Okhin committed
26 27
            'pdf_nom' => 'bob@example.org',
            'pdf_url' => 'pdf',
28 29
        ];
        $this->assertEquals($expectedCounterpart, $firstCounterpart);
Okhin's avatar
Okhin committed
30 31

        // Test the PDF attributes
Okhin's avatar
Okhin committed
32 33 34
        $this->assertEquals(2, $firstCounterpart['pdf_id']);
        $this->assertEquals('Bob', $firstCounterpart['pdf_nom']);
        $this->assertEquals('http://example.org/pdf/2', $firstCounterpart['pdf_url']);
35 36
    }
}