Samx Here
n1udSecurity


Server : Apache
System : Linux webd348.cluster026.gra.hosting.ovh.net 5.15.148-ovh-vps-grsec-zfs-classid #1 SMP Thu Feb 8 09:41:04 UTC 2024 x86_64
User : hednacluml ( 122243)
PHP Version : 8.3.9
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Directory :  /home/hednacluml/info/plugins/auto/saisies/tests/saisies_manipuler/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/hednacluml/info/plugins/auto/saisies/tests/saisies_manipuler/saisies_transformer_option.php
<?php
/**
 * Test unitaire de la fonction saisies_transformer_option, avec heritage
 * du fichier ../plugins/saisies/inc/saisies_manipuler.php
 *
 */

$test = 'saisies_transformer_option';
$remonte = "";
while (!is_file($remonte."test.inc") and !is_dir($remonte.'ecrire/'))
	$remonte = $remonte."../";
foreach ([$remonte."test.inc", $remonte."tests/test.inc", $remonte."tests/tests/legacy/test.inc"] as $f) {
	if (is_file($f)){
		require $f;
		break;
	}
}
if (!defined('_SPIP_TEST_INC')) {
	die('Impossible de trouver test.inc depuis ' .getcwd());
}
find_in_path("inc/saisies.php",'',true);

// chercher la fonction si elle n'existe pas
function tester_saisies_transformer_option($saisies, $option, $masque, $remplacement) {
	if (!function_exists($f='saisies_transformer_option')){
		find_in_path("inc/filtres.php",'',true);
		$f = chercher_filtre($f);
	}
	return saisies_supprimer_identifiants($f($saisies, $option, $masque, $remplacement));
}
$g =  'tester_saisies_transformer_option';

$err = tester_fun($g, essais_saisies_transformer_option());

// si le tableau $err est pas vide ca va pas
if ($err) {
	die ('<dl>' . join('', $err) . '</dl>');
}

echo "OK";


function essais_saisies_transformer_option(){
	$essais = array (
		// Test 1 : option textuelle
		array(
			0 =>  array (
				0 =>
				array (
					'saisie' => 'input',
					'options' =>
					array (
						'nom' => '1_input',
					)
				),
			),
			1 => array (
				0 =>
				array (
					'saisie' => 'input',
					'options' =>
					array (
						'nom' => 'input_1',
					)
				)
			),
			2 => 'nom',
			3 => '#input_(\d*)#',
			4 => '$1_input'
		),
		array(
			0 =>  array (
				0 =>
				array (
					'saisie' => 'input',
					'options' =>
					array (
						'nom' => 'input_1',
						'conteneur_class' => ' pleine_largeur',
					)
				),
			),
			1 => array (
				0 =>
				array (
					'saisie' => 'input',
					'options' =>
					array (
						'nom' => 'input_1',
					)
				)
			),
			2 => 'conteneur_class',
			3 => '#(.*)#',
			4 => '\1 pleine_largeur'
		),
		array(
			0 =>  array (
				0 =>
				array (
					'saisie' => 'input',
					'options' =>
					array (
						'nom' => 'input_1',
						'data' => '',
					)
				),
			),
			1 => array (
				0 =>
				array (
					'saisie' => 'input',
					'options' =>
					array (
						'nom' => 'input_1',
						'data' => ['data']
					)
				)
			),
			2 => 'data',
			3 => '#input_(\d*)#',
			4 => '$1_input'
		),
	);
	return $essais;
}


?>

SAMX