diff --git a/db/seeds/DonationSeeder.php b/db/seeds/DonationSeeder.php index c60ba6411d475f6ea0c0e1a4a5dcd68ff7165597..8e2969faf7f450ea98c1d4ec08b10890a9887885 100644 --- a/db/seeds/DonationSeeder.php +++ b/db/seeds/DonationSeeder.php @@ -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', ) ); diff --git a/src/LQDN/CommandHandler.php b/src/LQDN/CommandHandler.php index 52eabda0b70d4b36f069e92852b0c015e2b7e2f5..11f5184b0a4169ccc5e96d877a60313422017ca4 100644 --- a/src/LQDN/CommandHandler.php +++ b/src/LQDN/CommandHandler.php @@ -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)) { diff --git a/tests/functional/Handler/DonationHandlerTest.php b/tests/functional/Handler/DonationHandlerTest.php index be52872d3e982c4a3dc862cd5e70d47326a34813..e54a4867683a093981a72471e6f6da259ab04392 100644 --- a/tests/functional/Handler/DonationHandlerTest.php +++ b/tests/functional/Handler/DonationHandlerTest.php @@ -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"); + } }