Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
File_SearchReplace quick mode multiple files with search/replace pairs in array
3
--SKIPIF--
4
<?php
5
include(dirname(__FILE__).'/setup.php');
6
print $status;
7
?>
8
--FILE--
9
<?php
10
require_once(dirname(__FILE__).'/setup.php');
11
 
12
$search[]  = "Copyright (c) 2002-2003";
13
$replace[] = "Copyright (c) 2002-2005";
14
 
15
$search[]  = "* @version 1.0";
16
$replace[] = "* @version 1.1";
17
 
18
$search[]  = "00";
19
$replace[] = "oo";
20
 
21
$snr = new File_SearchReplace( $search, $replace, $files);
22
$snr -> setSearchFunction('quick');
23
$snr -> doSearch() ;
24
 
25
foreach($files as $f) {
26
   readfile($f);
27
};
28
 
29
echo "\n------[Occurences]: " . $snr->getNumOccurences();
30
echo "\n------[Last Error]: " , ($snr->getLastError() !== '') ? var_dump($snr->getLastError()) : "N/A";
31
 
32
 
33
?>
34
--EXPECT--
35
<?php
36
// +-----------------------------------------------------------------------+
37
// | Copyright (c) 2oo2-2oo5, Richard Heyes                                |
38
// | All rights reserved.                                                  |
39
// |                                                                       |/**
40
// +-----------------------------------------------------------------------+
41
// | Copyright (c) 2oo2-2oo5, Richard Heyes                                |
42
 ...
43
 *
44
 * Search and Replace Utility
45
 *
46
 * @version 1.1
47
 * @package File
48
 */
49
------[Occurences]: 7
50
------[Last Error]: N/A