-
Notifications
You must be signed in to change notification settings - Fork 10
/
run_tests.sh
executable file
·53 lines (45 loc) · 1.58 KB
/
run_tests.sh
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
#!/bin/bash
# Cleanup.
START_DIR=$(pwd)
if [ ! -z $TRAVIS_BUILD_DIR ] ; then
START_DIR=$TRAVIS_BUILD_DIR
fi
# Set up the basic structure.
BUILD_DIR=$(mktemp -d /tmp/aop.XXXXXXXX)
echo "Using build directory ${BUILD_DIR}"
for DIR in htdocs bin
do
mkdir -p "${BUILD_DIR}/$DIR"
done
PATH="$PATH:$BUILD_DIR/bin"
# Grab our binary dependencies.
wget -P "${BUILD_DIR}/bin" "https://phar.phpunit.de/phpunit.phar"
wget -P "${BUILD_DIR}/bin" "http://files.magerun.net/n98-magerun-latest.phar"
wget -P "${BUILD_DIR}/bin" "https://raw.githubusercontent.com/colinmollenhour/modman/master/modman"
wget -P "${BUILD_DIR}/bin" "https://getcomposer.org/composer.phar"
chmod +x -R "$BUILD_DIR/bin"
# Setup magento.
INSTALL_DIR="${BUILD_DIR}/htdocs"
n98-magerun-latest.phar install \
--dbHost="${MAGENTO_DB_HOST}" \
--dbUser="${MAGENTO_DB_USER}" \
--dbPass="${MAGENTO_DB_PASS}" \
--dbName="${MAGENTO_DB_NAME}" \
--installSampleData=no \
--useDefaultConfigParams=yes \
--magentoVersionByName="${MAGENTO_VERSION}" \
--installationFolder="${INSTALL_DIR}" \
--baseUrl="http://aop.local/" || { echo "Installing Magento failed"; exit 1; }
# Get our stuff in place.
cp composer.json "${INSTALL_DIR}"
cp phpunit.xml "${INSTALL_DIR}"
cp local.xml.phpunit "${INSTALL_DIR}/app/etc/"
# Deploy module and dependencies.
cd "${INSTALL_DIR}"
modman init
modman link "${START_DIR}"
composer install --no-interaction --prefer-dist -v || { echo "Running composer failed."; exit 1; }
# Only run our own tests.
n98-magerun-latest.phar cache:flush
# Now actually run the tests.
phpunit