CounterpartFinderTest.php 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?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);
Okhin's avatar
Okhin committed
15
        $secondCounterpart = $counterparts[1];
16 17 18 19 20 21 22 23 24 25

        // Check the first counterpart
        $expectedCounterpart = [
            'id' => '2',
            'user_id' => '2',
            'datec' => '2016-06-22 12:34:00',
            'quoi' => 'piplome',
            'taille' => '8',
            'status' => '1',
            'adresse_id' => null,
Okhin's avatar
Okhin committed
26 27 28
            'pdf_id' => '8',
            'pdf_nom' => 'bob@example.org',
            'pdf_url' => 'pdf',
29 30
        ];
        $this->assertEquals($expectedCounterpart, $firstCounterpart);
Okhin's avatar
Okhin committed
31 32 33 34 35

        // Test the PDF attributes
        $this->assertEquals(2, $secondCounterpart['pdf_id']);
        $this->assertEquals('Bob', $secondCounterpart['pdf_nom']);
        $this->assertEquals('http://example.org/pdf/2', $secondCounterpart['pdf_url']);
36 37
    }
}