File: phpunit

package info (click to toggle)
php-horde-ldap 2.4.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 812 kB
  • sloc: php: 3,856; xml: 576; sh: 31; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,622 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
#!/bin/sh

set -e

do_preseed() {
        pkg="$1"
        template="$2"
        type="$3"
        value="$4"
        echo "Preseeding $template to $value"
        echo $pkg $template $type "$value" | debconf-set-selections || \
            echo "Failed to load preseed '$template'" 1>&2
}

do_reconfigure() {
        package="$1"
        echo "Silently running dpkg-reconfigure on package $package ... "
        dpkg -l $package | grep -q -E "^ii\s+.*" 1>/dev/null 2>/dev/null && {
                dpkg-reconfigure -fnoninteractive -pcritical $package && echo "DONE." || echo "FAILED!!!"
        } || echo "NEEDS INSTALL."
        echo
}

export LDAP_TEST_CONFIG='{"server":{"hostspec":"localhost","port":"389","basedn":"dc=debian,dc=test","binddn":"cn=admin,dc=debian,dc=test","bindpw":"H0rd3"},"capability":{"anonymous": "true", "tls":"false"}}'

do_preseed slapd shared/organization string "debian.test"
do_preseed slapd slapd/domain string "debian.test"
do_preseed slapd slapd/password1 password "H0rd3"
do_preseed slapd slapd/password2 password "H0rd3"
do_reconfigure slapd

# hide stderr to avoid negative test results (e.g. messages like
# debconf: delaying package configuration, since apt-utils is not installed)
DEBIAN_FRONTEND=noninteractive apt-get -y install slapd 2>/dev/null

cd Horde_Ldap*/test/./Horde/Ldap

# We drop privileges to run tests
touch test.out.ldif testfile_for_net_ldap_ldif
chown www-data:www-data test.out.ldif testfile_for_net_ldap_ldif
touch .phpunit.result.cache
chown www-data:www-data .phpunit.result.cache
su www-data --preserve-environment --shell /bin/sh --command 'phpunit -v .'