In SqlWalker::walkJoin(), SqlWalker::walkRangeVariableDeclaration() can be called which may produce an 'ON' clause if the entity inheritance type is JOINED. As walkJoin() may then produce another ON clause, this results in invalid SQL (e.g. '... ON foo = bar ON (baz = quux) ...' when the inheritance type is JOINED. This adds a test and a fix for the problem, by checking for an inheritance type of JOINED in walkJoin() and using AND instead of ON in the appropriate place. It seems like this part of the code is begging to be refactored. This is my first foray into Doctrine internals and can't see a way to do this without stomping all over the rest of the code, but this section seems ripe for cleanup by somebody who is familiar.
Running the Doctrine 2 Testsuite
Setting up a PHPUnit Configuration XML
..
Testing Lock-Support
The Lock support in Doctrine 2 is tested using Gearman, which allows to run concurrent tasks in parallel. Install Gearman with PHP as follows:
- Go to http://www.gearman.org and download the latest Gearman Server
- Compile it and then call ldconfig
- Start it up "gearmand -vvvv"
- Install pecl/gearman by calling "gearman-beta"
You can then go into tests/ and start up two workers:
php Doctrine/Tests/ORM/Functional/Locking/LockAgentWorker.php
Then run the locking test-suite:
phpunit --configuration <myconfig.xml> Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php
This can run considerable time, because it is using sleep() to test for the timing ranges of locks.