Skip to content
Extraits de code Groupes Projets
Valider ac63af94 rédigé par Okhin's avatar Okhin
Parcourir les fichiers

Improving tests to recover donations by user

parent 41e00a69
Aucune branche associée trouvée
Aucune étiquette associée trouvée
3 requêtes de fusion!37Mise en production,!13Resolve "La structure des piplomes à changer, le Finder n'est plus fonctionnels.",!8WIP: Resolve "Améliorer et ajouter des tests"
......@@ -39,7 +39,59 @@ class DonationSeeder extends AbstractSeed
'cumul' => 1000,
'adresse_id' => 1,
'user_id' => 1,
'identifier' => 'id1',
'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',
)
);
......
......@@ -19,11 +19,7 @@ class CommandHandler
*/
public function handle($command)
{
try {
$method = $this->getHandleMethod($command);
} catch (Exception $e) {
throw new CommandNotHandledException();
}
$method = $this->getHandleMethod($command);
foreach ($this->handlers as $handler) {
if (method_exists($handler, $method)) {
......
......@@ -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");
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter