: 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;
+ }
}
/**
* 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);
$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
*
*/
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
*
/**
* 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
*
$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) {
*/
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
*
/**
* 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
*
/**
* 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(
/**
* 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
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();
*/
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);
/**
* 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
*
/**
* 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
*
*/
class Picture extends atoum
{
+ private $zdb;
private $picture;
private $expected_badchars = [
'.',
/**
* 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
*
/**
* 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);
$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
/**
* 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(
);
}
+ /**
+ * 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
*
/**
* 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
*
/**
* 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);
/**
* 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);
/**
* 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();
*/
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]);
/**
* 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);
/**
* 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();
/**
* 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();
/**
* 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();
}
/**
* 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);
/**
* 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();
}
/**
* 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);
/**
* 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);
/**
* 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();
/**
* 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();
}
/**
* 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(
/**
* 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();
}
/**
* 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();
}
/**
* 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();
}
*/
public function afterTestMethod($method)
{
+ parent::afterTestMethod($method);
+
$this->zdb = new \Galette\Core\Db();
//first, remove contributions
/**
* 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);
/**
* 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);
/**
* 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;
/**
* 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';
/**
* 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();
}
/**
* 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);
/**
* 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();
}
/**
* 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);
/**
* 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();
}
/**
* 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();
/**
* 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);
*/
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;
/**
* 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);
*/
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();
/**
* 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);
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) {
$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
*
/**
* 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->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
*