Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
don
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
17
Issues
17
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LQdN interne
don
Commits
54e2dad3
Commit
54e2dad3
authored
Nov 15, 2018
by
okhin
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get users by email
parent
cf41e30a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
src/LQDN/Finder/UserFinder.php
src/LQDN/Finder/UserFinder.php
+12
-0
tests/functional/Finder/UserFinderTest.php
tests/functional/Finder/UserFinderTest.php
+18
-0
No files found.
src/LQDN/Finder/UserFinder.php
View file @
54e2dad3
...
@@ -25,6 +25,18 @@ class UserFinder
...
@@ -25,6 +25,18 @@ class UserFinder
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE id = :id"
,
[
'id'
=>
(
int
)
$id
]);
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.
* The search from the admin.
*
*
...
...
tests/functional/Finder/UserFinderTest.php
View file @
54e2dad3
...
@@ -24,6 +24,24 @@ class UserFinderTest extends FunctionalTest
...
@@ -24,6 +24,24 @@ class UserFinderTest extends FunctionalTest
$this
->
assertEquals
(
$expectedUser
,
$user
);
$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
()
public
function
testAdminSearch
()
{
{
$this
->
assertCount
(
1
,
$this
->
container
[
'user_finder'
]
->
adminSearch
(
$text
=
'alice@example.org'
,
$status
=
''
));
$this
->
assertCount
(
1
,
$this
->
container
[
'user_finder'
]
->
adminSearch
(
$text
=
'alice@example.org'
,
$status
=
''
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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