Skip to content

Commit

Permalink
test: Refactor the E2E tests to test both the stdout and stderr (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Feb 19, 2023
1 parent 1f1c46d commit 1e9d264
Show file tree
Hide file tree
Showing 22 changed files with 190 additions and 78 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
!/fixtures/php-settings-checker/create-expected-output
!/fixtures/php-settings-checker/index.php
!/fixtures/php-settings-checker/output-*
/*.phar
/*.phar.sig
/.box_dump/
Expand All @@ -24,8 +21,7 @@
/fixtures/build/dir012/bin/console.phar
/fixtures/build/dir012/expected-output
/fixtures/default_stub.php
/fixtures/php-settings-checker/*
/fixtures/php-settings-checker/output-xdebug-enabled
/fixtures/php-settings-checker/index.phar
/phpcs.xml
/phpunit.xml
/vendor-bin/*/composer.lock
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ BOX_BIN = bin/box
BOX = $(BOX_BIN)

SCOPED_BOX_BIN = bin/box.phar
TMP_SCOPED_BOX_BIN = bin/_box.phar
SCOPED_BOX = $(SCOPED_BOX_BIN)
SCOPED_BOX_DEPS = bin/box bin/box.bat $(shell find src res) box.json.dist scoper.inc.php vendor

Expand Down Expand Up @@ -79,6 +80,8 @@ clean:
rm -rf \
dist \
Dockerfile \
$(SCOPED_BOX_BIN) \
$(TMP_SCOPED_BOX_BIN) \
fixtures/build/*/.box_dump \
fixtures/build/*/vendor \
fixtures/build/dir010/index.phar \
Expand Down Expand Up @@ -397,19 +400,19 @@ $(SCOPED_BOX_BIN): $(SCOPED_BOX_DEPS)
@echo "$(YELLOW_COLOR)Compile Box.$(NO_COLOR)"
$(BOX) compile --ansi --no-parallel

rm bin/_box.phar || true
mv -v bin/box.phar bin/_box.phar
rm $(TMP_SCOPED_BOX_BIN) || true
mv -v bin/box.phar $(TMP_SCOPED_BOX_BIN)

@echo "$(YELLOW_COLOR)Compile Box with the isolated Box PHAR.$(NO_COLOR)"
php bin/_box.phar compile --ansi --no-parallel
php $(TMP_SCOPED_BOX_BIN) compile --ansi --no-parallel

mv -fv bin/box.phar box

@echo "$(YELLOW_COLOR)Test the PHAR which has been created by the isolated PHAR.$(NO_COLOR)"
./box compile --ansi --no-parallel

mv -fv box bin/box.phar
rm bin/_box.phar
rm $(TMP_SCOPED_BOX_BIN)

touch -c $@

Expand Down
247 changes: 180 additions & 67 deletions Makefile.e2e

Large diffs are not rendered by default.

Empty file.
File renamed without changes.
Empty file.
File renamed without changes.
Empty file.
File renamed without changes.
Empty file.
File renamed without changes.
4 changes: 2 additions & 2 deletions fixtures/php-settings-checker/create-expected-output
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -Eeuo pipefail
readonly OS=$(uname);
readonly XDEBUG_VERSION=$(docker run -i --rm -w /opt/box $1 php -r "echo phpversion('xdebug');");
readonly CURRENT_DIR=$(dirname $0);
readonly TEMPLATE_FILE="${CURRENT_DIR}/output-xdebug-enabled.tpl";
readonly DUMPED_FILE="${CURRENT_DIR}/output-xdebug-enabled";
readonly TEMPLATE_FILE="${CURRENT_DIR}/expected-stdout-xdebug-enabled.tpl";
readonly DUMPED_FILE="${CURRENT_DIR}/expected-stdout-xdebug-enabled";

sed "s/__XDEBUG_VERSION__/${XDEBUG_VERSION}/g" ${TEMPLATE_FILE} > ${DUMPED_FILE};
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 1e9d264

Please sign in to comment.