File: PDOSQLExecTaskConditionTest.xml

package info (click to toggle)
phing 3.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,368 kB
  • sloc: php: 59,821; xml: 9,767; sql: 78; makefile: 39; sh: 14
file content (68 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="UTF-8" ?>

<project name="pdosqlexec condition test" default="testUrlIsRequiredException">

    <target name="testUrlIsRequiredException" description="">
        <if>
            <pdosqlexec></pdosqlexec>
            <then>
                <echo>Never reached this</echo>
            </then>
        </if>
    </target>

    <target name="testFalseWhenInvalidHost">
        <if>
            <pdosqlexec url="mysql:host=dummy"/>
            <then>
                <echo>pdosqlexec condition returned true</echo>
            </then>
            <else>
                <echo>pdosqlexec condition returned false</echo>
            </else>
        </if>
    </target>

    <target name="testFalseWhenInvalidDriver">
        <if>
            <pdosqlexec url="invalid:host=localhost"/>
            <then>
                <echo>pdosqlexec condition returned true</echo>
            </then>
            <else>
                <echo>pdosqlexec condition returned false</echo>
            </else>
        </if>
    </target>

    <target name="testCompatibleWithConditionTask">
        <condition property="condition.result" else="condition-not-met">
            <pdosqlexec url="mysql:host=localhost"/>
        </condition>
    </target>

    <target name="testCompatibleWithWaitForTask">
        <waitfor maxwaitunit="millisecond" maxwait="100" timeoutproperty="waitfor.timeout">
            <pdosqlexec url="mysql:host=localhost"/>
        </waitfor>
    </target>

    <target name="testSuccessfulCondition">
        <!-- Retrieve a public MySQL server from:         -->
        <!-- https://www.ensembl.org/info/data/mysql.html -->
        <property name="mysql.host" value="ensembldb.ensembl.org"/>
        <property name="mysql.port" value="3306"/>

        <!--Running the test-->
        <if>
            <pdosqlexec url="mysql:host=${mysql.host};port=${mysql.port}" userid="anonymous"/>
            <then>
                <echo>pdosqlexec condition returned true</echo>
            </then>
            <else>
                <echo>pdosqlexec condition returned false</echo>
            </else>
        </if>
    </target>

</project>