UserFinderTest.php 2.05 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace LQDN\Tests\Functional\Finder;

use LQDN\Tests\Functional\FunctionalTest;

class UserFinderTest extends FunctionalTest
{
    public function testFindById()
    {
        $user = $this->container['user_finder']->findById(1);

        $expectedUser = [
            'id' => '1',
            'status' => '1',
            'hash' => '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
            'cumul' => '2000',
            'email' => 'alice@example.org',
            'total' => '5000',
            'pseudo' => 'Alice',
            'expiration' => null,
            'commentaire' => 'RAS',
        ];
        $this->assertEquals($expectedUser, $user);
    }
Okhin's avatar
Okhin committed
26

Okhin's avatar
Okhin committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    public function testFindByEmail()
    {
        $user = $this->container['user_finder']->findByEmail('alice@example.org');

        $expectedUser = [
            'id' => '1',
            'status' => '1',
            'hash' => '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
            'cumul' => '2000',
            'email' => 'alice@example.org',
            'total' => '5000',
            'pseudo' => 'Alice',
            'expiration' => null,
            'commentaire' => 'RAS',
        ];
        $this->assertEquals($expectedUser, $user);
    }

Okhin's avatar
Okhin committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    public function testFindByPseudo()
    {
        $user = $this->container['user_finder']->findByPseudo('Alice');

        $expectedUser = [
            'id' => '1',
            'status' => '1',
            'hash' => '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
            'cumul' => '2000',
            'email' => 'alice@example.org',
            'total' => '5000',
            'pseudo' => 'Alice',
            'expiration' => null,
            'commentaire' => 'RAS',
        ];
        $this->assertEquals($expectedUser, $user);
    }


Okhin's avatar
Okhin committed
64
65
66
    public function testAdminSearch()
    {
        $this->assertCount(1, $this->container['user_finder']->adminSearch($text='alice@example.org', $status=''));
Okhin's avatar
Okhin committed
67
        $this->assertCount(2, $this->container['user_finder']->adminSearch($text='', $status='1'));
Okhin's avatar
Okhin committed
68
69

    }
70
}