Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
don
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
25
Issues
25
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
LQDN Adminsys
don
Commits
bdb1af3b
Commit
bdb1af3b
authored
Nov 16, 2018
by
Okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a findByPseudo user finder
parent
a39e9915
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
src/LQDN/Finder/DonationFinder.php
src/LQDN/Finder/DonationFinder.php
+2
-1
src/LQDN/Finder/UserFinder.php
src/LQDN/Finder/UserFinder.php
+12
-0
tests/functional/Finder/UserFinderTest.php
tests/functional/Finder/UserFinderTest.php
+19
-0
No files found.
src/LQDN/Finder/DonationFinder.php
View file @
bdb1af3b
...
...
@@ -61,7 +61,7 @@ SELECT d.id as id,
a.ville AS ville,
a.pays AS pays
FROM dons d
JOIN users u ON u.id = d.user_id
LEFT
JOIN users u ON u.id = d.user_id
LEFT JOIN adresses a ON d.adresse_id = a.id
WHERE 1=1
EOQ;
...
...
@@ -92,6 +92,7 @@ EOQ;
$params
[
'date1'
]
=
$date1
;
$params
[
'date2'
]
=
$date2
;
}
$first
=
(
$page
-
1
)
*
$limit
;
$last
=
(
$page
)
*
$limit
;
$query
.
=
" ORDER BY datec DESC LIMIT
$first
,
$last
"
;
...
...
src/LQDN/Finder/UserFinder.php
View file @
bdb1af3b
...
...
@@ -37,6 +37,18 @@ class UserFinder
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE email = :email"
,
[
'email'
=>
$email
]);
}
/**
* findByPseudo
*
* @param mixed pseudo
*
* @return []
*/
public
function
findByPseudo
(
$pseudo
)
{
return
$this
->
connection
->
fetchAssoc
(
"SELECT * FROM users WHERE pseudo = :pseudo"
,
[
'pseudo'
=>
$pseudo
]);
}
/**
* The search from the admin.
*
...
...
tests/functional/Finder/UserFinderTest.php
View file @
bdb1af3b
...
...
@@ -42,6 +42,25 @@ class UserFinderTest extends FunctionalTest
$this
->
assertEquals
(
$expectedUser
,
$user
);
}
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
);
}
public
function
testAdminSearch
()
{
$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