#!/bin/bash
source ./update.sh
cp config.ini.default config.ini
sed -i "s/sgbd.config.username =/sgbd.config.username = opac/g" config.ini
sed -i "s/sgbd.config.password =/sgbd.config.password = opac/g" config.ini
sed -i "s/sgbd.config.dbname =/sgbd.config.dbname = opac/g" config.ini
touch local.php
php scripts/upgrade_db.php

cd cosmogramme
cp config.ref.php config.php
sed -i "s/integration_user=root/integration_user=opac/g" config.php
sed -i "s/integration_pwd=root/integration_pwd=opac/g" config.php
sed -i "s/integration_base=opac3/integration_base=opac/g" config.php
cd ..

phpunit -c tests/phpunit.xml --exclude-group no-ci && cd cosmogramme/tests && phpunit --exclude-group no-ci
