Auto-complete for step; Unit tests -> PHPunit; code clean-up.

This commit combines various recent changes done at the OU.

1. There is a new features where optionally, you can set a step to be
finished at a certain time. For example, automatically finish the step
"wait for the quiz to run" and start the step "check statistics report"
(which will generate an email to the appropriate person) 2 days before
the quiz closes.

2. The unit tests have been updated to use PHP Unit, rather than
Simpletest, since to match the changes in Moodle unit testsing system.

3. The code has bene cleaned up as a result of running code-checker.

4. block/workflow:addinstance capability added, as requied by Moodle 2.4.

5. workflow report now only shows active workflows, not workflows that
were finished in the past.
CONTRIB-4081 Fix Workflow overview query to work in MySQL.

The problem was that you could not refer to a value from the outer query
in an ON clause in a subquery. I was able to rewrite the query to
eliminate one subquery, and change the other subquery so the reference
was in the WHERE clause.