Skip to content

Commit 1e9d264

Browse files
authored
test: Refactor the E2E tests to test both the stdout and stderr (#884)
1 parent 1f1c46d commit 1e9d264

22 files changed

+190
-78
lines changed

.gitignore

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
!/fixtures/php-settings-checker/create-expected-output
2-
!/fixtures/php-settings-checker/index.php
3-
!/fixtures/php-settings-checker/output-*
41
/*.phar
52
/*.phar.sig
63
/.box_dump/
@@ -24,8 +21,7 @@
2421
/fixtures/build/dir012/bin/console.phar
2522
/fixtures/build/dir012/expected-output
2623
/fixtures/default_stub.php
27-
/fixtures/php-settings-checker/*
28-
/fixtures/php-settings-checker/output-xdebug-enabled
24+
/fixtures/php-settings-checker/index.phar
2925
/phpcs.xml
3026
/phpunit.xml
3127
/vendor-bin/*/composer.lock

Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ BOX_BIN = bin/box
1515
BOX = $(BOX_BIN)
1616

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

@@ -79,6 +80,8 @@ clean:
7980
rm -rf \
8081
dist \
8182
Dockerfile \
83+
$(SCOPED_BOX_BIN) \
84+
$(TMP_SCOPED_BOX_BIN) \
8285
fixtures/build/*/.box_dump \
8386
fixtures/build/*/vendor \
8487
fixtures/build/dir010/index.phar \
@@ -397,19 +400,19 @@ $(SCOPED_BOX_BIN): $(SCOPED_BOX_DEPS)
397400
@echo "$(YELLOW_COLOR)Compile Box.$(NO_COLOR)"
398401
$(BOX) compile --ansi --no-parallel
399402

400-
rm bin/_box.phar || true
401-
mv -v bin/box.phar bin/_box.phar
403+
rm $(TMP_SCOPED_BOX_BIN) || true
404+
mv -v bin/box.phar $(TMP_SCOPED_BOX_BIN)
402405

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

406409
mv -fv bin/box.phar box
407410

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

411414
mv -fv box bin/box.phar
412-
rm bin/_box.phar
415+
rm $(TMP_SCOPED_BOX_BIN)
413416

414417
touch -c $@
415418

Makefile.e2e

+180-67
Large diffs are not rendered by default.

fixtures/build/dir013/expected-stderr

Whitespace-only changes.
File renamed without changes.

fixtures/build/dir014/expected-stderr

Whitespace-only changes.
File renamed without changes.

fixtures/build/dir015/expected-stderr

Whitespace-only changes.
File renamed without changes.

fixtures/build/dir016/expected-stderr

Whitespace-only changes.
File renamed without changes.

fixtures/php-settings-checker/create-expected-output

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -Eeuo pipefail
1010
readonly OS=$(uname);
1111
readonly XDEBUG_VERSION=$(docker run -i --rm -w /opt/box $1 php -r "echo phpversion('xdebug');");
1212
readonly CURRENT_DIR=$(dirname $0);
13-
readonly TEMPLATE_FILE="${CURRENT_DIR}/output-xdebug-enabled.tpl";
14-
readonly DUMPED_FILE="${CURRENT_DIR}/output-xdebug-enabled";
13+
readonly TEMPLATE_FILE="${CURRENT_DIR}/expected-stdout-xdebug-enabled.tpl";
14+
readonly DUMPED_FILE="${CURRENT_DIR}/expected-stdout-xdebug-enabled";
1515

1616
sed "s/__XDEBUG_VERSION__/${XDEBUG_VERSION}/g" ${TEMPLATE_FILE} > ${DUMPED_FILE};

fixtures/php-settings-checker/expected-stderr-memory-limit-higher

Whitespace-only changes.

fixtures/php-settings-checker/expected-stderr-memory-limit-lower

Whitespace-only changes.

fixtures/php-settings-checker/expected-stderr-no-restart

Whitespace-only changes.

fixtures/php-settings-checker/expected-stderr-phar-readonly-enabled

Whitespace-only changes.

fixtures/php-settings-checker/expected-stderr-xdebug-enabled

Whitespace-only changes.

0 commit comments

Comments
 (0)