]> git.agnieray.net Git - galette.git/commitdiff
Check MySQL warning in tests suite
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 6 Nov 2021 09:05:36 +0000 (10:05 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 7 Nov 2021 05:50:39 +0000 (06:50 +0100)
37 files changed:
galette/lib/Galette/Core/Db.php
tests/Galette/Controllers/tests/units/PdfController.php
tests/Galette/Core/tests/units/CheckModules.php
tests/Galette/Core/tests/units/Db.php
tests/Galette/Core/tests/units/I18n.php
tests/Galette/Core/tests/units/Install.php
tests/Galette/Core/tests/units/L10n.php
tests/Galette/Core/tests/units/Links.php
tests/Galette/Core/tests/units/Logo.php
tests/Galette/Core/tests/units/Password.php
tests/Galette/Core/tests/units/Picture.php
tests/Galette/Core/tests/units/Plugins.php
tests/Galette/Core/tests/units/Preferences.php
tests/Galette/Core/tests/units/PrintLogo.php
tests/Galette/DynamicFields/tests/units/Boolean.php
tests/Galette/DynamicFields/tests/units/Separator.php
tests/Galette/Entity/tests/units/Adherent.php
tests/Galette/Entity/tests/units/Contribution.php
tests/Galette/Entity/tests/units/FieldsConfig.php
tests/Galette/Entity/tests/units/ListsConfig.php
tests/Galette/Entity/tests/units/PaymentType.php
tests/Galette/Entity/tests/units/PdfModel.php
tests/Galette/Entity/tests/units/SavedSeach.php
tests/Galette/Entity/tests/units/Status.php
tests/Galette/Entity/tests/units/Title.php
tests/Galette/Entity/tests/units/Transaction.php
tests/Galette/IO/tests/units/CsvIn.php
tests/Galette/IO/tests/units/News.php
tests/Galette/Middleware/tests/unit/CheckAcls.php
tests/Galette/Repository/tests/units/Members.php
tests/Galette/Repository/tests/units/PaymentTypes.php
tests/Galette/Repository/tests/units/PdfModels.php
tests/Galette/Repository/tests/units/Reminders.php
tests/Galette/Util/tests/units/Password.php
tests/Galette/Util/tests/units/Telemetry.php
tests/GaletteTestCase.php
tests/GaletteUpdate/Core/tests/units/Install.php

index b35791efa486554a83d17dabb9688342525f7a3f..ef45d7b750db62025d1c9ffa91a496b6d71a044e 100644 (file)
@@ -980,4 +980,21 @@ class Db
                 : null
         );
     }
+
+    /**
+     * Get MySQL warnings
+     *
+     * @return array
+     */
+    public function getWarnings(): array
+    {
+        $results = $this->db->query('SHOW WARNINGS', Adapter::QUERY_MODE_EXECUTE);
+
+        $warnings = [];
+        foreach ($results as $result) {
+            $warnings[] = $result;
+        }
+
+        return $warnings;
+    }
 }
index 9b1ea39da1e8209cd8a51e9904987fe18f98a685..dc6171993ca2807e1bd035e89e80c42d444b231a 100644 (file)
@@ -73,11 +73,11 @@ class PdfController extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->preferences = new \Galette\Core\Preferences($this->zdb);
@@ -150,6 +150,20 @@ class PdfController extends atoum
         $hist = $this->history;
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test store models
      *
