Showing posts with label compilation. Show all posts
Showing posts with label compilation. Show all posts

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.
  


2018/08/29

PHP to UML

I wanted a tool to convert PHP classes to UML, but I also wanted to be able to modify the result.

As a (maybe positive) side effect I had to separate all PHP classes in a particular directory in order to avoid the tool to get confused with other scripts used to generate Javascript code among other things.


(this post may require some revisions)

grab php2xmi from

http://tech.motion-twin.com/php_php2xmi.html

sample script to run on project directory:


php2xmi \
--no-private \
--no-protected \
--output=/home/rudy/borrame/myresult.xmi \
`find src/class -name "*.php"`

add --path= if you need to include other project files

once you get the XMI file, you can import it with ArgoUML

http://argouml-downloads.tigris.org/argouml-0.34/

it wont generate the UML on the fly


2018/05/04

phpunit script

assuming theres a test directory inside a project where the source files are held:

#!/bin/bash

if [ $# -ne 2 ]
    then
    echo "testphp <test dir> <src dir>"
    echo "example: $ testphp test ."
    exit
fi

clear

inotifywait $2 -qmre CLOSE_WRITE --format='%f' | while read CUAL ; do  
   if [ $? != 0 ]; then exit; fi;
   clear
   phpunit.phar --log-junit /tmp/ultimo.txt --color -v $1
done