Skip to content

Commit

Permalink
afup#1416 test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Jan 7, 2024
1 parent d15c6b4 commit 7316959
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 45 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
- name: Composer install
run: composer install --no-scripts

- name: Config file
run: make configs/application/config.php

- name: Parameters file
run: make app/config/parameters.yml

- name: Tests - Unit
run: ./bin/atoum

Expand Down Expand Up @@ -66,10 +72,10 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: CS fixer prerequisites config
- name: Config file
run: make configs/application/config.php

- name: CS fixer prerequisites parameters
- name: Parameters file
run: make app/config/parameters.yml

- name: Composer install
Expand Down Expand Up @@ -103,9 +109,12 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Prerequisites
- name: Config file
run: make configs/application/config.php

- name: Parameters file
run: make app/config/parameters.yml

- name: Composer install
run: composer install --no-scripts --ignore-platform-req=php

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ test:
test-functional: data config htdocs/uploads
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) stop dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) up -d dbtest apachephptest planetetest mailcatcher
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm cliphp ./bin/behat
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm cliphp ./bin/behat -c behat-planete.yml
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm apachephptest ./bin/behat
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm planetetest ./bin/behat -c behat-planete.yml
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) stop dbtest apachephptest planetetest mailcatcher

data:
Expand Down
15 changes: 0 additions & 15 deletions htdocs/pages/administration/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@

$formulaire->setDefaults($defaults);

$formulaire->addElement('header' , '' , 'Mails');
$formulaire->addElement('text' , 'mails|email_expediteur' , 'Email expediteur' , array('size' => 30));
$formulaire->addElement('text' , 'mails|nom_expediteur' , 'Nom expediteur' , array('size' => 30));
$formulaire->addElement('textarea', 'mails|texte_adhesion_personne_physique', 'Texte adhesion personne physique', array('cols' => 42, 'rows' => 7));
$formulaire->addElement('text' , 'mails|force_destinataire' , 'Force le destinaire du mail pour test' , array('size' => 30));
$formulaire->addElement('text' , 'mails|bcc' , 'Ajout un email en bcc à tout les emailss' , array('size' => 30));


$formulaire->addElement('header' , '' , 'Config SMTP');
$formulaire->addElement('text' , 'mails|serveur_smtp' , 'Serveur SMTP' , array('size' => 30));
$formulaire->addElement('advcheckbox', 'mails|tls' , 'Use TLS' , null, null, array(0, 1));
$formulaire->addElement('text' , 'mails|port' , 'Port' , array('size' => 30));
$formulaire->addElement('text' , 'mails|username' , 'Username' , array('size' => 30));
$formulaire->addElement('text' , 'mails|password' , 'Password' , array('size' => 30));

$formulaire->addElement('header' , '' , 'AFUP');
$formulaire->addElement('text' , 'afup|raison_sociale', 'Raison Sociale', array('size' => 30));
$formulaire->addElement('textarea', 'afup|adresse' , 'Adresse' , array('cols' => 42, 'rows' => 7));
Expand Down
8 changes: 4 additions & 4 deletions sources/Afup/Bootstrap/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
}

// mise à jour des paramétrages PHP en fonction de la configuration
if ($_ENV['SYMFONY_ENV'] === 'dev') {
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
} else {
if (isset($_ENV['SYMFONY_ENV']) && $_ENV['SYMFONY_ENV'] === 'prod') {
ini_set('error_reporting', E_ALL ^ E_WARNING);
ini_set('display_errors', 0);
} else {
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
}
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(__FILE__).'/../../../dependencies/PEAR/');

Expand Down
35 changes: 15 additions & 20 deletions sources/Afup/Utils/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Afup\Site\Utils;

use Symfony\Component\Yaml\Yaml;

define('EURO', '');

/**
Expand Down Expand Up @@ -37,24 +35,21 @@ public function __construct($chemin_fichier)
$this->_chemin_fichier = $chemin_fichier;
$this->_valeurs = include($this->_chemin_fichier);

$parametersFile = dirname(__FILE__).'/../../../app/config/parameters.yml';
if (is_file($parametersFile)) {
$parameters = Yaml::parseFile($parametersFile)['parameters'];

$this->_valeurs['bdd']['hote'] = $parameters['database_host'];
$this->_valeurs['bdd']['base'] = $parameters['database_name'];
$this->_valeurs['bdd']['utilisateur'] = $parameters['database_user'];
$this->_valeurs['bdd']['mot_de_passe'] = $parameters['database_password'];

$this->_valeurs['mails']['serveur_smtp'] = $parameters['mails_serveur_smtp'];
$this->_valeurs['mails']['tls'] = $parameters['mails_tls'];
$this->_valeurs['mails']['username'] = $parameters['mails_username'];
$this->_valeurs['mails']['password'] = $parameters['mails_password'];
$this->_valeurs['mails']['port'] = $parameters['mails_port'];

$this->_valeurs['mails']['force_destinataire'] = $parameters['mails_force_destinataire'];
$this->_valeurs['mails']['bcc'] = $parameters['mails_bcc'];
}
$kernel = new SymfonyKernel();
$container = $kernel->getKernel()->getContainer();

$this->_valeurs['bdd']['hote'] = $container->getParameter('database_host');
$this->_valeurs['bdd']['base'] = $container->getParameter('database_name');
$this->_valeurs['bdd']['utilisateur'] = $container->getParameter('database_user');
$this->_valeurs['bdd']['mot_de_passe'] = $container->getParameter('database_password');

$this->_valeurs['mails']['serveur_smtp'] = $container->getParameter('mails_serveur_smtp');
$this->_valeurs['mails']['tls'] = $container->getParameter('mails_tls');
$this->_valeurs['mails']['username'] = $container->getParameter('mails_username');
$this->_valeurs['mails']['password'] = $container->getParameter('mails_password');
$this->_valeurs['mails']['port'] = $container->getParameter('mails_port');
$this->_valeurs['mails']['force_destinataire'] = $container->getParameter('mails_force_destinataire');
$this->_valeurs['mails']['bcc'] = $container->getParameter('mails_bcc');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion sources/Afup/Utils/SymfonyKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(Request $request = null)
$env = 'prod';
$debug = false;

if ($_ENV['SYMFONY_ENV'] === 'dev') {
if (isset($_ENV['SYMFONY_ENV']) && $_ENV['SYMFONY_ENV'] === 'dev') {
Debug::enable(E_WARNING);
$debug = true;
$env = 'dev';
Expand Down

0 comments on commit 7316959

Please sign in to comment.