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 12d2a7b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
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
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 12d2a7b

Please sign in to comment.