Skip to content

Commit 364f4cb

Browse files
committed
feature #2993 Add tests to avoid regressions (via Drupal) (fabpot)
This PR was merged into the 1.x branch. Discussion ---------- Add tests to avoid regressions (via Drupal) Commits ------- 9c313e3 added Drupal in the CI process
2 parents 7395b7a + 9c313e3 commit 364f4cb

File tree

2 files changed

+62
-11
lines changed

2 files changed

+62
-11
lines changed

.travis.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,10 @@ cache:
77
- vendor
88
- $HOME/.composer/cache/files
99

10-
php:
11-
- 5.4
12-
- 5.5
13-
- 5.6
14-
- 7.0
15-
- 7.1
16-
- 7.2
17-
- 7.3
18-
1910
env:
2011
- TWIG_EXT=no
2112

2213
before_install:
23-
# turn off XDebug
2414
- phpenv config-rm xdebug.ini || return 0
2515

2616
install:
@@ -32,12 +22,22 @@ before_script:
3222

3323
script: ./vendor/bin/simple-phpunit
3424

35-
matrix:
25+
jobs:
3626
fast_finish: true
3727
include:
28+
- php: 5.4
3829
- php: 5.4
3930
env: TWIG_EXT=yes
31+
- php: 5.5
4032
- php: 5.5
4133
env: TWIG_EXT=yes
34+
- php: 5.6
4235
- php: 5.6
4336
env: TWIG_EXT=yes
37+
- php: 7.0
38+
- php: 7.1
39+
- php: 7.2
40+
- php: 7.3
41+
- stage: integration tests
42+
php: 7.3
43+
script: ./drupal_test.sh

drupal_test.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
REPO=`pwd`
7+
cd /tmp
8+
rm -rf drupal-twig-test
9+
composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test
10+
cd drupal-twig-test
11+
(cd vendor/twig && rm -rf twig && ln -sf $REPO twig)
12+
echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php
13+
php ./web/core/scripts/drupal install --no-interaction demo_umami 2>/dev/null > output
14+
perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output
15+
source output
16+
17+
wget https://get.symfony.com/cli/installer -O - | bash
18+
export PATH="$HOME/.symfony/bin:$PATH"
19+
symfony server:start -d --no-tls
20+
ENDPOINT=`symfony server:status -no-ansi | sed -E 's/^.+ http/http/'`
21+
22+
curl -OLsS https://get.blackfire.io/blackfire-player.phar
23+
chmod +x blackfire-player.phar
24+
cat > drupal-tests.bkf <<EOF
25+
name "Drupal tests"
26+
27+
scenario
28+
name "homepage"
29+
set name "admin"
30+
set pass "pass"
31+
32+
visit url('/')
33+
expect status_code() == 200
34+
click link('Articles')
35+
expect status_code() == 200
36+
click link('Dairy-free and delicious milk chocolate')
37+
expect body() matches "/Dairy\-free milk chocolate is made in largely the same way as regular chocolate/"
38+
expect status_code() == 200
39+
click link('Log in')
40+
expect status_code() == 200
41+
submit button("Log in")
42+
param name name
43+
param pass pass
44+
expect status_code() == 303
45+
follow
46+
expect status_code() == 200
47+
click link('Structure')
48+
expect status_code() == 200
49+
EOF
50+
./blackfire-player.phar run drupal-tests.bkf --endpoint=$ENDPOINT --variable name=$DRUPAL_Username --variable pass=$DRUPAL_Password
51+
symfony server:stop

0 commit comments

Comments
 (0)