File tree 4 files changed +43
-5
lines changed
4 files changed +43
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ Unreleased] - YYYY-MM-DD
8
+
9
+ ### Fixed
10
+
11
+ * Certain types of PHP errors did not throw a failed exit code in Behat tests.
12
+ [ _ drupal_log_error() returns a 0 exit code on errors] ( https://www.drupal.org/project/drupal/issues/2927012 )
13
+ has been applied to Drupal core until it's fixed upstream. [ #33 ] ( https://github.com/deviantintegral/drupal_tests/pull/33 )
14
+
7
15
## [ 0.3.0] - 2018-02-21
8
16
9
17
### Added
Original file line number Diff line number Diff line change @@ -57,11 +57,17 @@ RUN cd /var/www/html \
57
57
58
58
COPY hooks/* /var/www/html/
59
59
60
+ # Commit our preinstalled Drupal database for faster Behat tests.
60
61
COPY drupal.sql.gz /var/www
61
62
COPY settings.php /var/www
62
63
RUN mkdir -p /var/www/html/sites/default/files/config_yt3arM1I65-zRJQc52H_nu_xyV-c4YyQ86uwM1E3JBCvD3CXL38O8JqAxqnWWj8rHRiigYrj0w/sync \
63
64
&& chown -Rv www-data /var/www/html/sites/default/files
64
65
66
+ # Patch Drupal to avoid a bug where behat failures show as passes.
67
+ # https://www.drupal.org/project/drupal/issues/2927012#comment-12467957
68
+ RUN cd /var/www/html \
69
+ && curl https://www.drupal.org/files/issues/2927012.22-log-error-exit-code.patch | patch -p1
70
+
65
71
# Add the vendor/bin directory to the $PATH
66
72
ENV PATH="/var/www/html/vendor/bin:${PATH}"
67
73
Original file line number Diff line number Diff line change
1
+ diff --git a/tests/src/Behat/features/bootstrap/NodeFeatureContext.php b/tests/src/Behat/features/bootstrap/NodeFeatureContext.php
2
+ index a02a635..2610535 100644
3
+ --- a/tests/src/Behat/features/bootstrap/NodeFeatureContext.php
4
+ +++ b/tests/src/Behat/features/bootstrap/NodeFeatureContext.php
5
+ @@ -18,6 +18,7 @@ class NodeFeatureContext extends RawDrupalContext implements SnippetAcceptingCon
6
+ * @BeforeSuite
7
+ */
8
+ public static function prepare(BeforeSuiteScope $scope) {
9
+ + \_drupal_exception_handler(new \Exception());
10
+ /** @var \Drupal\Core\Extension\ModuleHandler $moduleHandler */
11
+ $moduleHandler = \Drupal::service('module_handler');
12
+ if (!$moduleHandler->moduleExists('node')) {
Original file line number Diff line number Diff line change @@ -16,12 +16,24 @@ test_ci() {
16
16
set -e
17
17
18
18
# This module fails CS jobs currently so this is more informational.
19
- circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-code-sniffer || true
20
- circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-unit-kernel-tests
19
+ if [ ! -z $1 ]
20
+ then
21
+ circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-code-sniffer || true
22
+ circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-unit-kernel-tests
23
+
24
+ circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-behat-tests | tee behat.log
25
+ # We need to skip colour codes
26
+ egrep " 1 scenario \\ (.*1 passed" behat.log
27
+
28
+ # Test that a PHP FATAL error properly fails the job.
29
+ git apply ../fixtures/behat-fail.patch
21
30
22
- circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-behat-tests | tee behat.log
23
- # We need to skip colour codes
24
- egrep " 1 scenario \\ (.*1 passed" behat.log
31
+ # circleci doesn't bubble the exit code from behat :(
32
+ circleci.sh -e CIRCLE_PROJECT_REPONAME=node build --job run-behat-tests | tee behat.log
33
+ grep -A9 ' Behat tests failed' behat.log | tail -n 1 | grep ' + exit 1'
34
+
35
+ git reset --hard HEAD
36
+ fi
25
37
}
26
38
27
39
sudo apt-get update -y
You can’t perform that action at this time.
0 commit comments