[SPIP] ~spip v3.2.0-->v3.2.1
[lhc/web/www.git] / www / plugins-dist / archiviste / tests / _todo_deballer_archives.php
1 <?php
2
3 /**
4 * Tests unitaires de l'API d'Archives
5 * Extraction de fichiers
6 */
7
8 use Spip\Archives\SpipArchives;
9
10 $test = 'deballer archives';
11 $remonte = '../';
12 while (!is_dir($remonte . 'ecrire')) {
13 $remonte = "../$remonte";
14 }
15 require $remonte . 'tests/test.inc';
16 $ok = true;
17
18 require __DIR__ . '/TestCase.inc';
19 nettoyer_environnement_test();
20
21 include_spip('inc/archives');
22
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 ..`
26
27 $fichier = fichier_de_test('zip');
28 $repertoire = repertoire_de_test();
29 $destination = _NOM_TEMPORAIRES_INACCESSIBLES . 'archives';
30
31 $archive = new SpipArchives($fichier);
32
33 $ok &= $archive->deballer($destination, array('test.txt'));
34 $ok &= file_exists($destination . '/test.txt');
35 $ok &= !file_exists($destination . '/sousrep/fichier');
36
37 $ok &= $archive->deballer($destination);
38 $ok &= file_exists($destination . '/test.txt');
39 $ok &= file_exists($destination . '/sousrep/fichier');
40
41 nettoyer_contenu_de_test(contenu_de_test(), $destination);
42 nettoyer_environnement_test();
43 if ($ok) {
44 echo 'OK';
45 }