index 57b606c48aadd8dc8e99570f4c8ed463a0d3849c..3d97aedea7b0dd72d6586e574f00f581e29c94a5 100644 (file)
@@ -53,6 +53,21 @@ use atoum;
  */
 class CheckModules extends atoum
 {
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $zdb = new \Galette\Core\Db();
+            $this->array($zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test modules, all should be ok
      *
index c7ec1360ffc2f67536ceb5ce198954dde43b9053..6fd7d4164cead5974330c02f917220ad1e3b6675 100644 (file)
@@ -58,15 +58,29 @@ class Db extends atoum
     /**
      * Set up tests
      *
-     * @param stgring $testMethod Method tested
+     * @param stgring $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->db = new \Galette\Core\Db();
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql' and $method !== 'testExecuteWException') {
+            $this->array($this->db->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Cleanup after tests
      *
@@ -611,6 +625,17 @@ class Db extends atoum
 
         $this->object($results)
             ->isInstanceOf('\Zend\Db\ResultSet\ResultSet');
+    }
+
+    /**
+     * Test execute Method
+     *
+     * @return void
+     */
+    public function testExecuteWException()
+    {
+        $select = $this->db->select('preferences', 'p');
+        $select->where(['p.nom_pref' => 'azerty']);
 
         $this->exception(
             function () use ($select) {
index cf4ca5e73b5843bc5728196d33554570ea5b226a..d61f41279fc49c2c8bf9272bd193f27c5ffcfa61 100644 (file)
@@ -53,22 +53,38 @@ use atoum;
  */
 class I18n extends atoum
 {
+    private $zdb;
     private $i18n = null;
 
     /**
      * Set up tests
      *
-     * @param string $testMethod Tested method name
+     * @param string $method Tested method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
+        $this->zdb = new \Galette\Core\Db();
         $this->i18n = new \Galette\Core\I18n(
             \Galette\Core\I18n::DEFAULT_LANG
         );
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test lang autodetect
      *
index 261e95dcc378275a7a926ec1acd27f15259bb17e..b3efd802ec2bd200add01961b97ed3e65809e2b6 100644 (file)
@@ -58,16 +58,31 @@ class Install extends atoum
     /**
      * Set up tests
      *
-     * @param stgring $testMethod Method tested
+     * @param stgring $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         setlocale(LC_ALL, 'en_US');
         $this->install = new \Galette\Core\Install();
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $zdb = new \Galette\Core\Db();
+            $this->array($zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test constructor
      *
index b77c04e73b4f655ca6170eb29cdeb0aead301faa..1507b182692abaa689f86f3ab3502b27bc94b02b 100644 (file)
@@ -59,11 +59,11 @@ class L10n extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Tested method name
+     * @param string $method Tested method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->i18n = new \Galette\Core\I18n(
@@ -78,12 +78,15 @@ class L10n extends atoum
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         //cleanup dynamic translations
         $delete = $this->zdb->delete(\Galette\Core\L10n::TABLE);
         $delete
index 1b8202b160cb22544e35c538fd4e985415cb660d..fbe8aa6aca141e51ac3e869d9ec888ca1e6591ab 100644 (file)
@@ -56,17 +56,18 @@ class Links extends GaletteTestCase
     protected $seed = 95842355;
     private $links;
     private $ids = [];
+    protected $excluded_after_methods = ['testDuplicateLinkTarget'];
 
     /**
      * Set up tests
      *
-     * @param string $testMethod Method name
+     * @param string $method Method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->initStatus();
         $this->initContributionsTypes();
 
@@ -90,6 +91,8 @@ class Links extends GaletteTestCase
      */
     public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
+
         $delete = $this->zdb->delete(\Galette\Entity\Contribution::TABLE);
         $delete->where(['info_cotis' => 'FAKER' . $this->seed]);
         $this->zdb->execute($delete);
index d1fd13831e4bd4ef1facf860c8664869c0d44ff1..7507c5301eae021c3a46a3d9441c0abaa032a19a 100644 (file)
@@ -58,17 +58,31 @@ class Logo extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method name
+     * @param string $method Method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         global $zdb;
         $this->zdb = new \Galette\Core\Db();
         $zdb = $this->zdb;
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test defaults after initialization
      *
index 2f9e605c382c5cfe7aa8979f59d3c88a8bdba07e..27507c7188d794710764416aaf4d1709c7f34a88 100644 (file)
@@ -59,16 +59,30 @@ class Password extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method name
+     * @param string $method Method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->pass = new \Galette\Core\Password($this->zdb, false);
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test unique password generator
      *
index 671583ac7988b285dc42fbee9b26dea1c3f86f97..a4af6e793cf3752df7942afc73db7c01f970a561 100644 (file)
@@ -53,6 +53,7 @@ use atoum;
  */
 class Picture extends atoum
 {
+    private $zdb;
     private $picture;
     private $expected_badchars = [
         '.',
@@ -72,15 +73,30 @@ class Picture extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method name
+     * @param string $method Method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
+        $this->zdb = new \Galette\Core\Db();
         $this->picture = new \Galette\Core\Picture();
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test defaults after initialization
      *
index 93adda18c22bac7406d497e7758a0ed771506928..e8b13ead18da2b0d022d899b29ac0889deb24ab4 100644 (file)
@@ -89,11 +89,11 @@ class Plugins extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method tested
+     * @param string $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->preferences = new \Galette\Core\Preferences($this->zdb);
@@ -104,6 +104,19 @@ class Plugins extends atoum
             $this->plugin2['root'];
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
 
     /**
      * Tests plugins load
index e77f103202a4b59dfd770ccd5de25f36747fc928..9e60112dd749a4aedcb6d6de6b54100ade328c09 100644 (file)
@@ -59,11 +59,11 @@ class Preferences extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->preferences = new \Galette\Core\Preferences(
@@ -71,6 +71,20 @@ class Preferences extends atoum
         );
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test preferences initialization
      *
index 5e93aebd9096ecf9a31ff2a3a6a1b8d33621fe52..0d017f907c865a8d7a91342fdca40dfd8ae3ac47 100644 (file)
@@ -58,17 +58,31 @@ class PrintLogo extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method name
+     * @param string $method Method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         global $zdb;
         $this->zdb = new \Galette\Core\Db();
         $zdb = $this->zdb;
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test defaults after initialization
      *
index babf9a544ff5e933180c9ec70991b91ab0a44124..efe5301d3f5ed53344f9c9fff203f1fcb993de45 100644 (file)
@@ -59,11 +59,11 @@ class Boolean extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Current test method
+     * @param string $method Current test method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->bool = new \Galette\DynamicFields\Boolean($this->zdb);
index 497046fd4f0657b5a05443ba2f8e3f5c394f7ff3..7efb432a0cd6c87d820a2efaad2c796277ec1423 100644 (file)
@@ -59,11 +59,11 @@ class Separator extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Current test method
+     * @param string $method Current test method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->separator = new \Galette\DynamicFields\Separator($this->zdb);
index 58fb837712d11498ee7e4c0815bc87d279d84821..54ac7b621fbd82309683bf01abc627b573d7a526 100644 (file)
@@ -80,13 +80,13 @@ class Adherent extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->initStatus();
         $this->initTitles();
 
index 6e03bd068ef3462bd6e6422fc148e7ce2ef17fc2..eab88571706132cd8278a0505323d6bdf72a1bce 100644 (file)
@@ -64,6 +64,8 @@ class Contribution extends GaletteTestCase
      */
     public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
+
         $this->zdb = new \Galette\Core\Db();
         $delete = $this->zdb->delete(\Galette\Entity\Contribution::TABLE);
         $delete->where(['info_cotis' => 'FAKER' . $this->seed]);
@@ -84,13 +86,13 @@ class Contribution extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->initContributionsTypes();
 
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
index a6623604f45b1557b58e05f770bc7d6ba8e71abb..df4916cf235178ecccf69c0203077ed37fb879f9 100644 (file)
@@ -61,11 +61,11 @@ class FieldsConfig extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
 
index e24f48d2f8397836d52d5b14e2d68e0f424afa0d..6cc0f020c23e99177c5b96f3281f939f34e1d9b9 100644 (file)
@@ -69,11 +69,11 @@ class ListsConfig extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
 
@@ -94,12 +94,15 @@ class ListsConfig extends atoum
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         $this->resetListsConfig();
     }
 
index fd8d477e6fe4d7b734182ba1453eb3344d0fa765..693f1eb9e0f5c1f9101beb0752951d795472fe48 100644 (file)
@@ -62,11 +62,11 @@ class PaymentType extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->preferences = new \Galette\Core\Preferences($this->zdb);
@@ -83,12 +83,15 @@ class PaymentType extends atoum
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         $this->deletePaymentType();
     }
 
index 17fe39cecc75fd557caf96e8895b13e1a2337deb..42d03d1ff0516620f5fb89e88a4047328ac299a9 100644 (file)
@@ -61,13 +61,13 @@ class PdfModel extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
 
         $models = new \Galette\Repository\PdfModels($this->zdb, $this->preferences, $this->login);
         $res = $models->installInit(false);
@@ -85,12 +85,14 @@ class PdfModel extends GaletteTestCase
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
+
         $delete = $this->zdb->delete(\Galette\Entity\Contribution::TABLE);
         $delete->where(['info_cotis' => 'FAKER' . $this->seed]);
         $this->zdb->execute($delete);
index 317e668258a19e078a76f9e548e13f096e7fa745..22ea8e4654a7f67340ec5d0c930518fe9098a501 100644 (file)
@@ -61,11 +61,11 @@ class SavedSearch extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->i18n = new \Galette\Core\I18n();
@@ -79,12 +79,15 @@ class SavedSearch extends atoum
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         $this->deleteCreated();
     }
 
index 8f5c4045d0245316946f56acfe1bbb00e7262d97..ead4c896e8b0f8a5d21c4bb72cf9275d43fb43c0 100644 (file)
@@ -61,11 +61,11 @@ class Status extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->i18n = new \Galette\Core\I18n(
@@ -76,12 +76,15 @@ class Status extends atoum
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         $this->deleteStatus();
     }
 
index 91c4bed081d5adff04389a678b12508276807eb8..9a79f738ae357ddc90ff52c789ab717c05af63f7 100644 (file)
@@ -60,11 +60,11 @@ class Title extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
     }
@@ -72,12 +72,15 @@ class Title extends atoum
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         $this->deleteTitle();
     }
 
index 7040657bf31a0465d1316991543c52615f19adf8..0137a264d4532e60ad4e5f8aaaa614d06e6f17ff 100644 (file)
@@ -65,6 +65,8 @@ class Transaction extends GaletteTestCase
      */
     public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
+
         $this->zdb = new \Galette\Core\Db();
 
         //first, remove contributions
@@ -94,13 +96,13 @@ class Transaction extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->initContributionsTypes();
 
         $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
index 2d09f17f33b3233980a5f4885d698df1792c1d22..254157542a2ef4d4ea5f2f0287e19f042343f26d 100644 (file)
@@ -61,25 +61,27 @@ class CsvIn extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->contents_table = null;
     }
 
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
+
         $delete = $this->zdb->delete(\Galette\Entity\Adherent::TABLE);
         $this->zdb->execute($delete);
         $delete = $this->zdb->delete(\Galette\Entity\DynamicFieldsHandle::TABLE);
index f225a430510118318e1f8113e64693a2fa12a320..cfaf16dcff2cfd0df824632b2ca5826b7c6da5bb 100644 (file)
@@ -58,11 +58,11 @@ class News extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method name
+     * @param string $method Method name
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->i18n = new \Galette\Core\I18n();
         global $i18n;
index 9768478680f65519b68fa26b7e95e06e97fc33d1..43657a2002fdd24ad361e58536749ac37d424e80 100644 (file)
@@ -58,11 +58,11 @@ class CheckAcls extends atoum
     /**
      * Set up tests
      *
-     * @param stgring $testMethod Method tested
+     * @param stgring $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $app =  new \Galette\Core\SlimApp();
         require GALETTE_ROOT . 'includes/core_acls.php';
index 507597f8d81e5fb973de76b86f4bef0bf1147557..8f3c489559beb53c0ec3cc9bd3509539f33908f7 100644 (file)
@@ -59,25 +59,27 @@ class Members extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->createMembers();
     }
 
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
+
         $this->deleteGroups();
         $this->deleteMembers();
     }
index a65877bb69f43769c266fc062912f44e1c2172a1..842766958ab9b530858a0386d2cc53a210805ef7 100644 (file)
@@ -58,13 +58,13 @@ class PaymentTypes extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
 
         $types = new \Galette\Repository\PaymentTypes($this->zdb, $this->preferences, $this->login);
         $res = $types->installInit(false);
@@ -74,12 +74,13 @@ class PaymentTypes extends GaletteTestCase
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
         $this->deletePaymentType();
     }
 
index f41966bbd88ab467697f0c67be6eaf3be06345a6..7dafc7ed498070bb881385dcd0bc9d1bc9556d3b 100644 (file)
@@ -58,13 +58,13 @@ class PdfModels extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
 
         $models = new \Galette\Repository\PdfModels($this->zdb, $this->preferences, $this->login);
         $res = $models->installInit(false);
@@ -74,12 +74,13 @@ class PdfModels extends GaletteTestCase
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
         $this->deletePdfModels();
     }
 
index f003669b3208c2425304d4f415ca7dfdaf1745b4..be1dd4ebf1dd83da7eef06e8ab14d92cc1604a56 100644 (file)
@@ -60,13 +60,13 @@ class Reminders extends GaletteTestCase
     /**
      * Set up tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
-        parent::beforeTestMethod($testMethod);
+        parent::beforeTestMethod($method);
         $this->initStatus();
         $this->initContributionsTypes();
 
@@ -83,12 +83,13 @@ class Reminders extends GaletteTestCase
     /**
      * Tear down tests
      *
-     * @param string $testMethod Calling method
+     * @param string $method Calling method
      *
      * @return void
      */
-    public function afterTestMethod($testMethod)
+    public function afterTestMethod($method)
     {
+        parent::afterTestMethod($method);
         $this->cleanContributions();
 
         $delete = $this->zdb->delete(\Galette\Entity\Adherent::TABLE);
index c8eea2e326682ebfbb2a93e0f897fa5401d79140..5ceabf4eea8fd92057b93b477ba97456c9fc6096 100644 (file)
@@ -65,6 +65,9 @@ class Password extends atoum
      */
     public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
         $this->preferences->pref_password_strength = Preferences::PWD_NONE;
         $this->preferences->pref_password_length = 6;
         $this->preferences->pref_password_blacklist = false;
@@ -74,11 +77,11 @@ class Password extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method tested
+     * @param string $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->preferences = new \Galette\Core\Preferences($this->zdb);
index 3b5018813513b28d59b294c437f766200cc04689..19d23993df04ca7e39894e9267b406638385918d 100644 (file)
@@ -66,6 +66,10 @@ class Telemetry extends atoum
      */
     public function afterTestMethod($method)
     {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+
         $this->preferences->pref_instance_uuid = '';
         $this->preferences->pref_registration_uuid = '';
         $this->preferences->store();
@@ -74,11 +78,11 @@ class Telemetry extends atoum
     /**
      * Set up tests
      *
-     * @param string $testMethod Method tested
+     * @param string $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->zdb = new \Galette\Core\Db();
         $this->preferences = new \Galette\Core\Preferences($this->zdb);
index e103ebb15ed456c6d2e7e637133d8a9286c960aa..6497ef8887907d4e8d5f2dc01cc72855653ae70d 100644 (file)
@@ -90,15 +90,16 @@ abstract class GaletteTestCase extends atoum
     protected $request;
     protected $response;
     protected $seed;
+    protected $excluded_after_methods = [];
 
     /**
      * Set up tests
      *
-     * @param stgring $testMethod Method tested
+     * @param stgring $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         $this->mocked_router = new \mock\Slim\Router();
         $this->calling($this->mocked_router)->pathFor = function ($name, $params) {
@@ -140,6 +141,20 @@ abstract class GaletteTestCase extends atoum
         $galette_log_var = $this->logger_storage;
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql' && !in_array($method, $this->excluded_after_methods)) {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Loads member from a resultset
      *
index b07c7e13163ab090a994bcaac663b40377b738b2..4ee9408f494eb2de400916134afae5f73f4b84ce 100644 (file)
@@ -63,11 +63,11 @@ class Install extends atoum
     /**
      * Set up tests
      *
-     * @param stgring $testMethod Method tested
+     * @param stgring $method Method tested
      *
      * @return void
      */
-    public function beforeTestMethod($testMethod)
+    public function beforeTestMethod($method)
     {
         setlocale(LC_ALL, 'en_US');
 
@@ -95,6 +95,20 @@ class Install extends atoum
         $this->zdb = $container->get('zdb');
     }
 
+    /**
+     * Tear down tests
+     *
+     * @param string $method Calling method
+     *
+     * @return void
+     */
+    public function afterTestMethod($method)
+    {
+        if (TYPE_DB === 'mysql') {
+            $this->array($this->zdb->getWarnings())->isIdenticalTo([]);
+        }
+    }
+
     /**
      * Test updates
      *