build/xmlscripts/tests-setup.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* install.xml
*
* @copyright Copyright (c) 2016 Staempfli AG
* @author juan.alonso@staempfli.com
*/
-->
<project name="tests-setup" default="..." basedir=".">
<target name="tests-setup:install"
description="Create DB and settings for integration tests"
depends="util:properties,
database:properties,
database:user:create,
tests-setup:integration"
hidden="true">
<echo message="****************************************************************************"/>
<echo message="Installation For executing tests complete"/>
<echo message="You can start testing!"/>
<echo message="****************************************************************************"/>
</target>
<target name="tests-setup:integration"
depends="tests-setup:properties,
tests-setup:integration:template,
tests-setup:integration:db:drop,
tests-setup:integration:db:create"
hidden="true"
unless="skipIntegration"
logskipped="true">
<customHook hook="after-tests-setup-integration"/>
<echo message="Integration-tests setup done"/>
</target>
<target name="tests-setup:properties"
hidden="true">
<property name="test.integration.db.host" value="${database.host}"/>
<property name="test.integration.db.name" value="${database.name}_igr_tests"/>
<property name="test.integration.db.user" value="${database.user}"/>
<property name="test.integration.db.password" value="${database.password}"/>
</target>
<target name="tests-setup:integration:template"
hidden="true">
<copy file="${template.integration.mysql}"
tofile="${magento.dir}/dev/tests/integration/etc/install-config-mysql.php"
overwrite="true"
verbose="true">
<filterchain>
<replacetokens begintoken="{{" endtoken="}}">
<token key="INTEGRATION_DB_HOST" value="${test.integration.db.host}"/>
<token key="INTEGRATION_DB_NAME" value="${test.integration.db.name}"/>
<token key="INTEGRATION_DB_USER" value="${test.integration.db.user}"/>
<token key="INTEGRATION_DB_PASS" value="${test.integration.db.password}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="tests-setup:integration:db:create"
hidden="true">
<exec command="${database.connection.command} -e '
CREATE DATABASE `${test.integration.db.name}`;
GRANT ALL ON `${test.integration.db.name}`.* TO `${test.integration.db.user}`@`${test.integration.db.host}` IDENTIFIED BY "${test.integration.db.password}";'"
checkreturn="true"
logoutput="true"/>
</target>
<target name="tests-setup:integration:db:drop"
hidden="true">
<exec command="${database.connection.command} -e '
DROP DATABASE IF EXISTS `${test.integration.db.name}`;'"
checkreturn="true"
logoutput="true"/>
</target>
</project>