File: MoveTaskTest.xml

package info (click to toggle)
phing 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,868 kB
  • sloc: php: 59,850; xml: 9,713; sql: 78; makefile: 39; sh: 14
file content (58 lines) | stat: -rw-r--r-- 1,968 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0" encoding="UTF-8"?>
<project name="MoveTaskTest" default="main">
    <property name="tmp.dir" value="tmp"/>

    <target name="setup">
        <mkdir dir="${tmp.dir}"/>
    </target>

    <target name="clean">
        <delete dir="${tmp.dir}"/>
    </target>

    <target name="testMoveSingleFile">
        <touch file="${tmp.dir}/fileA"/>
        <move file="${tmp.dir}/fileA" tofile="${tmp.dir}/fileB"/>
    </target>

    <target name="testMoveFileSet">
        <mkdir dir="${tmp.dir}/base"/>
        <mkdir dir="${tmp.dir}/base/f"/>
        <touch file="${tmp.dir}/base/fileA"/>
        <move todir="${tmp.dir}/new">
            <fileset dir="${tmp.dir}/base">
                <include name="fileA"/>
            </fileset>
        </move>
    </target>

    <target name="testRenameDirectory">
        <mkdir dir="${tmp.dir}/base"/>
        <mkdir dir="${tmp.dir}/base/f"/>
        <touch file="${tmp.dir}/base/fileA"/>
        <move file="${tmp.dir}/base/" tofile="${tmp.dir}/new"/>
    </target>

    <target name="testIgnoreErrors">
        <move file="no_such_file.txt" tofile="other_path.txt" overwrite="true" haltonerror="false" />
    </target>

    <target name="testReplaceRegexp">
        <echo file="${tmp.dir}/sourcefile.txt">FOO</echo>
        <move file="${tmp.dir}/sourcefile.txt" tofile="${tmp.dir}/anotherfile.bak" overwrite="true">
            <filterchain>
                <replaceregexp>
                    <regexp pattern="FOO" replace="BAR" ignoreCase="true"/>
                </replaceregexp>
            </filterchain>
        </move>
    </target>

    <target name="testGranularity">
        <touch mkdirs="true" file="${tmp.dir}/copysrcs/Test" datetime="-1 day"/>
        <touch mkdirs="true" file="${tmp.dir}/copydest/Test" datetime="-1 year"/>
        <move file="${tmp.dir}/copysrcs/Test" todir="${tmp.dir}/copydest" granularity="999999999" overwrite="false"/>
    </target>

    <target name="main"/>
</project>