Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 024b0af

Browse files
committed
Added credentials key test
1 parent 6dcd2bf commit 024b0af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/AdldapTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,21 @@ public function testAuthFailsWhenUserFound()
102102

103103
$this->assertFalse(Auth::attempt(['email' => 'jdoe@email.com', 'password' => '12345']));
104104
}
105+
106+
public function testCredentialsKeyDoesNotExist()
107+
{
108+
$mockedSearch = Mockery::mock('Adldap\Classes\Search');
109+
110+
$mockedUsers = Mockery::mock('Adldap\Classes\Users');
111+
112+
$mockedUsers->shouldReceive('search')->once()->andReturn($mockedSearch);
113+
114+
Adldap::shouldReceive('users')->once()->andReturn($mockedUsers);
115+
116+
$nonExistantInputKey = 'non-existant-key';
117+
118+
$this->setExpectedException('ErrorException');
119+
120+
Auth::attempt([$nonExistantInputKey => 'jdoe@email.com', 'password' => '12345']);
121+
}
105122
}

0 commit comments

Comments
 (0)