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
|
#!/bin/sh
set -e
export VFS_SQL_MYSQL_TEST_CONFIG='{"vfs":{"sql":{"mysql":{"host":"localhost","username":"root","password":"r00t","dbname":"test"}}}}'
export VFS_SQL_MYSQLI_TEST_CONFIG='{"vfs":{"sql":{"mysqli":{"host":"localhost","username":"root","password":"r00t","dbname":"test"}}}}'
export VFS_SQL_PDO_MYSQL_TEST_CONFIG='{"vfs":{"sql":{"pdo_mysql":{"host":"localhost","username":"root","password":"r00t","dbname":"test"}}}}'
export VFS_SQL_PDO_PGSQL_TEST_CONFIG='{"vfs":{"sql":{"pdo_pgsql":{"host":"localhost","username":"test","password":"test","dbname":"test"}}}}'
export VFS_SSH2_TEST_CONFIG='{"vfs":{"ssh2":{"hostspec":"localhost","username":"test","password":"t35t_vfs","vfsroot":"/tmp/vfssh2test"}}}'
export VFS_SMB_TEST_CONFIG='{"vfs":{"smb":{"hostspec":"localhost","port":"445","username":"test","password":"t35t_vfs","share":"horde","vfsroot":"/tmp/vfssmbtest","smbclient":"/usr/bin/smbclient"}}}'
export VFS_FTP_TEST_CONFIG='{"vfs":{"ftp":{"hostspec":"localhost","username":"test","password":"t35t_vfs","vfsroot":"/tmp/vfsftptest"}}}'
mysql -e "create database IF NOT EXISTS test; ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'r00t';" -uroot
su postgres --command 'createdb test'
su postgres --command "psql -c \"CREATE USER test WITH PASSWORD 'test';\""
su postgres --command "psql -c \"GRANT ALL ON DATABASE test TO test;\""
# add user 'test' for SSH and FTP tests
useradd -s /bin/bash -m test
chpasswd << 'END'
test:t35t_vfs
END
# make user 'test' a Samba user, as well
# silly way of doing this... but it works
# see https://stackoverflow.com/a/53428249
yes t35t_vfs | head -n 2 | smbpasswd -a -s test
# provide a [horde] share in Samba for testing Horde_Vfs
mkdir /home/test/horde
chown test:test /home/test/horde
chmod 0700 /home/test/horde
cat << END >> /etc/samba/smb.conf
[horde]
comment = Horde Vfs Share
path = /home/test/horde
valid users = test
writeable = yes
guest ok = no
END
invoke-rc.d smbd restart
# make sure ftpd is listening
systemctl enable openbsd-inetd.service 1>/dev/null 2>/dev/null
invoke-rc.d openbsd-inetd start
cd Horde_Vfs*/test/./Horde/Vfs
# We drop privileges to run tests
touch .phpunit.result.cache
chown www-data:www-data .phpunit.result.cache
su www-data --preserve-environment --shell /bin/sh --command 'phpunit -v .'
|