Code Duplication    Length = 13-14 lines in 3 locations

Tests/Ldap/LdapManagerTest.php 1 location

@@ 134-147 (lines=14) @@
131
    /**
132
     * @covers \DoL\LdapBundle\Ldap\LdapManager::bind
133
     */
134
    public function testBind()
135
    {
136
        $password = 'password';
137
138
        /** @var UserInterface $user */
139
        $user = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserInterface');
140
141
        $this->driver->expects($this->once())
142
            ->method('bind')
143
            ->with($user, $this->equalTo($password))
144
            ->will($this->returnValue(true));
145
146
        self::assertTrue($this->ldapManager->bind($user, $password));
147
    }
148
149
    /**
150
     * @param $username

Tests/Security/User/LdapUserProviderTest.php 2 locations

@@ 34-46 (lines=13) @@
31
        $this->userProvider = new LdapUserProvider($this->ldapManager, new TestLogger());
32
    }
33
34
    public function testLoadUserByUsername()
35
    {
36
        $username = 'test_username';
37
        $user = new TestUser();
38
        $user->setUsername($username);
39
40
        $this->ldapManager->expects($this->once())
41
            ->method('findUserByUsername')
42
            ->with($this->equalTo($username))
43
            ->will($this->returnValue($user));
44
45
        self::assertEquals($username, $this->userProvider->loadUserByUsername($username)->getUsername());
46
    }
47
48
    public function testLoadUserByUsernameNotFound()
49
    {
@@ 64-76 (lines=13) @@
61
        }
62
    }
63
64
    public function testRefreshUser()
65
    {
66
        $username = 'test_username';
67
        $user = new TestUser();
68
        $user->setUsername($username);
69
70
        $this->ldapManager->expects($this->once())
71
            ->method('findUserByUsername')
72
            ->with($this->equalTo($username))
73
            ->will($this->returnValue($user));
74
75
        self::assertEquals($user, $this->userProvider->refreshUser($user));
76
    }
77
}
78