From b7c4f217102e7702b066b41888052a5ec1198f3a Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 18 Nov 2015 13:56:30 -0500 Subject: [PATCH] Introduced snooze multiplier to control test speed. --- build.xml | 5 +++-- module/VuFind/src/VuFindTest/Unit/MinkTestCase.php | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.xml b/build.xml index f0eeb3336f1..db8bf0c420c 100644 --- a/build.xml +++ b/build.xml @@ -22,6 +22,7 @@ <property name="pgsqlrootuser" value="postgres" /> <property name="phpunit_extra_params" value="" /> <property name="mink_driver" value="zombiejs" /><!-- may also be set to selenium --> + <property name="snooze_multiplier" value="1" /><!-- can be used to slow down tests (selenium only) --> <property name="php-cs-fixers" value="no_blank_lines_before_namespaces,function_call_space,trailing_spaces,unused_use,lowercase_keywords,encoding,parenthesis,php_closing_tag,visibility,duplicate_semicolon,extra_empty_lines,no_blank_lines_after_class_opening,no_empty_lines_after_phpdocs,operators_spaces,spaces_before_semicolon,ternary_spaces,concat_with_spaces,short_array_syntax,phpdoc_no_access,remove_leading_slash_use" /> @@ -111,12 +112,12 @@ <!-- PHPUnit --> <target name="phpunit" description="Run tests"> - <exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} VUFIND_MINK_DRIVER=${mink_driver} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ ${phpunit_extra_params}" passthru="true" checkreturn="true" /> + <exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ ${phpunit_extra_params}" passthru="true" checkreturn="true" /> </target> <!-- PHPUnit without logging output --> <target name="phpunitfast" description="Run tests"> - <exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} VUFIND_MINK_DRIVER=${mink_driver} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} phpunit -dzend.enable_gc=0 ${phpunit_extra_params}" passthru="true" checkreturn="true" /> + <exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} phpunit -dzend.enable_gc=0 ${phpunit_extra_params}" passthru="true" checkreturn="true" /> </target> <!-- Install and Activate VuFind --> diff --git a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php index 455e1af1842..c740ec51f5e 100644 --- a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php @@ -140,7 +140,11 @@ abstract class MinkTestCase extends DbTestCase { // Sleep is not necessary for Zombie.js. if (!$this->isZombieDriver()) { - sleep($secs); + $snoozeMultiplier = intval(getenv('VUFIND_SNOOZE_MULTIPLIER')); + if ($snoozeMultiplier < 1) { + $snoozeMultiplier = 1; + } + sleep($secs * $snoozeMultiplier); } } -- GitLab