Skip to content

Commit e27ccd1

Browse files
committed
Fixing tests for stub PHP files
1 parent 23f0c07 commit e27ccd1

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

.travis/test-script.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,24 @@ done
7272
# Check if there are no PHP files in the "web" folder.
7373
# It is ignoring the stub files.
7474
#
75-
if [ $( grep -Rl "<?php" "$SITE_WEB" | awk '{print $0" "}' | tr -d '\n' | grep -vc "$SITE_WEB/index.php $SITE_WEB/core/install.php $SITE_WEB/core/rebuild.php $SITE_WEB/core/modules/statistics/statistics.php" ) -eq 1 ]; then
76-
grep -Rl "<?php" "$SITE_WEB"
77-
echo "${MSG_ERROR} there are PHP files (non-stub files) in the web directory"
78-
exit 1
79-
else
80-
echo "${MSG_OK} there are no PHP files (non-stub files) in the web directory"
81-
fi
75+
PHP_FILES=($( grep -Rl "<?php" "$SITE_WEB" ))
76+
77+
for PHP_FILE_PATH in ${PHP_FILES[*]}; do
78+
IS_STUB_FILE='false'
79+
80+
for STUB_FILE_PATH in ${STUB_FILES[*]}; do
81+
if [ "$PHP_FILE_PATH" = "$SITE_ROOT/$STUB_FILE_PATH" ]; then
82+
IS_STUB_FILE='true'
83+
break
84+
fi
85+
done
86+
87+
if [ "$IS_STUB_FILE" = 'false' ]; then
88+
echo "${MSG_ERROR} there are PHP files (non-stub files) in the web directory: $PHP_FILE_PATH"
89+
exit 1
90+
fi
91+
done
92+
echo "${MSG_OK} there are no PHP files (non-stub files) in the web directory"
8293

8394
##
8495
# Install a Drupal package using Composer and check if the package's assets have been symlinked.

0 commit comments

Comments
 (0)