Commit 99a14915 by Julien Jorry

Solidoume : delete local tests

parent 4792a5a5
......@@ -111,12 +111,8 @@ class SolidoumeCommand extends Command
private function executeReminders()
{
$this->io->title('START : Rappel par email');
if (!$this->isTest) {
$items = $this->em->getRepository(SolidoumeItem::class)->findBy(['enabled' => true]);
} else {
$items = $this->getItemsForTest();
}
$items = $this->em->getRepository(SolidoumeItem::class)->findBy(['enabled' => true]);
foreach ($items as $item) {
if ($this->hasToExecuteReminders($item)) {
$amount = $item->getAmount();
......@@ -173,11 +169,8 @@ class SolidoumeCommand extends Command
$this->io->title('START : prélèvement du jour');
$nowDay = (new \DateTime('now', new \DateTimeZone('UTC')))->format('d');
$nowMonth = intval((new \DateTime('now', new \DateTimeZone('UTC')))->format('Ym'));
if (!$this->isTest) {
$items = $this->em->getRepository(SolidoumeItem::class)->findBy(['enabled' => true, 'paiementDate' => $nowDay]);
} else {
$items = $this->getItemsForTest();
}
$items = $this->em->getRepository(SolidoumeItem::class)->findBy(['enabled' => true, 'paiementDate' => $nowDay]);
try {
$em = $this->em;
$isTest = $this->isTest;
......@@ -241,11 +234,8 @@ class SolidoumeCommand extends Command
$this->io->warning("Ce n'est pas le jour d'execution du programme (" . $this->param->getExecutionDate() . ')');
} else {
$this->io->title('START : Répartition de la somme récoltée');
if (!$this->isTest) {
$items = $this->em->getRepository(SolidoumeItem::class)->findBy(['enabled' => true]);
} else {
$items = $this->getItemsForTest();
}
$items = $this->em->getRepository(SolidoumeItem::class)->findBy(['enabled' => true]);
$total = 0;
$countPerson = 0;
$countParticipants = 0;
......@@ -362,50 +352,4 @@ class SolidoumeCommand extends Command
return false;
}
/**
* Get items for local testing purpose.
*
* @return array
*/
private function getItemsForTest()
{
if (null == $this->itemsTest) {
$this->itemsTest = [
$this->getItemForTest(10, true, true, $this->em->getRepository(Adherent::class)->findOneByEmail('julien.jorry@gmail.com')),
$this->getItemForTest(10, false, true, $this->em->getRepository(Adherent::class)->findOneByEmail('julien.jorry+22@gmail.com')),
$this->getItemForTest(40, false, false, $this->em->getRepository(Adherent::class)->findOneByEmail('julien.jorry+123@gmail.com')),
$this->getItemForTest(50, false, true, $this->em->getRepository(Adherent::class)->findOneByEmail('julien.jorry+test2@gmail.com')),
$this->getItemForTest(60, false, true, $this->em->getRepository(Adherent::class)->findOneByEmail('julien.jorry+testadh@gmail.com')),
$this->getItemForTest(70, true, false, $this->em->getRepository(Adherent::class)->findOneByEmail('julien.jorry+adh@gmail.cm')),
];
}
return $this->itemsTest;
}
/**
* Get one SolidouItem for local testing purpose.
*
* @param int $amount
* @param bool $donation
* @param bool $recurrent
* @param Adherent $adherent
*
* @return SolidoumeItem
*/
private function getItemForTest(int $amount, bool $donation, bool $recurrent, Adherent $adherent)
{
$item0 = new SolidoumeItem();
$item0->setAmount($amount);
$item0->setIsRecurrent($recurrent);
$item0->setIsDonation($donation);
$item0->setPaiementDate(7);
$item0->setAdherent($adherent);
$item0->setUser($this->em->getRepository(User::class)->findOneByEmail('julien.jorry@gmail.com'));
$item0->setLastMonthPayed(202203);
$item0->setComments('test');
return $item0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment