4 * Tests unitaires de l'API d'Archives
5 * Extraction de fichiers
8 use Spip\Archives\SpipArchives
;
10 $test = 'deballer archives';
12 while (!is_dir($remonte . 'ecrire')) {
13 $remonte = "../$remonte";
15 require $remonte . 'tests/test.inc';
18 require __DIR__
. '/TestCase.inc';
19 nettoyer_environnement_test();
21 include_spip('inc/archives');
23 //Faire un zip valide pour tester les cas nominaux
24 // `cd local/ && touch test.txt && mkdir sousrep && touch sousrep/fichier && \
25 // zip test.zip test.txt sousrep/fichier && cd ..`
27 $fichier = fichier_de_test('zip');
28 $repertoire = repertoire_de_test();
29 $destination = _NOM_TEMPORAIRES_INACCESSIBLES
. 'archives';
31 $archive = new SpipArchives($fichier);
33 $ok &= $archive->deballer($destination, array('test.txt'));
34 $ok &= file_exists($destination . '/test.txt');
35 $ok &= !file_exists($destination . '/sousrep/fichier');
37 $ok &= $archive->deballer($destination);
38 $ok &= file_exists($destination . '/test.txt');
39 $ok &= file_exists($destination . '/sousrep/fichier');
41 nettoyer_contenu_de_test(contenu_de_test(), $destination);
42 nettoyer_environnement_test();