Skip to content

Instantly share code, notes, and snippets.

@dbenchi
Created June 28, 2017 09:17
Show Gist options
  • Save dbenchi/6430cac51f3a3e25a176dce99f45390a to your computer and use it in GitHub Desktop.
Save dbenchi/6430cac51f3a3e25a176dce99f45390a to your computer and use it in GitHub Desktop.
MONGOPORT=23500
BASEDIR=`pwd`
# Update tools
(cd repo && composer update)
# Run code style checker
./repo/vendor/bin/phpcs -p --standard=repo/vendor/sabre/dav/tests/phpcs/ruleset.xml --report-checkstyle=checkstyle.xml repo/lib/
# Cleanup
rm -rf mongodb
rm -f mongo.pid
rm -f mongo.log
mkdir -p mongodb
# Start temporary mongo server
mongod --dbpath mongodb \
--port $MONGOPORT \
--pidfilepath $BASEDIR/mongo.pid \
--logpath mongo.log \
--fork
sleep 2
# Configure
cat <<EOF > repo/config.json
{
"webserver": {
"baseUri": "/",
"allowOrigin": "*"
},
"database": {
"esn": {
"connectionString" : "mongodb://localhost:$MONGOPORT/",
"db": "esn",
"connectionOptions": {
"w": 1,
"fsync": true,
"connectTimeoutMS": 10000
}
},
"sabre": {
"connectionString" : "mongodb://localhost:$MONGOPORT/",
"db": "sabredav",
"connectionOptions": {
"w": 1,
"fsync": true,
"connectTimeoutMS": 10000
}
}
},
"esn": {
"apiRoot": "http://localhost:8080/api"
}
}
EOF
# Run unit tests
(cd repo/tests && ../vendor/bin/phpunit \
--coverage-clover=$BASEDIR/clover.xml \
--log-junit=$BASEDIR/junit.xml \
.)
# Clean up
kill `cat mongo.pid`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment