Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
54e2dad3
Commit
54e2dad3
authored
Nov 15, 2018
by
Okhin
Browse files
get users by email
parent
cf41e30a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/LQDN/Finder/UserFinder.php
View file @
54e2dad3
...
...
@@ -25,6 +25,18 @@ class UserFinder
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE id = :id"
,
[
'id'
=>
(
int
)
$id
]);
}
/**
* findByEmail
*
* @param mixed $email
*
* @return []
*/
public
function
findByEmail
(
$email
)
{
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE email = :email"
,
[
'email'
=>
$email
]);
}
/**
* The search from the admin.
*
...
...
tests/functional/Finder/UserFinderTest.php
View file @
54e2dad3
...
...
@@ -24,6 +24,24 @@ class UserFinderTest extends FunctionalTest
$this
->
assertEquals
(
$expectedUser
,
$user
);
}
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
);
}
public
function
testAdminSearch
()
{
$this
->
assertCount
(
1
,
$this
->
container
[
'user_finder'
]
->
adminSearch
(
$text
=
'alice@example.org'
,
$status
=
''
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment