Skip to content
GitLab
Menu
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
ac63af94
Commit
ac63af94
authored
Oct 13, 2018
by
Okhin
Browse files
Improving tests to recover donations by user
parent
41e00a69
Changes
3
Show whitespace changes
Inline
Side-by-side
db/seeds/DonationSeeder.php
View file @
ac63af94
...
...
@@ -40,6 +40,58 @@ class DonationSeeder extends AbstractSeed
'adresse_id'
=>
1
,
'user_id'
=>
1
,
'identifier'
=>
'id1'
,
),
array
(
'id'
=>
2
,
'status'
=>
1
,
'datec'
=>
'2016-06-10 12:34'
,
'somme'
=>
1000
,
'lang'
=>
'fr_FR'
,
'cadeau'
=>
1
,
'abo'
=>
1
,
'taille'
=>
8
,
'public'
=>
0
,
'pdf'
=>
'pdf'
,
'decimale'
=>
2
,
'datee'
=>
'2016-06-10 12:34'
,
'mailsent'
=>
1
,
'color'
=>
'blue'
,
'pi_x'
=>
3
,
'pi_y'
=>
3
,
'hash'
=>
'hash'
,
'taille_h'
=>
8
,
'fdnn_user'
=>
1234567890
,
'color_2'
=>
'red'
,
'cumul'
=>
1000
,
'adresse_id'
=>
1
,
'user_id'
=>
2
,
'identifier'
=>
'id2'
,
),
array
(
'id'
=>
3
,
'status'
=>
1
,
'datec'
=>
'2016-06-10 12:34'
,
'somme'
=>
1000
,
'lang'
=>
'fr_FR'
,
'cadeau'
=>
1
,
'abo'
=>
1
,
'taille'
=>
8
,
'public'
=>
0
,
'pdf'
=>
'pdf'
,
'decimale'
=>
2
,
'datee'
=>
'2016-06-10 12:34'
,
'mailsent'
=>
1
,
'color'
=>
'blue'
,
'pi_x'
=>
3
,
'pi_y'
=>
3
,
'hash'
=>
'hash'
,
'taille_h'
=>
8
,
'fdnn_user'
=>
1234567890
,
'color_2'
=>
'red'
,
'cumul'
=>
1000
,
'adresse_id'
=>
1
,
'user_id'
=>
2
,
'identifier'
=>
'id3'
,
)
);
...
...
src/LQDN/CommandHandler.php
View file @
ac63af94
...
...
@@ -19,11 +19,7 @@ class CommandHandler
*/
public
function
handle
(
$command
)
{
try
{
$method
=
$this
->
getHandleMethod
(
$command
);
}
catch
(
Exception
$e
)
{
throw
new
CommandNotHandledException
();
}
foreach
(
$this
->
handlers
as
$handler
)
{
if
(
method_exists
(
$handler
,
$method
))
{
...
...
tests/functional/Handler/DonationHandlerTest.php
View file @
ac63af94
...
...
@@ -25,6 +25,13 @@ class DonationHandlerTest extends FunctionalTest
$this
->
assertEquals
(
''
,
$this
->
getDonation
(
1
)[
'pdf'
]);
}
private
function
testDonationByUser
()
{
$this
->
assertEquals
(
2
,
count
(
$this
->
getDonationByUser
(
2
)));
$this
->
assertEquals
(
2
,
$this
->
getDonationByUser
(
2
)[
0
][
'user_id'
]);
}
/**
* Retrieve a donation
*
...
...
@@ -34,4 +41,14 @@ class DonationHandlerTest extends FunctionalTest
{
return
$this
->
container
[
'db'
]
->
fetchAssoc
(
"SELECT * FROM dons WHERE id =
$id
"
);
}
/**
* Retrieve donations by userid
*
* @return []
*/
private
function
getDonationByUser
(
$uid
)
{
return
$this
->
container
[
'db'
]
->
fetchAll
(
"SELECT * FROM dons WHERE user_id =
$uid
"
);
}
}
Write
Preview
Supports
Markdown
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