diff --git a/build.xml b/build.xml index 1d1af20c9f205161390b8bde1dd85bcc1ffcc383..e2ce80f1ac84c24120d2ed2ceb9c95adcac50608 100644 --- a/build.xml +++ b/build.xml @@ -20,6 +20,7 @@ <property name="pgsqlhost" value="localhost" /> <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="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" /> @@ -109,12 +110,12 @@ <!-- PHPUnit --> <target name="phpunit" description="Run tests"> - <exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} 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_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_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_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 49e67a80e8e1eb40d8fe23bea83a61542f0b90b8..6bd9d8deb10a8f1b7ad7f74cb3f5881ad4078658 100644 --- a/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/MinkTestCase.php @@ -111,9 +111,11 @@ abstract class MinkTestCase extends DbTestCase protected function getMinkDriver() { if (self::$driver === false) { - self::$driver = new ZombieDriver( - new \Behat\Mink\Driver\NodeJS\Server\ZombieServer() - ); + self::$driver = (getenv('VUFIND_MINK_DRIVER') === 'selenium') + ? new \Behat\Mink\Driver\Selenium2Driver('firefox') + : new ZombieDriver( + new \Behat\Mink\Driver\NodeJS\Server\ZombieServer() + ); } return self::$driver; }