Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1801 → Rev 1802

/trunk/jrest/tests/IO-fields-unittest.php
5,7 → 5,7
printf(<<<EOF
%s [fichiers de test]
--help|-h: cette aide
-debug|-d: informations sur les requêtes curl
-debug|-D: informations sur les requêtes curl
[-u|--user = 22506]
[-d|--domain = "http://cel"]
--pass|-p: pour l'authentifiation
24,6 → 24,7
$ php IO-fields-unittest.php -e me@tela -p blah -u 23004 -d http://localhost phptests/determ-espece*
 
Attention: lancer un test supprime TOUTES les observations existantes de l'utilisateur !
 
EOF
, /* relax emacs*/
basename(__FILE__));
35,15 → 36,28
// stocke les CSV générés à partir des test (répertoire de cache)
define('_RUNDIR', dirname(__FILE__) . '/' . 'run');
 
define('USER', isset($options['u']) ? $options['u'] : (isset($options['user']) ? $options['user'] : 22506));
define('DOMAIN', isset($options['d']) ? $options['d'] : (isset($options['domain']) ? $options['domain'] : 'http://cel'));
define('EMAIL', isset($options['e']) ? $options['e'] : (isset($options['email']) ? $options['email'] : NULL));
define('PASS', isset($options['p']) ? $options['p'] : (isset($options['pass']) ? $options['pass'] : NULL));
define('COOKIE', isset($options['P']) ? $options['P'] : (isset($options['phpsessid']) ? $options['phpsessid'] : NULL));
define('DEBUG', isset($options['D']) ? 1 : (isset($options['debug']) ? 1 : 0));
 
require_once('api.php');
// could be defined by the API::auth()
if(isset($options['u']) || isset($options['user'])) {
define('USER', isset($options['u']) ? $options['u'] : $options['user']);
}
 
// could be defined by the API::auth()
if(isset($options['P']) || isset($options['phpsessid'])) {
define('COOKIE', isset($options['P']) ? $options['P'] : $options['phpsessid']);
}
 
//require_once('api.php');
require_once('api-old.php');
 
if(!auth()) {
die('auth problem');
}
 
function setupTestEnv() {
cel_delete_all_obs();
cel_delete_all_images();
79,7 → 93,7
file_put_contents($runfile, $csv);
}
 
echo "\tcurl -F \"upload=@$runfile\" -F utilisateur=" . USER . " \"" . DOMAIN . "/jrest/ImportXLS\"\n";
//echo "\tcurl -F \"upload=@$runfile\" -F utilisateur=" . USER . " \"" . DOMAIN . "/jrest/ImportXLS\"\n";
echo "$test: ";
$var_expected = include(_TESTDIR . '/' . str_replace('.test.', '.result.', $test));
 
89,7 → 103,10
$count_warn = count($count_warn);
 
$result = getCSV_line(export($cols), 1);
if(!$result) die("\n!!! export vide, problème probable d'authentification ?\n");
if(!$result) {
echo ("\n!!! export vide, problème probable d'authentification ?\n");
continue;
}
 
//var_dump(champsLongToShort2($test_array['data']));die;
if($var_expected) {
101,8 → 118,8
if(!$d1 && !$d2) echo "OK\n";
else {
echo "FAIL\n";
if($d1) print_r($d1);
if($d2) print_r($d2);
if($d1) { echo "expect: "; print_r($d1); }
if($d2) { echo "result: "; print_r($d2); }
//var_dump($var_expected, $result);
}
if(DEBUG) echo $retour;