2018/09/19

Eclipse PDT preventing focus stealing during test running with PHPUnit

you are writting code and at some point you press Ctrl-F11 to run the default test configuration. Thing is: both Console and PHPUnit window will steal the focus from the source editor.
theres  a bug report marked as NEW while its 4 years old and some other fixes for Mac but I ended up with the easiest solution: to do not test under Eclipse and instead use an external console. The script I made in bash is as follows:

#!/bin/bash

clear
inotifywait -m --format %w%f -q -r -e close_write $1 $2 | \
while read CUAL
do
    if [ $? == 0 ]; then
        clear
        phpunit.phar --color  $1
   fi
done

first parameter is the location of the dir containing the tests, or the test Suite. Second parameter is the directory from where inotifywait should watch for changes on filesystem.
  


No comments:

Post a Comment