Merge pull request #22186 from eileenmcnaughton/smarty12
[civicrm-core.git] / tools / mixin / bin / test-all
1 #!/bin/bash
2 set -e
3 # Not really readed, and currently segfaulting on CI: # export XDEBUG_PORT= XDEBUG_MODE=off
4
5 ###############################################################################
6 ## Bootstrap
7
8 ## Determine the absolute path of the directory with the file
9 ## usage: absdirname <file-path>
10 function absdirname() {
11 pushd $(dirname $0) >> /dev/null
12 pwd
13 popd >> /dev/null
14 }
15
16 SCRIPT_DIR=$(absdirname "$0")
17 EXT_DIR=$(cv path -c extensionsDir)
18 EX_EXT_DIR="$EXT_DIR/example-mixin"
19 JUNIT_DIR="$1"
20
21 ## TODO: Once the managed-entity regression is examined/fixed, remove the MY_MIXINS list. Then it will test all mixins.
22 # MY_MIXINS='ang-php@1 case-xml@1 menu-xml@1 setting-php@1 theme-php@1'
23 MY_MIXINS=''
24
25 ###############################################################################
26
27 ## usage: mixer_test <junit-test-file> [--bare] [--isolate] <mixin-names>...
28 function mixer_test() {
29 local XML_FILE="$1"
30 shift
31
32 [ -f "$JUNIT_DIR/$XML_FILE" ] && rm -f "$JUNIT_DIR/$XML_FILE"
33
34 civibuild restore
35 cv flush
36
37 ## Facilitate testing of mixin/case-xml@1.
38 cv ev 'CRM_Core_BAO_ConfigSetting::enableComponent("CiviCase");'
39
40 ## usage: mixer test [-f] [--bare] [--isolate] <temp-ext-path> [<mixin-names>...] -- [<phpunit-options>...]
41 "$SCRIPT_DIR/mixer" test -f "$EX_EXT_DIR" "$@" -- --group e2e --log-junit "$JUNIT_DIR/$XML_FILE"
42 }
43
44 ###############################################################################
45
46 if [ -z "$EXT_DIR" -o ! -e "$EXT_DIR" ]; then
47 echo "Invalid extension dir: $EXT_DIR"
48 exit 1
49 fi
50
51 if [ -z "$JUNIT_DIR" ]; then
52 echo "Missing argument: <junit-dir>"
53 exit 1
54 elif [ ! -d "$JUNIT_DIR" ]; then
55 mkdir -p "$JUNIT_DIR"
56 fi
57
58
59 set -ex
60 mixer_test "mixin-isolate-bare.xml" $MY_MIXINS --isolate --bare
61 mixer_test "mixin-combine-bare.xml" $MY_MIXINS --bare
62 mixer_test "mixin-combine-copy.xml" $MY_MIXINS