Skip to content

Commit

Permalink
MDLSITE-4211 add travisfile and tests structure
Browse files Browse the repository at this point in the history
There are actually quit a few things i'm not a fan of from my first
playing with bats - one was the fact there isn't a good way to get
output from failed tests! So because of that I have also included the
bats-assert and bats-error libraries.

See https://github.com/ztombol/bats-docs for details of the assertion
lib.
  • Loading branch information
danpoltawski committed Jul 13, 2016
1 parent af32548 commit 6eab377
Show file tree
Hide file tree
Showing 8 changed files with 1,106 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: php
php:
- '7.0'
sudo: false
cache:
directories:
- $HOME/cachedir
install: git clone --depth 1 https://github.com/sstephenson/bats.git $HOME/bats
before_script:
- 'git config --global user.email "travis@localhost" && git config --global user.name "Travis CI"'
- "export LOCAL_CI_TESTS_CACHEDIR=$HOME/cachedir && mkdir -p $LOCAL_CI_TESTS_CACHEDIR"
- "export LOCAL_CI_TESTS_GITDIR=$HOME/gitdir && git clone git://github.com/moodle/moodle $LOCAL_CI_TESTS_GITDIR"
script:
- $HOME/bats/bin/bats tests

9 changes: 9 additions & 0 deletions tests/01-setup.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bats

load libs/shared_setup

# This test is just used as some quick output because some tests are v.slow
@test "Git is setup for tests." {
[ -d "$gitdir/.git" ];
assert_success
}
1 change: 1 addition & 0 deletions tests/libs/bats-assert/load.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source "$(dirname "${BASH_SOURCE[0]}")/src/assert.bash"
Loading

0 comments on commit 6eab377

Please sign in to comment.