Update [Database] to [DatabaseDriver] which can handle multiple databases
This commit is contained in:
parent
bb54056069
commit
2ed990fe70
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\core;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \api\core\Authentification;
|
||||
use \error\core\Error;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \api\core\Authentification;
|
||||
use \error\core\Error;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace api\module;
|
||||
use \viewer\core\Viewer;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
|
|
|
@ -1,446 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace database\core;
|
||||
use \error\core\Error;
|
||||
|
||||
|
||||
class Database{
|
||||
|
||||
/* ATTRIBUTS STATIQUES */
|
||||
public static function config_path(){
|
||||
return [
|
||||
'local' => __ROOT__.'/config/database-local.json',
|
||||
'remote' => __ROOT__.'/config/database.json'
|
||||
];
|
||||
}
|
||||
|
||||
private static $pdo;
|
||||
private static $instance;
|
||||
|
||||
|
||||
/* ATTRIBUTS */
|
||||
private $host;
|
||||
private $dbname;
|
||||
private $username;
|
||||
private $password;
|
||||
|
||||
public static $error;
|
||||
|
||||
|
||||
public function __construct($host, $dbname, $username, $password){
|
||||
$this->host = $host;
|
||||
$this->dbname = $dbname;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
|
||||
try{
|
||||
self::$pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
||||
|
||||
// On signale que tout s'est bien passe
|
||||
self::$error = Error::Success;
|
||||
|
||||
}catch(Exception $e){
|
||||
// On signale qu'il y a une erreur
|
||||
self::$error = Error::PDOConnection;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* retourne une instance de la classe */
|
||||
public static function getInstance(){
|
||||
if( self::$instance == null || self::$error != Error::Success ){ // Si aucune instance existante OU erreur de connection
|
||||
|
||||
// chargement de la configuration du server SQL
|
||||
if( !checkdnsrr($_SERVER['SERVER_NAME'], 'NS') )
|
||||
$conf = json_decode( file_get_contents(self::config_path()['local']), true );
|
||||
else
|
||||
$conf = json_decode( file_get_contents(self::config_path()['remote']), true );
|
||||
|
||||
// creation de l'instance en fonction des parametres
|
||||
self::$instance = new DataBase($conf['host'], $conf['dbname'], $conf['user'], $conf['password']);
|
||||
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/* retourne la connection statique */
|
||||
public static function getPDO(){
|
||||
$instance = self::getInstance();
|
||||
|
||||
return self::$pdo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getConfig(){
|
||||
return [
|
||||
'host' => $this->host,
|
||||
'username' => $this->username
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
/* _____ ______ _ _ ______ _____ _ */
|
||||
/* / ____| ____| \ | | ____| __ \ /\ | | */
|
||||
/* | | __| |__ | \| | |__ | |__) | / \ | | */
|
||||
/* | | |_ | __| | . ` | __| | _ / / /\ \ | | */
|
||||
/* | |__| | |____| |\ | |____| | \ \ / ____ \| |____ */
|
||||
/* \_____|______|_| \_|______|_| \_\/_/ \_\______| */
|
||||
/* */
|
||||
/*************************************************************/
|
||||
|
||||
/* SUPPRIME LES VALEURS À CLÉS NUMÉRIQUES DANS UN FETCH D'UNE TABLE DE LA BDD
|
||||
*
|
||||
* @fetchData<Array> le résultat d'une $requeteSQL->fetchAll()
|
||||
* @oneDimension<Boolean> FAUX <=> fetchAll ; VRAI <=> fetch
|
||||
*
|
||||
* @return newFetchData<Array> retourne le tableau donné en paramètre mais sans les valeurs à clés numériques
|
||||
*
|
||||
*/
|
||||
public static function delNumeric($fetchData, $oneDimension=false){
|
||||
// On quitte si ce n'est pas un tableau
|
||||
if( !is_array($fetchData) )
|
||||
return [];
|
||||
|
||||
$nextEquivalent = false; // Vaut VRAI si le prochain est peut-etre un equivalent numerique
|
||||
|
||||
/* [1] 2 dimensions
|
||||
===============================================*/
|
||||
if( !$oneDimension && isset($fetchData[0]) && is_array($fetchData[0]) ){
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour toutes les lignes
|
||||
foreach($fetchData[$i] as $col => $val){ // pour toutes les entrées
|
||||
|
||||
if( !\mb_detect_encoding($val, 'UTF-8') )
|
||||
$fetchData[$i][$col] = utf8_encode($val);
|
||||
|
||||
if( is_int($col) ){ // Si indice numerique
|
||||
if( $nextEquivalent ) // Si suit un indice textuel
|
||||
unset( $fetchData[$i][$col] ); // on supprime l'indice
|
||||
|
||||
$nextEquivalent = false; // Dans tous les cas, on dit que le prochain ne pourra pas etre supprime si numerique
|
||||
|
||||
}else // Si l'indice n'est pas un entier
|
||||
$nextEquivalent = true; // On signale qu'il y aura peut etre un indice numerique suivant
|
||||
|
||||
}
|
||||
|
||||
/* [2] 1 dimensions
|
||||
===============================================*/
|
||||
}else{
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
foreach($fetchData as $i=>$val){ // pour toutes les entrées
|
||||
|
||||
if( !\mb_detect_encoding($val, 'UTF-8') )
|
||||
$fetchData[$i] = utf8_encode($val);
|
||||
|
||||
if( is_int($i) ){ // Si indice numerique
|
||||
if( $nextEquivalent ) // Si suit un indice textuel
|
||||
unset( $fetchData[$i] ); // on supprime l'indice
|
||||
|
||||
$nextEquivalent = false; // Dans tous les cas, on dit que le prochain ne pourra pas etre supprime si numerique
|
||||
|
||||
}else // Si l'indice n'est pas un entier
|
||||
$nextEquivalent = true; // On signale qu'il y aura peut etre un indice numerique suivant
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $fetchData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* GESTION DE L'AUTO-TYPAGE D'UN TABLEAU A UN/PLUSIEURS NIVEAU(X) OU D'UNE VALEUR
|
||||
*
|
||||
* @data<mixed> Tableau de données/Valeur
|
||||
*
|
||||
* @return autoTyped<Array> Tableau/Valeur auto-typé(e)
|
||||
*
|
||||
*/
|
||||
public static function autotype($data){
|
||||
$autotyped = $data;
|
||||
|
||||
/* [0] Gestion des types simples
|
||||
=========================================================*/
|
||||
if( !is_array($autotyped) ){
|
||||
|
||||
/* (1) Si Numérique Entier -> INT */
|
||||
if( preg_match('/^(0|([1-9][0-9]*))$/i', $autotyped) )
|
||||
return intval($autotyped);
|
||||
|
||||
/* (2) Si Numérique Décimal -> FLOAT */
|
||||
else if( preg_match('/^(0|(?:[1-9][0-9]*))[\.\,]([0-9]+)$/i', $autotyped, $m) )
|
||||
return floatval("${m[1]}.${m[2]}");
|
||||
|
||||
/* (3) Sinon on retourne la même chose */
|
||||
else
|
||||
return $autotyped;
|
||||
|
||||
/* [1] Gestion des types composés
|
||||
=========================================================*/
|
||||
}else{
|
||||
|
||||
/* (1) Pour chaque valeur, on applique récursivement */
|
||||
foreach($autotyped as $k=>$v){
|
||||
|
||||
// Si on met '_nomColonne', on ne le traite pas
|
||||
if( is_string($k) && $k[0] == '_' ) continue;
|
||||
|
||||
$autotyped[$k] = self::autotype($v);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [2] On retourne le résultat auto-typé
|
||||
=========================================================*/
|
||||
return $autotyped;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// _ __ _ _ _
|
||||
// __ _____ _ __(_)/ _(_) ___ __ _| |_(_) ___ _ __ ___
|
||||
// \ \ / / _ \ '__| | |_| |/ __/ _` | __| |/ _ \| '_ \/ __|
|
||||
// \ V / __/ | | | _| | (_| (_| | |_| | (_) | | | \__ \
|
||||
// \_/ \___|_| |_|_| |_|\___\__,_|\__|_|\___/|_| |_|___/
|
||||
//
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/* VERIFICATIONS DES TYPES UTILES GENERIQUES
|
||||
*
|
||||
* @type<String> Type que l'on veut verifier
|
||||
* @value<mixed*> Valeur a verifier
|
||||
*
|
||||
* @return match<Boolean> Retourne si oui ou non la valeur @value est du bon type @type
|
||||
*
|
||||
*/
|
||||
public static function check($type, $value){
|
||||
$checker = true;
|
||||
|
||||
/* [0] On verifie que $value n'est pas nul
|
||||
=========================================================*/
|
||||
if( is_null($value) ) return false;
|
||||
|
||||
|
||||
|
||||
/* [1] Si de type VARCHAR(min, max, flags)
|
||||
=========================================================*/
|
||||
if( preg_match('/^varchar\((\d+), ?(\d+)((?:, ?\w+)+)?\)$/', $type, $match) ){
|
||||
// On recupere la taille min
|
||||
$min = (int) $match[1];
|
||||
// On recupere la taille max
|
||||
$max = (int) $match[2];
|
||||
|
||||
// On recupere le sous-type si défini
|
||||
$flags = isset($match[3]) ? explode(',', substr($match[3], 1)) : null;
|
||||
|
||||
// On effectue la verification de taille
|
||||
$lenCheck = $checker && is_string($value) && strlen($value) <= $max && strlen($value) >= $min;
|
||||
|
||||
// On vérifie les FLAGS s'il est donné
|
||||
if( is_array($flags) )
|
||||
foreach( $flags as $flag )
|
||||
$lenCheck = $lenCheck && self::check($flag, $value);
|
||||
|
||||
return $lenCheck;
|
||||
}
|
||||
|
||||
|
||||
/* [2] Si de type ARRAY(type_elements)
|
||||
=========================================================*/
|
||||
if( preg_match('/^array<(.+)>$/', $type, $match) ){
|
||||
|
||||
// Si c'est pas un tableau on retourne une erreur
|
||||
if( !is_array($value) )
|
||||
return false;
|
||||
|
||||
|
||||
$elements_type = $match[1];
|
||||
|
||||
// On verifie le type pour chaque element
|
||||
foreach($value as $element)
|
||||
// Si erreur dans au moins 1 element, on retourne que c'est incorrect
|
||||
if( !self::check($elements_type, trim($element) ) )
|
||||
return false;
|
||||
|
||||
// Si aucune erreur, on retourne que tout est bon
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* [n] Sinon, tous les autres types definis
|
||||
=========================================================*/
|
||||
switch($type){
|
||||
// Quoi que ce soit
|
||||
case 'mixed':
|
||||
return $checker && !is_null($value);
|
||||
break;
|
||||
|
||||
// Entier positif (id dans BDD)
|
||||
case 'id':
|
||||
return $checker && is_numeric($value) && $value <= 2147483647 && $value >= 0;
|
||||
break;
|
||||
|
||||
// Code RFID
|
||||
case 'rfid':
|
||||
return $checker && is_string($value) && preg_match('/^[\dA-F]{2}(\-[\dA-F]{2}){3,5}$/i', $value);
|
||||
break;
|
||||
|
||||
// String quelconque (peut etre vide)
|
||||
case 'text':
|
||||
return $checker && is_string($value);
|
||||
|
||||
// Adresse mail (255 caracteres max)
|
||||
case 'mail':
|
||||
return $checker && is_string($value) && strlen($value) <= 50 && preg_match('/^[\w\.-]+@[\w\.-]+\.[a-z]{2,4}$/i', $value);
|
||||
break;
|
||||
|
||||
// Hash sha1/md5
|
||||
case 'hash':
|
||||
return $checker && is_string($value) && preg_match('/^[\da-f]{40}$/i', $value);
|
||||
break;
|
||||
|
||||
case 'alphanumeric':
|
||||
case 'user.username':
|
||||
case 'group.name':
|
||||
return $checker && is_string($value) && preg_match('/^[\w-]+$/i', $value);
|
||||
break;
|
||||
|
||||
case 'user.firstname':
|
||||
case 'user.lastname':
|
||||
case 'letters':
|
||||
return $checker && is_string($value) && preg_match('/^[a-z -]+$/i', $value);
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
return $checker && is_numeric($value) && floor($value) == $value && $value >= 0 && $value <= 100;
|
||||
break;
|
||||
|
||||
// Tableau non vide
|
||||
case 'array':
|
||||
return $checker && is_array($value) && count($value) > 0;
|
||||
break;
|
||||
|
||||
// Boolean
|
||||
case 'boolean':
|
||||
return $checker && is_bool($value);
|
||||
break;
|
||||
|
||||
// Objet non vide
|
||||
case 'object':
|
||||
return $checker && is_object($value) && count((array) $value) > 0;
|
||||
break;
|
||||
|
||||
// Chaine JSON (on vérifie via le parser)
|
||||
case 'json':
|
||||
return $checker && is_string($value) && json_decode($value, true) !== NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return $checker;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* FONCTION QUI FORMATTE UN NUMÉRO DE TÉLÉPHONE
|
||||
*
|
||||
* @number<String> Numéro de téléphone en +336/336/06/0336/00336
|
||||
*
|
||||
* @return formatted<String> Numéro formatté (06), on FALSE si erreur
|
||||
*
|
||||
*/
|
||||
public static function formatNumber($number){
|
||||
// On met en <string> quel que soit le type
|
||||
$number = (string) $number;
|
||||
|
||||
// On supprime tous les espaces
|
||||
$number = str_replace(' ', '', $number);
|
||||
|
||||
// On formatte le numéro
|
||||
if( preg_match("/^(?:\+33|0?0?33|0)(.+)/", $number, $m) )
|
||||
$number = '0'.$m[1];
|
||||
|
||||
// On retourne le numéro formatté
|
||||
return $number;
|
||||
}
|
||||
|
||||
|
||||
public static function readableNumber($number){
|
||||
/* (1) On formatte le numéro si c'est pas fait */
|
||||
$formatted = self::formatNumber($number);
|
||||
|
||||
for( $i = 1 ; $i < strlen($formatted) ; $i++ )
|
||||
if( ($i-2) % 3 == 0 )
|
||||
$formatted = substr($formatted, 0, $i).' '.substr($formatted, $i);
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
// _ _
|
||||
// __| | __ _| |_ ___ ___
|
||||
// / _` |/ _` | __/ _ \/ __|
|
||||
// | (_| | (_| | || __/\__ \
|
||||
// \__,_|\__,_|\__\___||___/
|
||||
//
|
||||
////////////////////////////////////
|
||||
// 1) Convertis une date en en francais explicite
|
||||
public static function frDate($date){
|
||||
/* [1] On definit les traductions
|
||||
=========================================================*/
|
||||
// Jours de la semaine
|
||||
$days = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"];
|
||||
// Mois de l'annee
|
||||
$months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
|
||||
|
||||
/* [2] On recupere le timestamp et les indices
|
||||
=========================================================*/
|
||||
$time = strtotime($date); // timestamp
|
||||
$daynum = intval( date('N', $time)-1 ); // jour dans la semaine
|
||||
$monthnum = intval( date('n', $time)-1 ); // numero du mois dans l'annee
|
||||
|
||||
|
||||
/* [3] On recupere les infos independemment
|
||||
=========================================================*/
|
||||
$result = [
|
||||
$days[$daynum], // nom de jour
|
||||
date('j', $time), // jour du mois
|
||||
$months[$monthnum], // nom du mois
|
||||
date('Y', $time), // annee
|
||||
];
|
||||
|
||||
|
||||
return implode(" ", $result);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,327 @@
|
|||
<?php
|
||||
|
||||
namespace database\core;
|
||||
use \error\core\Error;
|
||||
|
||||
|
||||
class DataBaseDriver{
|
||||
|
||||
/* STATIC ATTRIBUTES */
|
||||
private static function conf(){
|
||||
// YOUR CONFIGURATION BEHIND
|
||||
$path = __CONFIG__.'/database-driver.json';
|
||||
|
||||
/* (1) Checks the file */
|
||||
if( !is_file($path) )
|
||||
return [];
|
||||
|
||||
/* (2) Checks json */
|
||||
$parsed = json_decode( file_get_contents($path), true );
|
||||
|
||||
if( !is_array($parsed) )
|
||||
return [];
|
||||
|
||||
/* (3) Returns configuration */
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
|
||||
private static $path; // Databases configurations files
|
||||
private static $config; // PDO configurations
|
||||
private static $instance = []; // Database driver instance list
|
||||
|
||||
public $error;
|
||||
|
||||
/* ATTRIBUTES */
|
||||
private $host;
|
||||
private $dbname;
|
||||
private $username;
|
||||
private $password;
|
||||
private $pdo;
|
||||
|
||||
|
||||
|
||||
/* CONSTRUCTOR OF A DATABASE DRIVER
|
||||
*
|
||||
* @host<String> Database Server's host
|
||||
* @dbname<String> Database name
|
||||
* @username<String> Database username
|
||||
* @password<String> Database password
|
||||
*
|
||||
*/
|
||||
private function __construct($host, $dbname, $username, $password){
|
||||
/* (2) Stores configuration */
|
||||
$this->host = $host;
|
||||
$this->dbname = $dbname;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
|
||||
try{
|
||||
|
||||
$this->pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
||||
|
||||
// On signale que tout s'est bien passe
|
||||
$this->error = Error::Success;
|
||||
|
||||
}catch(Exception $e){
|
||||
// On signale qu'il y a une erreur
|
||||
$this->error = Error::PDOConnection;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
**** Multiton Management (static) ****
|
||||
************************************************/
|
||||
|
||||
/* ADDS A NEW CONNECTION
|
||||
*
|
||||
* @label<String> [optional] Database Label
|
||||
*
|
||||
* @return status<Boolean> If added successfully
|
||||
*
|
||||
*/
|
||||
private static function add($label=null){
|
||||
$conf = self::conf();
|
||||
|
||||
/* [1] Default values
|
||||
=========================================================*/
|
||||
/* (1) If label isn't given */
|
||||
is_null($label) && ($label = 'default');
|
||||
|
||||
/* (2) If label and no path */
|
||||
if( $label !== 'default' && !isset($conf[$label]) )
|
||||
return false;
|
||||
|
||||
|
||||
/* [3] Instanciates the driver
|
||||
=========================================================*/
|
||||
try{
|
||||
|
||||
/* (1) If local -> instanciates with local configuration */
|
||||
if( !checkdnsrr($_SERVER['SERVER_NAME'], 'NS') )
|
||||
self::$instance[$label] = new DatabaseDriver($conf[$label]['local']['host'], $conf[$label]['local']['dbname'], $conf[$label]['local']['user'], $conf[$label]['local']['password']);
|
||||
/* (2) If Remote -> instanciates with Remote configuration */
|
||||
else
|
||||
self::$instance[$label] = new DatabaseDriver($conf[$label]['remote']['host'], $conf[$label]['remote']['dbname'], $conf[$label]['remote']['user'], $conf[$label]['remote']['password']);
|
||||
|
||||
return true;
|
||||
|
||||
}catch(\Exception $e){
|
||||
|
||||
/* (3) If fails */
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* GET A DATABASE DRIVER INSTANCE
|
||||
*
|
||||
* @label<String> [optional] Driver's label
|
||||
*
|
||||
* @return driver<Database> Multiton
|
||||
*
|
||||
*/
|
||||
public static function get($label=null){
|
||||
$conf = self::conf();
|
||||
|
||||
/* [1] Checks arguments
|
||||
=========================================================*/
|
||||
/* (1) Label default value */
|
||||
is_null($label) && ($label = 'default');
|
||||
|
||||
/* (2) If no label, or unknown label */
|
||||
if( is_null($label) || !isset(self::$instance[$label]) ){
|
||||
|
||||
/* (2.1) Try to add the configuration if exists */
|
||||
if( isset($conf[$label]) ){
|
||||
self::add($label);
|
||||
return self::get($label);
|
||||
}
|
||||
|
||||
|
||||
throw new \Exception('Database @label is incorrect.');
|
||||
}
|
||||
|
||||
|
||||
/* [2] Returns instance
|
||||
=========================================================*/
|
||||
return self::$instance[$label];
|
||||
}
|
||||
|
||||
|
||||
/* retourne la connection statique */
|
||||
public static function getPDO($label=null){
|
||||
$instance = self::get($label);
|
||||
|
||||
return $instance->pdo;
|
||||
}
|
||||
|
||||
|
||||
public function getConfig(){
|
||||
return [
|
||||
'host' => $this->host,
|
||||
'dbname' => $this->dbname,
|
||||
'username' => $this->username
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
/* _____ ______ _ _ ______ _____ _ */
|
||||
/* / ____| ____| \ | | ____| __ \ /\ | | */
|
||||
/* | | __| |__ | \| | |__ | |__) | / \ | | */
|
||||
/* | | |_ | __| | . ` | __| | _ / / /\ \ | | */
|
||||
/* | |__| | |____| |\ | |____| | \ \ / ____ \| |____ */
|
||||
/* \_____|______|_| \_|______|_| \_\/_/ \_\______| */
|
||||
/* */
|
||||
/*************************************************************/
|
||||
|
||||
/* SUPPRIME LES VALEURS À CLÉS NUMÉRIQUES DANS UN FETCH D'UNE TABLE DE LA BDD
|
||||
*
|
||||
* @fetchData<Array> le résultat d'une $requeteSQL->fetchAll()
|
||||
* @oneDimension<Boolean> FAUX <=> fetchAll ; VRAI <=> fetch
|
||||
*
|
||||
* @return newFetchData<Array> retourne le tableau donné en paramètre mais sans les valeurs à clés numériques
|
||||
*
|
||||
*/
|
||||
public static function delNumeric($fetchData, $oneDimension=false){
|
||||
// On quitte si ce n'est pas un tableau
|
||||
if( !is_array($fetchData) )
|
||||
return [];
|
||||
|
||||
$nextEquivalent = false; // Vaut VRAI si le prochain est peut-etre un equivalent numerique
|
||||
|
||||
/* [1] 2 dimensions
|
||||
===============================================*/
|
||||
if( !$oneDimension && isset($fetchData[0]) && is_array($fetchData[0]) ){
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour tout les utilisateurs
|
||||
foreach($fetchData[$i] as $col => $val){ // pour toutes les entrées
|
||||
|
||||
if( !\mb_detect_encoding($val, 'UTF-8') )
|
||||
$fetchData[$i][$col] = utf8_encode($val);
|
||||
|
||||
if( is_int($col) ){ // Si indice numerique
|
||||
if( $nextEquivalent ) // Si suit un indice textuel
|
||||
unset( $fetchData[$i][$col] ); // on supprime l'indice
|
||||
|
||||
$nextEquivalent = false; // Dans tous les cas, on dit que le prochain ne pourra pas etre supprime si numerique
|
||||
|
||||
}else // Si l'indice n'est pas un entier
|
||||
$nextEquivalent = true; // On signale qu'il y aura peut etre un indice numerique suivant
|
||||
|
||||
}
|
||||
|
||||
/* [2] 1 dimensions
|
||||
===============================================*/
|
||||
}else{
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
foreach($fetchData as $i=>$val){ // pour toutes les entrées
|
||||
|
||||
if( !\mb_detect_encoding($val, 'UTF-8') )
|
||||
$fetchData[$i] = utf8_encode($val);
|
||||
|
||||
if( is_int($i) ){ // Si indice numerique
|
||||
if( $nextEquivalent ) // Si suit un indice textuel
|
||||
unset( $fetchData[$i] ); // on supprime l'indice
|
||||
|
||||
$nextEquivalent = false; // Dans tous les cas, on dit que le prochain ne pourra pas etre supprime si numerique
|
||||
|
||||
}else // Si l'indice n'est pas un entier
|
||||
$nextEquivalent = true; // On signale qu'il y aura peut etre un indice numerique suivant
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $fetchData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* FONCTION QUI FORMATTE UN NUMÉRO DE TÉLÉPHONE
|
||||
*
|
||||
* @number<String> Numéro de téléphone en +336/336/06/0336/00336
|
||||
*
|
||||
* @return formatted<String> Numéro formatté (06), on FALSE si erreur
|
||||
*
|
||||
*/
|
||||
public static function formatNumber($number){
|
||||
// On met en <string> quel que soit le type
|
||||
$number = (string) $number;
|
||||
|
||||
// On supprime tous les espaces
|
||||
$number = str_replace(' ', '', $number);
|
||||
|
||||
// On formatte le numéro
|
||||
if( preg_match("/^(?:\+33|0?0?33|0)(.+)/", $number, $m) )
|
||||
$number = '0'.$m[1];
|
||||
|
||||
// On retourne le numéro formatté
|
||||
return $number;
|
||||
}
|
||||
|
||||
|
||||
public static function readableNumber($number){
|
||||
/* (1) On formatte le numéro si c'est pas fait */
|
||||
$formatted = self::formatNumber($number);
|
||||
|
||||
for( $i = 1 ; $i < strlen($formatted) ; $i++ )
|
||||
if( ($i-2) % 3 == 0 )
|
||||
$formatted = substr($formatted, 0, $i).' '.substr($formatted, $i);
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
// _ _
|
||||
// __| | __ _| |_ ___ ___
|
||||
// / _` |/ _` | __/ _ \/ __|
|
||||
// | (_| | (_| | || __/\__ \
|
||||
// \__,_|\__,_|\__\___||___/
|
||||
//
|
||||
////////////////////////////////////
|
||||
// 1) Convertis une date en en francais explicite
|
||||
public static function frDate($date){
|
||||
/* [1] On definit les traductions
|
||||
=========================================================*/
|
||||
// Jours de la semaine
|
||||
$days = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"];
|
||||
// Mois de l'annee
|
||||
$months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
|
||||
|
||||
/* [2] On recupere le timestamp et les indices
|
||||
=========================================================*/
|
||||
$time = strtotime($date); // timestamp
|
||||
$daynum = intval( date('N', $time)-1 ); // jour dans la semaine
|
||||
$monthnum = intval( date('n', $time)-1 ); // numero du mois dans l'annee
|
||||
|
||||
|
||||
/* [3] On recupere les infos independemment
|
||||
=========================================================*/
|
||||
$result = [
|
||||
$days[$daynum], // nom de jour
|
||||
date('j', $time), // jour du mois
|
||||
$months[$monthnum], // nom du mois
|
||||
date('Y', $time), // annee
|
||||
];
|
||||
|
||||
|
||||
return implode(" ", $result);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Table;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Table;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \orm\core\Table;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
|
||||
class parentRepo{
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
|||
|
||||
/* [2] On charge la liste des colonnes de la table
|
||||
=========================================================*/
|
||||
$getColumns = Database::getPDO()->query('SHOW COLUMNS FROM '.static::table_name());
|
||||
$cols = Database::delNumeric( $getColumns->fetchAll() );
|
||||
$getColumns = DatabaseDriver::getPDO()->query('SHOW COLUMNS FROM '.static::table_name());
|
||||
$cols = DatabaseDriver::delNumeric( $getColumns->fetchAll() );
|
||||
|
||||
$table_columns = [
|
||||
'_PRIMARY_' => [] // Contiendra les champs de la clé primaire
|
||||
|
@ -95,7 +95,7 @@
|
|||
$getRequestString .= ' ORDER BY 1 ASC';
|
||||
|
||||
// On prépare la requête
|
||||
$getRequest = Database::getPDO()->prepare($getRequestString);
|
||||
$getRequest = DatabaseDriver::getPDO()->prepare($getRequestString);
|
||||
|
||||
|
||||
/* [5] On exécute la requête
|
||||
|
@ -128,12 +128,12 @@
|
|||
|
||||
// Si résultat
|
||||
else
|
||||
return Database::delNumeric($result, true);
|
||||
return DatabaseDriver::delNumeric($result, true);
|
||||
|
||||
|
||||
/* (2) Réponse multiple (getAll, ...) */
|
||||
}else
|
||||
return Database::delNumeric( $getRequest->fetchAll() );
|
||||
return DatabaseDriver::delNumeric( $getRequest->fetchAll() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
public static function getForChip($id_chip){
|
||||
|
||||
$req = Database::getPDO()->prepare("SELECT s.state, pm.id_chip, GROUP_CONCAT(s.value ORDER BY pm.pin ASC) as pin_values
|
||||
$req = DatabaseDriver::getPDO()->prepare("SELECT s.state, pm.id_chip, GROUP_CONCAT(s.value ORDER BY pm.pin ASC) as pin_values
|
||||
FROM state as s, pin_merge as pm
|
||||
WHERE s.id_pin_merge = pm.id_pin_merge
|
||||
AND pm.id_chip = :id_chip
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
public static function search($id_warehouse, $keyword){
|
||||
// On recupere les donnees
|
||||
$searchusers = Database::getPDO()->prepare("SELECT * FROM user
|
||||
$searchusers = DatabaseDriver::getPDO()->prepare("SELECT * FROM user
|
||||
WHERE id_warehouse = :id_warehouse
|
||||
AND ( code LIKE '%".$keyword."%'
|
||||
OR username LIKE '%".$keyword."%'
|
||||
|
@ -81,7 +81,7 @@
|
|||
':id_warehouse' => $id_warehouse
|
||||
]);
|
||||
|
||||
return Database::delNumeric( $searchusers->fetchAll() );
|
||||
return DatabaseDriver::delNumeric( $searchusers->fetchAll() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \orm\core\Table;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \orm\core\SQLBuilder;
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
|||
const INSERT_DEFAULT = '__DEFAULT__'; // Valeur DEFAULT (pour insertion)
|
||||
|
||||
/* Attributs */
|
||||
private $driver; // Database driver label
|
||||
private $where; // Tableau associatif contenant les conditions
|
||||
private $select; // Tableau contenant la liste des champs à afficher
|
||||
private $orderby; // Tableau contenant la liste des orderby
|
||||
|
@ -50,31 +51,33 @@
|
|||
/* CONSTRUCTEUR
|
||||
*
|
||||
* @schema<Array> Tableau contenant les informations de la requête
|
||||
* @driver<String> [optional] DatabaseDriver label
|
||||
*
|
||||
*/
|
||||
public function __construct($schema){
|
||||
/* (1) On récupère les informations */
|
||||
public function __construct($schema, $driver=null){
|
||||
/* (1) Database Driver */
|
||||
$this->driver = $driver;
|
||||
|
||||
/* (2) On récupère les informations */
|
||||
$this->schema = $schema;
|
||||
|
||||
/* (2) On initialise les conditions */
|
||||
/* (3) On initialise les conditions */
|
||||
$this->where = [];
|
||||
|
||||
/* (3) On initialise les champs à retourner */
|
||||
/* (4) On initialise les champs à retourner */
|
||||
$this->select = [];
|
||||
|
||||
/* (4) On initialise l'ordonnancement' */
|
||||
/* (5) On initialise l'ordonnancement' */
|
||||
$this->orderby = [];
|
||||
|
||||
/* (5) On initialise le caractère 'unique' du résultat */
|
||||
/* (6) On initialise le caractère 'unique' du résultat */
|
||||
$this->unique = false;
|
||||
|
||||
/* (6) On initialise les jointures */
|
||||
/* (7) On initialise les jointures */
|
||||
$this->joined = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* FILTRE LES ENTREES D'UNE TABLE AVEC LA CLE PRIMAIRE SPECIFIEE
|
||||
*
|
||||
* @primary<mixed> Clé primaire simple
|
||||
|
@ -164,10 +167,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* FILTRAGE DYNAMIQUES
|
||||
*
|
||||
* @method<String> Nom de la méthode
|
||||
|
@ -244,9 +243,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SELECTIONNE UNIQUEMENT LE CHAMP SELECTIONNE
|
||||
*
|
||||
* @field<String> Libellé du champ à afficher
|
||||
|
@ -280,9 +276,19 @@
|
|||
|
||||
/* [2] On enregistre le champ
|
||||
=========================================================*/
|
||||
/* (1) Si aucun SELECT pour ce champ, on le crée */
|
||||
/* (1) Si "SELECT *" on ajout tous les champs */
|
||||
if( $field === '*' ){
|
||||
|
||||
foreach($this->schema['columns'] as $f=>$c)
|
||||
if( !isset($this->select[$f]) )
|
||||
$this->select[$f] = [$func, $distinct];
|
||||
|
||||
/* (2) Si aucun SELECT pour ce champ, on le crée */
|
||||
}else{
|
||||
|
||||
if( !isset($this->select[$field]) )
|
||||
$this->select[$field] = [$func, $distinct];
|
||||
}
|
||||
|
||||
|
||||
/* [3] On retourne l'object courant
|
||||
|
@ -291,9 +297,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SELECTIONNE L'ORDONNANCEMENT DES RESULTATS
|
||||
*
|
||||
* @field<String> Libellé du champ à afficher
|
||||
|
@ -336,11 +339,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* JOINT UNE SECONDE TABLE ()
|
||||
*
|
||||
* @localField<String> Nom d'une colonne locale
|
||||
|
@ -420,11 +418,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* PERMET DE DIRE QUE L'ON VEUT UN RESULTAT UNIQUE
|
||||
*
|
||||
* @return this<Rows> Retourne l'object courant
|
||||
|
@ -442,11 +435,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* MODIFIE DES ENTREES (SANS MODIFICATION DE CLE PRIMAIRE POSSIBLE)
|
||||
*
|
||||
* @updates<Array> Tableau associatif contenant les nouvelles valeurs
|
||||
|
@ -562,7 +550,7 @@
|
|||
$requestString = SQLBuilder::BUILD($requestS).';';
|
||||
|
||||
/* (2) On prépare la requête */
|
||||
$request = Database::getPDO()->prepare($requestString);
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestString);
|
||||
|
||||
|
||||
|
||||
|
@ -575,10 +563,6 @@
|
|||
return $updated;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* AJOUTE UNE ENTREE DANS LA TABLE
|
||||
*
|
||||
* @entry<Array> Tableau associatif de la forme (colonne => valeur)
|
||||
|
@ -687,7 +671,7 @@
|
|||
/* [2] On bind les paramètres et exécute la requête
|
||||
=========================================================*/
|
||||
/* (0) On initialise la requête et les paramètres */
|
||||
$request = Database::getPDO()->prepare($requestS.';');
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestS.';');
|
||||
$bound = [];
|
||||
|
||||
/* (1) On bind les paramètres */
|
||||
|
@ -706,8 +690,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* SUPPRIME LES ENTREES
|
||||
*
|
||||
* @return status<Boolean> Retourne si TRUE ou FALSE les entrées ont bien été supprimées
|
||||
|
@ -779,7 +761,7 @@
|
|||
$requestString = SQLBuilder::BUILD($requestS).';';
|
||||
|
||||
/* (2) On prépare la requête */
|
||||
$request = Database::getPDO()->prepare($requestString);
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestString);
|
||||
|
||||
/* [5] On exécute la requête et retourne le résultat
|
||||
=========================================================*/
|
||||
|
@ -791,10 +773,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE LES DONNEES / NULL si une erreur survient
|
||||
*
|
||||
* @execute<Boolean> VRAI si on veut exécuter la requête, sinon renvoie [requete, boundParams]
|
||||
|
@ -959,7 +937,7 @@
|
|||
$requestString = SQLBuilder::BUILD($requestS).';';
|
||||
|
||||
/* (3) On prépare la requête */
|
||||
$request = Database::getPDO()->prepare($requestString);
|
||||
$request = DatabaseDriver::getPDO($this->driver)->prepare($requestString);
|
||||
// var_dump($requestString);
|
||||
|
||||
|
||||
|
@ -977,10 +955,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ON FORMATTE LES DONNEES DE SORTIE
|
||||
*
|
||||
* @data<Array> Données / Tableau de données
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
@ -11,21 +11,20 @@
|
|||
// CLASSE MAITRE
|
||||
class Table{
|
||||
|
||||
private static $database = 'logauth';
|
||||
|
||||
|
||||
/* RENVOIE LES DONNEES D'UNE TABLE
|
||||
*
|
||||
* @table<String> Nom de la table à selectionner
|
||||
* @driver<String> [optional] DatabaseDriver label
|
||||
*
|
||||
* @return this<ORM> Retourne une instance de l'ORM
|
||||
*
|
||||
*/
|
||||
public static function get($table_name){
|
||||
public static function get($table_name, $driver=null){
|
||||
/* [0] Initialisation des attributs
|
||||
=========================================================*/
|
||||
$schema = [
|
||||
'database' => self::$database,
|
||||
'database' => DatabaseDriver::get($driver)->getConfig()['dbname'],
|
||||
'table' => null,
|
||||
'columns' => null
|
||||
];
|
||||
|
@ -34,13 +33,13 @@
|
|||
/* [1] On vérifie que la table existe
|
||||
=========================================================*/
|
||||
/* (1) Requête */
|
||||
$checkTable = Database::getPDO()->query("SHOW tables FROM ".self::$database);
|
||||
$checkTableResult = Database::delNumeric( $checkTable->fetchAll() );
|
||||
$checkTable = DatabaseDriver::getPDO($driver)->query("SHOW tables FROM ".$schema['database']);
|
||||
$checkTableResult = DatabaseDriver::delNumeric( $checkTable->fetchAll() );
|
||||
|
||||
/* (2) On met en forme les données */
|
||||
$tables = [];
|
||||
foreach($checkTableResult as $table)
|
||||
$tables[] = $table['Tables_in_'.self::$database];
|
||||
$tables[] = $table['Tables_in_'.$schema['database']];
|
||||
|
||||
/* (3) Si n'existe pas, on renvoie une erreur */
|
||||
if( !in_array($table_name, $tables) )
|
||||
|
@ -54,8 +53,8 @@
|
|||
/* [2] Si la table existe, on récupère les colonnes
|
||||
=========================================================*/
|
||||
/* (1) On récupère les colonnes */
|
||||
$getColumns = Database::getPDO()->query("SHOW columns FROM ".self::$database.'.'.$table_name);
|
||||
$columnsResult = Database::delNumeric( $getColumns->fetchAll() );
|
||||
$getColumns = DatabaseDriver::getPDO($driver)->query("SHOW columns FROM ".$schema['database'].'.'.$table_name);
|
||||
$columnsResult = DatabaseDriver::delNumeric( $getColumns->fetchAll() );
|
||||
|
||||
/* (2) On met en forme les données */
|
||||
$columns = [];
|
||||
|
@ -85,7 +84,7 @@
|
|||
/* [3] On récupère les clés étrangères
|
||||
=========================================================*/
|
||||
/* (1) On récupère le texte du 'CREATE TABLE' */
|
||||
$getCreateTable = Database::getPDO()->query("show create table ".$table_name);
|
||||
$getCreateTable = DatabaseDriver::getPDO($driver)->query("show create table ".$table_name);
|
||||
$create_table = $getCreateTable->fetch()['Create Table'];
|
||||
|
||||
/* (2) On découpte en lignes */
|
||||
|
@ -97,10 +96,9 @@
|
|||
$schema['columns'][$m[1]]['references'] = [$m[2], $m[3]];
|
||||
|
||||
|
||||
|
||||
/* [3] On renvoie une instance de 'Rows'
|
||||
=========================================================*/
|
||||
return new Rows($schema);
|
||||
return new Rows($schema, $driver);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"default": {
|
||||
"local": {
|
||||
"host" : "localhost",
|
||||
"dbname" : "logauth",
|
||||
"user" : "php",
|
||||
"password" : "Qt358nUdyeTxLDM8"
|
||||
},
|
||||
"remote": {
|
||||
"host" : "xdrm.io",
|
||||
"dbname" : "logauth",
|
||||
"user" : "php",
|
||||
"password" : "QbzjZACndQM6NmuD"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"host" : "localhost",
|
||||
"dbname" : "logauth",
|
||||
"user" : "php",
|
||||
"password" : "Qt358nUdyeTxLDM8"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"host" : "xdrm.io",
|
||||
"dbname" : "logauth",
|
||||
"user" : "php",
|
||||
"password" : "QbzjZACndQM6NmuD"
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -223,42 +223,42 @@
|
|||
<tr><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"> *</td></tr>
|
||||
<tr><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"> */</td></tr>
|
||||
<tr><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"> public function __construct($url, $view=false){</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 31" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"> $this->error = Error::Success;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 31" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"> $this->error = Error::Success;</td></tr>
|
||||
<tr><td><div align="right"><a name="32"></a><a href="#32">32</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="33"></a><a href="#33">33</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="34"></a><a href="#34">34</a></div></td><td class="codeLine"> /* [0] On met a jour la configuration</td></tr>
|
||||
<tr><td><div align="right"><a name="35"></a><a href="#35">35</a></div></td><td class="codeLine"> =====================================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="36"></a><a href="#36">36</a></div></td><td class="codeLine"> // Extensions supportees</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 37" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="37"></a><a href="#37">37</a></div></td><td class="codeLine"> $extensions_conf = json_decode( file_get_contents(__ROOT__.self::$extension_config_path), true );</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 37" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="37"></a><a href="#37">37</a></div></td><td class="codeLine"> $extensions_conf = json_decode( file_get_contents(__ROOT__.self::$extension_config_path), true );</td></tr>
|
||||
<tr><td><div align="right"><a name="38"></a><a href="#38">38</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="39"></a><a href="#39">39</a></div></td><td class="codeLine"> // Gestion de l'erreur de parsage</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 40" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="40"></a><a href="#40">40</a></div></td><td class="codeLine"> if( $extensions_conf == null ){</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 40" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="40"></a><a href="#40">40</a></div></td><td class="codeLine"> if( $extensions_conf == null ){</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="41"></a><a href="#41">41</a></div></td><td class="codeLine"> $this->error = Error::ParsingFailed;</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="42"></a><a href="#42">42</a></div></td><td class="codeLine"> return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="43"></a><a href="#43">43</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="44"></a><a href="#44">44</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 45" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="45"></a><a href="#45">45</a></div></td><td class="codeLine"> self::$supported_extensions = $extensions_conf;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 45" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="45"></a><a href="#45">45</a></div></td><td class="codeLine"> self::$supported_extensions = $extensions_conf;</td></tr>
|
||||
<tr><td><div align="right"><a name="46"></a><a href="#46">46</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="47"></a><a href="#47">47</a></div></td><td class="codeLine"> // Dossiers supportes</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 48" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="48"></a><a href="#48">48</a></div></td><td class="codeLine"> $parents_conf = json_decode( file_get_contents(__ROOT__.self::$parents_config_path), true );</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 48" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="48"></a><a href="#48">48</a></div></td><td class="codeLine"> $parents_conf = json_decode( file_get_contents(__ROOT__.self::$parents_config_path), true );</td></tr>
|
||||
<tr><td><div align="right"><a name="49"></a><a href="#49">49</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="50"></a><a href="#50">50</a></div></td><td class="codeLine"> // Gestion de l'erreur de parsage</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 51" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="51"></a><a href="#51">51</a></div></td><td class="codeLine"> if( $parents_conf == null ){</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 51" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="51"></a><a href="#51">51</a></div></td><td class="codeLine"> if( $parents_conf == null ){</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="52"></a><a href="#52">52</a></div></td><td class="codeLine"> $this->error = Error::ParsingFailed;</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="53"></a><a href="#53">53</a></div></td><td class="codeLine"> return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="54"></a><a href="#54">54</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="55"></a><a href="#55">55</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 56" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="56"></a><a href="#56">56</a></div></td><td class="codeLine"> self::$supported_parents = $parents_conf;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 56" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="56"></a><a href="#56">56</a></div></td><td class="codeLine"> self::$supported_parents = $parents_conf;</td></tr>
|
||||
<tr><td><div align="right"><a name="57"></a><a href="#57">57</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="58"></a><a href="#58">58</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="59"></a><a href="#59">59</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="60"></a><a href="#60">60</a></div></td><td class="codeLine"> /* [1] On recupere les donnees de l'URL</td></tr>
|
||||
<tr><td><div align="right"><a name="61"></a><a href="#61">61</a></div></td><td class="codeLine"> ==================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 62" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="62"></a><a href="#62">62</a></div></td><td class="codeLine"> $serialFlags = array_slice( explode('/',$url), 1 );</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 62" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="62"></a><a href="#62">62</a></div></td><td class="codeLine"> $serialFlags = array_slice( explode('/',$url), 1 );</td></tr>
|
||||
<tr><td><div align="right"><a name="63"></a><a href="#63">63</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="64"></a><a href="#64">64</a></div></td><td class="codeLine"> /* [2] On check/cree les drapeaux avec ces donnees</td></tr>
|
||||
<tr><td><div align="right"><a name="65"></a><a href="#65">65</a></div></td><td class="codeLine"> ==================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 66" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="66"></a><a href="#66">66</a></div></td><td class="codeLine"> if( !$this->createFlags($serialFlags) ){ // Creation des drapeaux</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 66" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="66"></a><a href="#66">66</a></div></td><td class="codeLine"> if( !$this->createFlags($serialFlags) ){ // Creation des drapeaux</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="67"></a><a href="#67">67</a></div></td><td class="codeLine"> $this->error = Error::InvalidFlags;</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="68"></a><a href="#68">68</a></div></td><td class="codeLine"> return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="69"></a><a href="#69">69</a></div></td><td class="codeLine"> }</td></tr>
|
||||
|
@ -266,7 +266,7 @@
|
|||
<tr><td><div align="right"><a name="71"></a><a href="#71">71</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="72"></a><a href="#72">72</a></div></td><td class="codeLine"> /* [3] On construit le chemin a partir des tags</td></tr>
|
||||
<tr><td><div align="right"><a name="73"></a><a href="#73">73</a></div></td><td class="codeLine"> ==================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 74" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="74"></a><a href="#74">74</a></div></td><td class="codeLine"> if( !$this->buildPath() ){ // Construction du chemin</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 74" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="74"></a><a href="#74">74</a></div></td><td class="codeLine"> if( !$this->buildPath() ){ // Construction du chemin</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="75"></a><a href="#75">75</a></div></td><td class="codeLine"> $this->error = Error::UnreachableResource;</td></tr>
|
||||
<tr class="danger"><td><div align="right"><a name="76"></a><a href="#76">76</a></div></td><td class="codeLine"> return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="77"></a><a href="#77">77</a></div></td><td class="codeLine"> }</td></tr>
|
||||
|
@ -274,10 +274,10 @@
|
|||
<tr><td><div align="right"><a name="79"></a><a href="#79">79</a></div></td><td class="codeLine"> /* [4] On gere l'affichage pour l'appel externe/interne</td></tr>
|
||||
<tr><td><div align="right"><a name="80"></a><a href="#80">80</a></div></td><td class="codeLine"> ==================================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="81"></a><a href="#81">81</a></div></td><td class="codeLine"> if( $view ) // Appel externe</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 82" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="82"></a><a href="#82">82</a></div></td><td class="codeLine"> $this->view();</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 82" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="82"></a><a href="#82">82</a></div></td><td class="codeLine"> $this->view();</td></tr>
|
||||
<tr><td><div align="right"><a name="83"></a><a href="#83">83</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="84"></a><a href="#84">84</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 85" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="85"></a><a href="#85">85</a></div></td><td class="codeLine"> return true;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 85" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="85"></a><a href="#85">85</a></div></td><td class="codeLine"> return true;</td></tr>
|
||||
<tr><td><div align="right"><a name="86"></a><a href="#86">86</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="87"></a><a href="#87">87</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="88"></a><a href="#88">88</a></div></td><td class="codeLine"></td></tr>
|
||||
|
@ -290,8 +290,8 @@
|
|||
<tr><td><div align="right"><a name="95"></a><a href="#95">95</a></div></td><td class="codeLine"> *</td></tr>
|
||||
<tr><td><div align="right"><a name="96"></a><a href="#96">96</a></div></td><td class="codeLine"> */</td></tr>
|
||||
<tr><td><div align="right"><a name="97"></a><a href="#97">97</a></div></td><td class="codeLine"> public static function getResource($route){</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 98" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="98"></a><a href="#98">98</a></div></td><td class="codeLine"> $instance = new ResourceDispatcher($route);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 99" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="99"></a><a href="#99">99</a></div></td><td class="codeLine"> return $instance->getContent();</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 98" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="98"></a><a href="#98">98</a></div></td><td class="codeLine"> $instance = new ResourceDispatcher($route);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 99" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="99"></a><a href="#99">99</a></div></td><td class="codeLine"> return $instance->getContent();</td></tr>
|
||||
<tr><td><div align="right"><a name="100"></a><a href="#100">100</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="101"></a><a href="#101">101</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="102"></a><a href="#102">102</a></div></td><td class="codeLine"></td></tr>
|
||||
|
@ -307,46 +307,46 @@
|
|||
<tr><td><div align="right"><a name="112"></a><a href="#112">112</a></div></td><td class="codeLine"> /* [1] Verification des flags (version serialisee)</td></tr>
|
||||
<tr><td><div align="right"><a name="113"></a><a href="#113">113</a></div></td><td class="codeLine"> ======================================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="114"></a><a href="#114">114</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 115" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="115"></a><a href="#115">115</a></div></td><td class="codeLine"> $correct = true;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 115" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="115"></a><a href="#115">115</a></div></td><td class="codeLine"> $correct = true;</td></tr>
|
||||
<tr><td><div align="right"><a name="116"></a><a href="#116">116</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="117"></a><a href="#117">117</a></div></td><td class="codeLine"> // Verification du nombre de drapeaux () au moins 3</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 118" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="118"></a><a href="#118">118</a></div></td><td class="codeLine"> $correct = $correct && count($serialFlags) >= 3;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 118" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="118"></a><a href="#118">118</a></div></td><td class="codeLine"> $correct = $correct && count($serialFlags) >= 3;</td></tr>
|
||||
<tr><td><div align="right"><a name="119"></a><a href="#119">119</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="120"></a><a href="#120">120</a></div></td><td class="codeLine"> // Verification que l'extension est correcte</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 121" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="121"></a><a href="#121">121</a></div></td><td class="codeLine"> $correct = $correct && array_key_exists($serialFlags[0], self::$supported_extensions);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 121" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="121"></a><a href="#121">121</a></div></td><td class="codeLine"> $correct = $correct && array_key_exists($serialFlags[0], self::$supported_extensions);</td></tr>
|
||||
<tr><td><div align="right"><a name="122"></a><a href="#122">122</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="123"></a><a href="#123">123</a></div></td><td class="codeLine"> // Verification du filename</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 124" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="124"></a><a href="#124">124</a></div></td><td class="codeLine"> $correct = $correct && preg_match('#^[\w_-]+$#i', $serialFlags[1]);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 124" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="124"></a><a href="#124">124</a></div></td><td class="codeLine"> $correct = $correct && preg_match('#^[\w_-]+$#i', $serialFlags[1]);</td></tr>
|
||||
<tr><td><div align="right"><a name="125"></a><a href="#125">125</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="126"></a><a href="#126">126</a></div></td><td class="codeLine"> // Verification du parent</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 127" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="127"></a><a href="#127">127</a></div></td><td class="codeLine"> $correct = $correct && array_key_exists($serialFlags[2], self::$supported_parents);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 127" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="127"></a><a href="#127">127</a></div></td><td class="codeLine"> $correct = $correct && array_key_exists($serialFlags[2], self::$supported_parents);</td></tr>
|
||||
<tr><td><div align="right"><a name="128"></a><a href="#128">128</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="129"></a><a href="#129">129</a></div></td><td class="codeLine"> // Verification du sous-parent (optionnel)</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 130" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="130"></a><a href="#130">130</a></div></td><td class="codeLine"> $opt_subParent = count($serialFlags) >= 4;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 130" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="130"></a><a href="#130">130</a></div></td><td class="codeLine"> $opt_subParent = count($serialFlags) >= 4;</td></tr>
|
||||
<tr><td><div align="right"><a name="131"></a><a href="#131">131</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="132"></a><a href="#132">132</a></div></td><td class="codeLine"> if( $opt_subParent )</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 133" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="133"></a><a href="#133">133</a></div></td><td class="codeLine"> $correct = $correct && preg_match('#^[\w_-]+$#i', $serialFlags[3]);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 133" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="133"></a><a href="#133">133</a></div></td><td class="codeLine"> $correct = $correct && preg_match('#^[\w_-]+$#i', $serialFlags[3]);</td></tr>
|
||||
<tr><td><div align="right"><a name="134"></a><a href="#134">134</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="135"></a><a href="#135">135</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 136" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="136"></a><a href="#136">136</a></div></td><td class="codeLine"> if( !$correct )</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 137" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="137"></a><a href="#137">137</a></div></td><td class="codeLine"> return false;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 136" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="136"></a><a href="#136">136</a></div></td><td class="codeLine"> if( !$correct )</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 137" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="137"></a><a href="#137">137</a></div></td><td class="codeLine"> return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="138"></a><a href="#138">138</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="139"></a><a href="#139">139</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="140"></a><a href="#140">140</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="141"></a><a href="#141">141</a></div></td><td class="codeLine"> /* [2] Creation (non serialisee) des flags</td></tr>
|
||||
<tr><td><div align="right"><a name="142"></a><a href="#142">142</a></div></td><td class="codeLine"> ======================================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="143"></a><a href="#143">143</a></div></td><td class="codeLine"> // Si tout se deroule bien, on cree les flags</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 144" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="144"></a><a href="#144">144</a></div></td><td class="codeLine"> $this->flags = array(</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 145" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="145"></a><a href="#145">145</a></div></td><td class="codeLine"> 'extension' => $serialFlags[0],</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 146" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="146"></a><a href="#146">146</a></div></td><td class="codeLine"> 'filename' => $serialFlags[1],</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 147" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="147"></a><a href="#147">147</a></div></td><td class="codeLine"> 'parent' => $serialFlags[2]</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 148" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="148"></a><a href="#148">148</a></div></td><td class="codeLine"> );</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 144" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="144"></a><a href="#144">144</a></div></td><td class="codeLine"> $this->flags = array(</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 145" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="145"></a><a href="#145">145</a></div></td><td class="codeLine"> 'extension' => $serialFlags[0],</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 146" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="146"></a><a href="#146">146</a></div></td><td class="codeLine"> 'filename' => $serialFlags[1],</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 147" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="147"></a><a href="#147">147</a></div></td><td class="codeLine"> 'parent' => $serialFlags[2]</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 148" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="148"></a><a href="#148">148</a></div></td><td class="codeLine"> );</td></tr>
|
||||
<tr><td><div align="right"><a name="149"></a><a href="#149">149</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="150"></a><a href="#150">150</a></div></td><td class="codeLine"> // Ajout du sous-parent optionnel</td></tr>
|
||||
<tr><td><div align="right"><a name="151"></a><a href="#151">151</a></div></td><td class="codeLine"> if( $opt_subParent )</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 152" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="152"></a><a href="#152">152</a></div></td><td class="codeLine"> $this->flags['subparent'] = $serialFlags[3];</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 152" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="152"></a><a href="#152">152</a></div></td><td class="codeLine"> $this->flags['subparent'] = $serialFlags[3];</td></tr>
|
||||
<tr><td><div align="right"><a name="153"></a><a href="#153">153</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 154" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="154"></a><a href="#154">154</a></div></td><td class="codeLine"> return true;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 154" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="154"></a><a href="#154">154</a></div></td><td class="codeLine"> return true;</td></tr>
|
||||
<tr><td><div align="right"><a name="155"></a><a href="#155">155</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="156"></a><a href="#156">156</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="157"></a><a href="#157">157</a></div></td><td class="codeLine"> }</td></tr>
|
||||
|
@ -365,10 +365,10 @@
|
|||
<tr><td><div align="right"><a name="170"></a><a href="#170">170</a></div></td><td class="codeLine"> /* [1] On recupere le HEADER associe a l'extension</td></tr>
|
||||
<tr><td><div align="right"><a name="171"></a><a href="#171">171</a></div></td><td class="codeLine"> ==========================================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="172"></a><a href="#172">172</a></div></td><td class="codeLine"> // Si aucun header pour cet cle, on retourne une erreur</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 173" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="173"></a><a href="#173">173</a></div></td><td class="codeLine"> if( !isset(self::$supported_extensions[$this->flags['extension']]) ) return false;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 173" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="173"></a><a href="#173">173</a></div></td><td class="codeLine"> if( !isset(self::$supported_extensions[$this->flags['extension']]) ) return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="174"></a><a href="#174">174</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="175"></a><a href="#175">175</a></div></td><td class="codeLine"> // On recupere le header associe</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 176" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="176"></a><a href="#176">176</a></div></td><td class="codeLine"> $header = self::$supported_extensions[$this->flags['extension']];</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 176" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="176"></a><a href="#176">176</a></div></td><td class="codeLine"> $header = self::$supported_extensions[$this->flags['extension']];</td></tr>
|
||||
<tr><td><div align="right"><a name="177"></a><a href="#177">177</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="178"></a><a href="#178">178</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="179"></a><a href="#179">179</a></div></td><td class="codeLine"></td></tr>
|
||||
|
@ -377,28 +377,28 @@
|
|||
<tr><td><div align="right"><a name="182"></a><a href="#182">182</a></div></td><td class="codeLine"> /* [2] On recupere le chemin associe au parent</td></tr>
|
||||
<tr><td><div align="right"><a name="183"></a><a href="#183">183</a></div></td><td class="codeLine"> ==========================================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="184"></a><a href="#184">184</a></div></td><td class="codeLine"> // Si aucun dossier pour cet indice, on retourne une erreur</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 185" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="185"></a><a href="#185">185</a></div></td><td class="codeLine"> if( !isset(self::$supported_parents[$this->flags['parent']]) ) return false;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 185" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="185"></a><a href="#185">185</a></div></td><td class="codeLine"> if( !isset(self::$supported_parents[$this->flags['parent']]) ) return false;</td></tr>
|
||||
<tr><td><div align="right"><a name="186"></a><a href="#186">186</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="187"></a><a href="#187">187</a></div></td><td class="codeLine"> // On recupere le dossier associe</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 188" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="188"></a><a href="#188">188</a></div></td><td class="codeLine"> $parent = self::$supported_parents[$this->flags['parent']];</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 188" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="188"></a><a href="#188">188</a></div></td><td class="codeLine"> $parent = self::$supported_parents[$this->flags['parent']];</td></tr>
|
||||
<tr><td><div align="right"><a name="189"></a><a href="#189">189</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="190"></a><a href="#190">190</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="191"></a><a href="#191">191</a></div></td><td class="codeLine"> /* [3] Gestion du sous-parent optionnel</td></tr>
|
||||
<tr><td><div align="right"><a name="192"></a><a href="#192">192</a></div></td><td class="codeLine"> ==========================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 193" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="193"></a><a href="#193">193</a></div></td><td class="codeLine"> $opt_subParent = (isset($this->flags['subparent'])) ? $this->flags['subparent'].'/' : '';</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 193" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="193"></a><a href="#193">193</a></div></td><td class="codeLine"> $opt_subParent = (isset($this->flags['subparent'])) ? $this->flags['subparent'].'/' : '';</td></tr>
|
||||
<tr><td><div align="right"><a name="194"></a><a href="#194">194</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="195"></a><a href="#195">195</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="196"></a><a href="#196">196</a></div></td><td class="codeLine"> /* [4] On definit le header</td></tr>
|
||||
<tr><td><div align="right"><a name="197"></a><a href="#197">197</a></div></td><td class="codeLine"> ==========================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 198" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="198"></a><a href="#198">198</a></div></td><td class="codeLine"> $this->header = $header;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 198" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="198"></a><a href="#198">198</a></div></td><td class="codeLine"> $this->header = $header;</td></tr>
|
||||
<tr><td><div align="right"><a name="199"></a><a href="#199">199</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="200"></a><a href="#200">200</a></div></td><td class="codeLine"> /* [5] On construit le chemin</td></tr>
|
||||
<tr><td><div align="right"><a name="201"></a><a href="#201">201</a></div></td><td class="codeLine"> ==========================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 202" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="202"></a><a href="#202">202</a></div></td><td class="codeLine"> $this->path = __ROOT__.$parent.'/'.$opt_subParent.$this->flags['filename'].'.'.$this->flags['extension'];</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 202" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="202"></a><a href="#202">202</a></div></td><td class="codeLine"> $this->path = __ROOT__.$parent.'/'.$opt_subParent.$this->flags['filename'].'.'.$this->flags['extension'];</td></tr>
|
||||
<tr><td><div align="right"><a name="203"></a><a href="#203">203</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="204"></a><a href="#204">204</a></div></td><td class="codeLine"> /* [6] On retourne si le fichier existe ou non</td></tr>
|
||||
<tr><td><div align="right"><a name="205"></a><a href="#205">205</a></div></td><td class="codeLine"> ==========================================================*/</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 206" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="206"></a><a href="#206">206</a></div></td><td class="codeLine"> return @file_get_contents( $this->path ) != false;</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 206" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="206"></a><a href="#206">206</a></div></td><td class="codeLine"> return @file_get_contents( $this->path ) != false;</td></tr>
|
||||
<tr><td><div align="right"><a name="207"></a><a href="#207">207</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="208"></a><a href="#208">208</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="209"></a><a href="#209">209</a></div></td><td class="codeLine"></td></tr>
|
||||
|
@ -427,12 +427,12 @@
|
|||
<tr><td><div align="right"><a name="232"></a><a href="#232">232</a></div></td><td class="codeLine"> */</td></tr>
|
||||
<tr><td><div align="right"><a name="233"></a><a href="#233">233</a></div></td><td class="codeLine"> public function getContent(){</td></tr>
|
||||
<tr><td><div align="right"><a name="234"></a><a href="#234">234</a></div></td><td class="codeLine"> // S'il y a eu une erreur en amont</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 235" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="235"></a><a href="#235">235</a></div></td><td class="codeLine"> if( $this->error != Error::Success )</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 236" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="236"></a><a href="#236">236</a></div></td><td class="codeLine"> return false; // on retourne faux</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 235" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="235"></a><a href="#235">235</a></div></td><td class="codeLine"> if( $this->error != Error::Success )</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 236" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="236"></a><a href="#236">236</a></div></td><td class="codeLine"> return false; // on retourne faux</td></tr>
|
||||
<tr><td><div align="right"><a name="237"></a><a href="#237">237</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="238"></a><a href="#238">238</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="239"></a><a href="#239">239</a></div></td><td class="codeLine"> // On inclut le contenu</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 240" data-content="<ul><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="240"></a><a href="#240">240</a></div></td><td class="codeLine"> return file_get_contents($this->path);</td></tr>
|
||||
<tr class="success popin" data-title="4 tests cover line 240" data-content="<ul><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithSERVERLocal</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="240"></a><a href="#240">240</a></div></td><td class="codeLine"> return file_get_contents($this->path);</td></tr>
|
||||
<tr><td><div align="right"><a name="241"></a><a href="#241">241</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="242"></a><a href="#242">242</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="243"></a><a href="#243">243</a></div></td><td class="codeLine"></td></tr>
|
||||
|
|
|
@ -165,19 +165,19 @@
|
|||
<tr><td><div align="right"><a name="50"></a><a href="#50">50</a></div></td><td class="codeLine"> *</td></tr>
|
||||
<tr><td><div align="right"><a name="51"></a><a href="#51">51</a></div></td><td class="codeLine"> */</td></tr>
|
||||
<tr><td><div align="right"><a name="52"></a><a href="#52">52</a></div></td><td class="codeLine"> function autoloader($className){</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 53" data-content="<ul><li class="success">phpunit\Database_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\Database_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\Database_check::testUsernameSize3Correct</li><li class="success">phpunit\Database_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\Database_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\Database_check::testMailSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordContentIncorrect</li><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\Database_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="53"></a><a href="#53">53</a></div></td><td class="codeLine"> $path = '';</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 53" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSize3Correct</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testMailSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordContentIncorrect</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\DatabaseDriver_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="53"></a><a href="#53">53</a></div></td><td class="codeLine"> $path = '';</td></tr>
|
||||
<tr><td><div align="right"><a name="54"></a><a href="#54">54</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="55"></a><a href="#55">55</a></div></td><td class="codeLine"> /* [1] On utilise le namespace pour localiser</td></tr>
|
||||
<tr><td><div align="right"><a name="56"></a><a href="#56">56</a></div></td><td class="codeLine"> ===============================================*/</td></tr>
|
||||
<tr><td><div align="right"><a name="57"></a><a href="#57">57</a></div></td><td class="codeLine"> // On remplace les '\' par des '/'</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 58" data-content="<ul><li class="success">phpunit\Database_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\Database_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\Database_check::testUsernameSize3Correct</li><li class="success">phpunit\Database_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\Database_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\Database_check::testMailSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordContentIncorrect</li><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\Database_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="58"></a><a href="#58">58</a></div></td><td class="codeLine"> $path = str_replace('\\', '/', $className) . '.php';</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 59" data-content="<ul><li class="success">phpunit\Database_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\Database_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\Database_check::testUsernameSize3Correct</li><li class="success">phpunit\Database_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\Database_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\Database_check::testMailSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordContentIncorrect</li><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\Database_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="59"></a><a href="#59">59</a></div></td><td class="codeLine"> $path = __ROOT__.'/'.$path;</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 58" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSize3Correct</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testMailSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordContentIncorrect</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\DatabaseDriver_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="58"></a><a href="#58">58</a></div></td><td class="codeLine"> $path = str_replace('\\', '/', $className) . '.php';</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 59" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSize3Correct</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testMailSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordContentIncorrect</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\DatabaseDriver_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="59"></a><a href="#59">59</a></div></td><td class="codeLine"> $path = __ROOT__.'/'.$path;</td></tr>
|
||||
<tr><td><div align="right"><a name="60"></a><a href="#60">60</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="61"></a><a href="#61">61</a></div></td><td class="codeLine"> // Si le fichier existe</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 62" data-content="<ul><li class="success">phpunit\Database_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\Database_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\Database_check::testUsernameSize3Correct</li><li class="success">phpunit\Database_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\Database_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\Database_check::testMailSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordContentIncorrect</li><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\Database_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="62"></a><a href="#62">62</a></div></td><td class="codeLine"> if( file_exists($path) )</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 63" data-content="<ul><li class="success">phpunit\Database_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\Database_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\Database_check::testUsernameSize3Correct</li><li class="success">phpunit\Database_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\Database_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\Database_check::testMailSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordContentIncorrect</li><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\Database_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="63"></a><a href="#63">63</a></div></td><td class="codeLine"> require_once $path; // on inclue le fichier</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 62" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSize3Correct</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testMailSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordContentIncorrect</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\DatabaseDriver_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="62"></a><a href="#62">62</a></div></td><td class="codeLine"> if( file_exists($path) )</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 63" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSize3Correct</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testMailSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordContentIncorrect</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\DatabaseDriver_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="63"></a><a href="#63">63</a></div></td><td class="codeLine"> require_once $path; // on inclue le fichier</td></tr>
|
||||
<tr><td><div align="right"><a name="64"></a><a href="#64">64</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 65" data-content="<ul><li class="success">phpunit\Database_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\Database_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\Database_check::testUsernameSize3Correct</li><li class="success">phpunit\Database_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\Database_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\Database_check::testMailSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordContentIncorrect</li><li class="success">phpunit\Database_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\Database_construct::testInstancePersistence</li><li class="success">phpunit\Database_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\Database_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="65"></a><a href="#65">65</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr class="success popin" data-title="12 tests cover line 65" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeInfCorrect</li><li class="success">phpunit\DatabaseDriver_check::testAutoIncrementSizeLtInfIncorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSize3Correct</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeLt3Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testUsernameSizeGt30Incorrect</li><li class="success">phpunit\DatabaseDriver_check::testMailSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordContentIncorrect</li><li class="success">phpunit\DatabaseDriver_construct::testGetInstanceWithNoSERVER</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistence</li><li class="success">phpunit\DatabaseDriver_construct::testInstancePersistenceRefutation</li><li class="success">phpunit\DatabaseDriver_delNumeric::testGlobal2Dim</li><li class="success">phpunit\Error::testErrorSuccess</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="65"></a><a href="#65">65</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="66"></a><a href="#66">66</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="67"></a><a href="#67">67</a></div></td><td class="codeLine"> // On definit l'autoloader comme autoloader (obvious)</td></tr>
|
||||
<tr><td><div align="right"><a name="68"></a><a href="#68">68</a></div></td><td class="codeLine"> spl_autoload_register('autoloader', false, true);</td></tr>
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
<tr><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"> /* SECURE SHA1 ALGORITHM */</td></tr>
|
||||
<tr><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"> /*************************/</td></tr>
|
||||
<tr><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"> public static function secure_sha1($data){</td></tr>
|
||||
<tr class="success popin" data-title="14 tests cover line 15" data-content="<ul><li class="success">phpunit\Database_check::testPasswordSizeEqCorrect</li><li class="success">phpunit\Database_check::testPasswordSizeSupIncorrect</li><li class="success">phpunit\sessionManager::testSecureSHA1</li><li class="success">phpunit\sessionManager::testIdSessionUniq</li><li class="success">phpunit\sessionManager::testIdenticalPrefix</li><li class="success">phpunit\sessionManager::testCookieUniq</li><li class="success">phpunit\sessionManager::testSessionIdTheftWithWrongIp</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongIp</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongIpThenWell</li><li class="success">phpunit\sessionManager::testSessionIdTheftWithWrongUserAgent</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongUserAgent</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongUserAgentThenWell</li><li class="success">phpunit\sessionManager::testRegeneratedToken</li><li class="success">phpunit\sessionManager::testSamePrefixToken</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"> return sha1( '">\[..|{@#))'.sha1($data.'_)Q@#((%*_$%(@#') );</td></tr>
|
||||
<tr class="success popin" data-title="14 tests cover line 15" data-content="<ul><li class="success">phpunit\DatabaseDriver_check::testPasswordSizeEqCorrect</li><li class="success">phpunit\DatabaseDriver_check::testPasswordSizeSupIncorrect</li><li class="success">phpunit\sessionManager::testSecureSHA1</li><li class="success">phpunit\sessionManager::testIdSessionUniq</li><li class="success">phpunit\sessionManager::testIdenticalPrefix</li><li class="success">phpunit\sessionManager::testCookieUniq</li><li class="success">phpunit\sessionManager::testSessionIdTheftWithWrongIp</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongIp</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongIpThenWell</li><li class="success">phpunit\sessionManager::testSessionIdTheftWithWrongUserAgent</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongUserAgent</li><li class="success">phpunit\sessionManager::testSessionTokenTheftWithWrongUserAgentThenWell</li><li class="success">phpunit\sessionManager::testRegeneratedToken</li><li class="success">phpunit\sessionManager::testSamePrefixToken</li></ul>" data-placement="bottom" data-html="true"><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"> return sha1( '">\[..|{@#))'.sha1($data.'_)Q@#((%*_$%(@#') );</td></tr>
|
||||
<tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"> }</td></tr>
|
||||
<tr><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"></td></tr>
|
||||
<tr><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"></td></tr>
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
/* [1] Verification du chargement de la config
|
||||
=========================================================*/
|
||||
public function testGetInstanceWithNoSERVER(){
|
||||
$instance = \database\core\Database::getInstance();
|
||||
$instance = \database\core\DatabaseDriver::get();
|
||||
|
||||
$this->assertEquals( 'localhost', $instance->getConfig()['host'] );
|
||||
}
|
||||
|
||||
public function testGetInstanceWithSERVERLocal(){
|
||||
// Pour regenerer une instance, on definit une erreur
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
\database\core\DatabaseDriver::$error = \error\core\Error::PDOConnection;
|
||||
|
||||
|
||||
$instance = \database\core\Database::getInstance();
|
||||
$instance = \database\core\DatabaseDriver::get();
|
||||
|
||||
$this->assertEquals( 'localhost', $instance->getConfig()['host'] );
|
||||
}
|
||||
|
@ -25,20 +25,20 @@
|
|||
/* [2] Verification du singleton (getInstance)
|
||||
=========================================================*/
|
||||
public function testInstancePersistence(){
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
\database\core\DatabaseDriver::$error = \error\core\Error::PDOConnection;
|
||||
|
||||
$instance_construct = \database\core\Database::getInstance();
|
||||
$instance_nextuse = \database\core\Database::getInstance();
|
||||
$instance_construct = \database\core\DatabaseDriver::get();
|
||||
$instance_nextuse = \database\core\DatabaseDriver::get();
|
||||
|
||||
$this->assertSame( $instance_construct, $instance_nextuse );
|
||||
}
|
||||
|
||||
public function testInstancePersistenceRefutation(){
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
$instance_construct = \database\core\Database::getInstance();
|
||||
\database\core\DatabaseDriver::$error = \error\core\Error::PDOConnection;
|
||||
$instance_construct = \database\core\DatabaseDriver::get();
|
||||
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
$instance_nextuse = \database\core\Database::getInstance();
|
||||
\database\core\DatabaseDriver::$error = \error\core\Error::PDOConnection;
|
||||
$instance_nextuse = \database\core\DatabaseDriver::get();
|
||||
|
||||
$this->assertNotSame( $instance_construct, $instance_nextuse );
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
|||
/* [3] Verification de l'objet PDO
|
||||
=========================================================*/
|
||||
public function testPDO(){
|
||||
$pdo = \database\core\Database::getPDO();
|
||||
$pdo = \database\core\DatabaseDriver::getPDO();
|
||||
|
||||
$this->assertGreaterThan( 10, count($pdo->query('SELECT * FROM user')->fetchAll()), '[!] Moins de 10 utilisateurs trouves.');
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
/* [0] Verification du type
|
||||
=========================================================*/
|
||||
public function testTypeInt(){
|
||||
$this->assertEquals( [], \database\core\Database::delNumeric(10) );
|
||||
$this->assertEquals( [], \database\core\DatabaseDriver::delNumeric(10) );
|
||||
}
|
||||
|
||||
public function testTypeString(){
|
||||
$this->assertEquals( [], \database\core\Database::delNumeric('notarray') );
|
||||
$this->assertEquals( [], \database\core\DatabaseDriver::delNumeric('notarray') );
|
||||
}
|
||||
|
||||
/* [1] Verification pour 2 dimensions
|
||||
|
@ -23,7 +23,7 @@
|
|||
1 => 'Jean Dupont',
|
||||
]];
|
||||
|
||||
$computed_array = \database\core\Database::delNumeric( $fetchData );
|
||||
$computed_array = \database\core\DatabaseDriver::delNumeric( $fetchData );
|
||||
|
||||
$this->assertArrayHasKey( 'id', $computed_array[0] );
|
||||
$this->assertArrayHasKey( 'nom', $computed_array[0] );
|
||||
|
@ -46,7 +46,7 @@
|
|||
7 => 'Bla'
|
||||
]];
|
||||
|
||||
$computed_array = \database\core\Database::delNumeric( $fetchData );
|
||||
$computed_array = \database\core\DatabaseDriver::delNumeric( $fetchData );
|
||||
|
||||
$this->assertArrayHasKey( 'id', $computed_array[0] );
|
||||
$this->assertArrayHasKey( 'nom', $computed_array[0] );
|
||||
|
@ -73,7 +73,7 @@
|
|||
1 => 'Jean Dupont'
|
||||
];
|
||||
|
||||
$computed_array = \database\core\Database::delNumeric( $fetchData );
|
||||
$computed_array = \database\core\DatabaseDriver::delNumeric( $fetchData );
|
||||
|
||||
$this->assertArrayHasKey( 'id', $computed_array );
|
||||
$this->assertArrayHasKey( 'nom', $computed_array );
|
||||
|
@ -96,7 +96,7 @@
|
|||
7 => 'Bla'
|
||||
];
|
||||
|
||||
$computed_array = \database\core\Database::delNumeric( $fetchData );
|
||||
$computed_array = \database\core\DatabaseDriver::delNumeric( $fetchData );
|
||||
|
||||
$this->assertArrayHasKey( 'id', $computed_array );
|
||||
$this->assertArrayHasKey( 'nom', $computed_array );
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\ModuleResponse;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \error\core\Error;
|
||||
use \api\core\Authentification;
|
||||
|
||||
|
@ -21,8 +22,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [1] Gestion des authentifications et des droits
|
||||
=========================================================*/
|
||||
/* (1) On met à jour l'authentification et les permissions */
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
|
||||
|
||||
var_dump(__ROOT__);
|
||||
exit();
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ResourceDispatcher;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
|
||||
|
||||
use \orm\core\Table;
|
||||
|
@ -454,7 +457,7 @@
|
|||
//
|
||||
// $a->dispatch();
|
||||
|
||||
|
||||
Table::add();
|
||||
|
||||
$state = Table::get('state')
|
||||
->select('state')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once __ROOT__.'/autoloader.php';
|
||||
use \api\core\ModuleRequest;
|
||||
use \error\core\Error;
|
||||
use \database\core\Database;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \database\core\Repo;
|
||||
|
||||
use \orm\core\Table; use \orm\core\Rows;
|
||||
|
|
8
todo.md
8
todo.md
|
@ -140,11 +140,11 @@
|
|||
- [x] [sessionManager] Import de sessionManager
|
||||
- [x] [phpunit/tests/Database_*] Tests unitaire de delNumeric()
|
||||
- [x] [Database] Mise a jour des methodes de Database
|
||||
- [x] [Database::check] Suite de l'implementation ajout de "user.status"
|
||||
- [x] [DatabaseDriver::check] Suite de l'implementation ajout de "user.status"
|
||||
- [x] [phpunit/tests/Database_check] Tests associes
|
||||
- [x] [Database::construct] Gestion du singleton et de la config
|
||||
- [x] [Database::check] Suite de l'implementation (couverture des types de la BDD actuelle: 100%)
|
||||
- [x] [Database::delNumeric] Prevention si oubli @oneDimension + ne supprime plus les indices numeriques associees a aucun indice textuel
|
||||
- [x] [DatabaseDriver::construct] Gestion du singleton et de la config
|
||||
- [x] [DatabaseDriver::check] Suite de l'implementation (couverture des types de la BDD actuelle: 100%)
|
||||
- [x] [DatabaseDriver::delNumeric] Prevention si oubli @oneDimension + ne supprime plus les indices numeriques associees a aucun indice textuel
|
||||
- [x] [phpunit/tests/Database_check] Tests unitaire du checker
|
||||
- [x] [phpunit/] Install+Config phpunit
|
||||
- [x] [Database] Checker de type (types utilises dans la BDD)
|
||||
|
|
Loading…
Reference in New Issue