- [x] [autoloader][phpunit/bootstrap.php] Correction des bugs de $_SERVER avec PHPUnit -> autoloader + bootstrap personnalise

This commit is contained in:
xdrm-brackets 2016-02-12 23:34:52 +01:00
parent f2a9b3e026
commit 9c9f45eced
5 changed files with 19 additions and 6 deletions

View File

@ -1,4 +1,7 @@
<?php define('__ROOT__', dirname(dirname(__FILE__)) ); <?php
// On definit la racine __ROOT__ si c'est pas deja fait
if( !defined('__ROOT__') )
define('__ROOT__', dirname(dirname(__FILE__)) );
@ -40,7 +43,5 @@
/* On demarre la session securisee PHP /* On demarre la session securisee PHP
=========================================================*/ =========================================================*/
// Condition ajoutee pour PHPUNIT \manager\sessionManager::session_start();
if( isset($_SERVER['REMOTE_ADDR']) )
\manager\sessionManager::session_start();
?> ?>

12
phpunit/bootstrap.php Normal file
View File

@ -0,0 +1,12 @@
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
// On definit les constantes inexistantes dans PHPUnit
$_SERVER['HTTP_HOST'] = 'stefproject';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0';
require_once __ROOT__.'/manager/autoloader.php';
?>

View File

@ -1,4 +1,4 @@
<phpunit bootstrap="../manager/autoloader.php"> <phpunit bootstrap="./bootstrap.php">
<testsuites> <testsuites>
<testsuite name="\manager\Database"> <testsuite name="\manager\Database">

View File

@ -15,7 +15,6 @@
\manager\Database::$error = \manager\ManagerError::PDOConnection; \manager\Database::$error = \manager\ManagerError::PDOConnection;
$_SERVER['HTTP_HOST'] = 'stefproject';
$instance = \manager\Database::getInstance(); $instance = \manager\Database::getInstance();
$this->assertEquals( 'localhost', $instance->getConfig()['host'] ); $this->assertEquals( 'localhost', $instance->getConfig()['host'] );

View File

@ -39,6 +39,7 @@
######## ########
# FAIT # # FAIT #
######## ########
- [x] [autoloader][phpunit/bootstrap.php] Correction des bugs de $_SERVER avec PHPUnit -> autoloader + bootstrap personnalise
- [x] [sessionManager] Import de sessionManager - [x] [sessionManager] Import de sessionManager
- [x] [phpunit/tests/Database_*] Tests unitaire de delNumeric() - [x] [phpunit/tests/Database_*] Tests unitaire de delNumeric()
- [x] [Database] Mise a jour des methodes de Database - [x] [Database] Mise a jour des methodes de Database