]> git.agnieray.net Git - galette.git/commitdiff
Instanciate titles, models, status, ...
authorJohan Cwiklinski <johan@x-tnd.be>
Fri, 22 Mar 2024 20:22:24 +0000 (21:22 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Thu, 28 Mar 2024 05:42:58 +0000 (06:42 +0100)
tests/Galette/Controllers/tests/units/PdfController.php
tests/Galette/Core/tests/units/Links.php
tests/Galette/Entity/tests/units/Adherent.php
tests/Galette/Entity/tests/units/Contribution.php
tests/Galette/Entity/tests/units/Transaction.php
tests/Galette/Repository/tests/units/Reminders.php
tests/Galette/Repository/tests/units/Transactions.php
tests/GaletteTestCase.php

index a8f6b5603a472e15bd548c74a38d3ab781cf0b4c..018b210b14edddd7ec5cc123927cc6706b01ba9f 100644 (file)
@@ -44,10 +44,6 @@ class PdfController extends GaletteTestCase
     {
         parent::setUp();
 
-        $this->initModels();
-        $this->initStatus();
-        $this->initContributionsTypes();
-
         $this->adh = new \Galette\Entity\Adherent($this->zdb);
         $this->adh->setDependencies(
             $this->preferences,
index c152a56f9344c8062d7b17cd732f332bcce34e5a..80cb52dcb44a7a33ac5e84ff601969b92ee740d4 100644 (file)
@@ -44,8 +44,6 @@ class Links extends GaletteTestCase
     public function setUp(): void
     {
         parent::setUp();
-        $this->initStatus();
-        $this->initContributionsTypes();
 
         $this->links = new \Galette\Core\Links($this->zdb, false);
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
index 7c145b04d1a6aa78efc5661969fa2bb78bdca952..86482a9f9689107d1a122ad4d78ddf6f88ab23f8 100644 (file)
@@ -75,8 +75,6 @@ class Adherent extends GaletteTestCase
     public function setUp(): void
     {
         parent::setUp();
-        $this->initStatus();
-        $this->initTitles();
 
         $this->default_deps = [
             'picture'   => true,
index 6a368086d1c6028564fa65f107d747f2bc7791b3..ef3ae9297ce09f96c12a4313d1d4fe7090661be9 100644 (file)
@@ -64,7 +64,6 @@ class Contribution extends GaletteTestCase
     public function setUp(): void
     {
         parent::setUp();
-        $this->initContributionsTypes();
 
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
 
index 8977ebb1213b7062ae3219d60bf4088422c619de..6bd2e8be4b86b696dd2024e88924474aa1b2a0ec 100644 (file)
@@ -75,7 +75,6 @@ class Transaction extends GaletteTestCase
     public function setUp(): void
     {
         parent::setUp();
-        $this->initContributionsTypes();
 
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
         $this->transaction = new \Galette\Entity\Transaction($this->zdb, $this->login);
index 8699a04b2d3b190e4b49c1c3847714430d8a0f37..9067f388d2f698a6e43fb9102204753c44960309 100644 (file)
@@ -42,8 +42,6 @@ class Reminders extends GaletteTestCase
     public function setUp(): void
     {
         parent::setUp();
-        $this->initStatus();
-        $this->initContributionsTypes();
 
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
 
index 5751d1f445f330cb905ee49f9ffb35720e2a575d..8a71d8e7aa00520f12a7c2c5dbcffc373ce089c1 100644 (file)
@@ -71,7 +71,6 @@ class Transactions extends GaletteTestCase
     public function setUp(): void
     {
         parent::setUp();
-        $this->initContributionsTypes();
 
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
         $this->transaction = new \Galette\Entity\Transaction($this->zdb, $this->login);
index 43816ef34a55882f8927cdd506815ca81112588b..cd9818ae66322aa53b9bfe414a7df395e34ca0c7 100644 (file)
@@ -102,6 +102,12 @@ abstract class GaletteTestCase extends TestCase
         $container = $this->container;
         $galette_log_var = $this->logger_storage;
 
+        $this->initPaymentTypes();
+        $this->initStatus();
+        $this->initContributionsTypes();
+        $this->initModels();
+        $this->initTitles();
+
         $authenticate = new \Galette\Middleware\Authenticate($container);
 
         require GALETTE_ROOT . 'includes/routes/main.routes.php';
@@ -713,6 +719,21 @@ abstract class GaletteTestCase extends TestCase
         }
     }
 
+    /**
+     * Initialize default payment types in database
+     *
+     * @return void
+     */
+    protected function initPaymentTypes(): void
+    {
+        $types = new \Galette\Repository\PaymentTypes($this->zdb, $this->preferences, $this->login);
+        if (count($types->getList()) === 0) {
+            //payment types are not yet instanciated.
+            $res = $types->installInit(false);
+            $this->assertTrue($res);
+        }
+    }
+
     /**
      * Initialize default titles in database
      *