User tests: Successful: Unsuccessful:
Also minor corrections and improvements to docblocks for union methods.
Union method currently just doesn't work at all. This fixes it. See tracker #32995 and PR #1629. If accepted this fix also needs to go into Joomla 2.5 and Framework 1.x.
The test is not required. The ORDER BY clause is actually permitted in a MySQL UNION, although it is ignored if a LIMIT clause is not also present (which is not possible with the current implementation). I'll have a go at improving the tests. I'll have to rely on Travis because I can't get phpUnit to work at the moment (dependency hell).
Did you try to install PHPUnit using composer?composer global require 'phpunit/phpunit=3.8.*'
, see Installation chapter.
It was installed using PEAR, but it was a while ago now. I just tried removing it and re-installing with Composer but I got this error: "Your requirements could not be resolved to an installable set of packages." I'm pretty sure the problem is that phpUnit requires PHP 5.4.x and I need to have 5.3.x running. I tried downgrading to phpUnit 3.7 (using Composer) and that now installs okay. Any idea how I actually (attempt to) run the tests now? The instructions here: http://docs.joomla.org/Running_Automated_Tests_for_the_Joomla_CMS don't seem to work with the Composer installed version.
Usually I go to the root folder and run selected unit tests, just like in docs:
phpunit tests/unit/suites/libraries/joomla/database/JDatabaseQueryTest.php
Outputs this:
Configuration read from D:\localhost\GIT\joomla\joomla-cms\phpunit.xml.dist
............II.........................................F......... 65 / 80 ( 81%)
(There's currently some problem in JDatabaseQueryTest::testSet).
If this doesn't work at all, there might indeed be some problem with your installation.
If are using WAMP server, you may install few PHP versions at once.
I run the CLI on PHP 5.4 and develop on 5.3
Labels |
Added:
?
?
|
I don't know how to run it from Composer. Entering commands "phpunit" or "php phpunit" or "php composer.phar phpunit" come up with nothing. I'm running Ubuntu 12.04 and I can't afford to break anything on it as I use it for work. I'll probably set up a new server just for testing (with PHP 5.4 on it).
Anyway, I've removed the redundant test and added what I think might work for a new test. Will see what Travis says. Working blind, but if it works, I can add some more tests.
Composer installs the global requires into own directory, so you may have to add it's path to environment somehow to use it anywhere.
Check this SO answer and docs.
On windows I have a batch file that sets up the CLI with:
rem // Add Composer Global path (COMPOSER_HOME)
set PATH=%PATH%;%APPDATA%\Composer\vendor\bin
I figured out how to run the tests now. Thanks Piotr.
All tests should pass now.
Commented at #2986 (comment) about my test. It looks like this is the right patch for this issue.
You should deprecate unionDistinct()
and just call union()
instead. Unions are distinct by default so UNION DISTINCT
makes no sense.
Is that true across all supported databases?
Looks to be true for PostgreSQL - http://www.postgresql.org/docs/8.3/static/queries-union.html
The SQL Server page isn't clear on it - http://technet.microsoft.com/en-us/library/ms180026(v=sql.105).aspx
"UNION Specifies that multiple result sets are to be combined and returned as a single result set.
ALL Incorporates all rows into the results. This includes duplicates. If not specified, duplicate rows are removed."
Sounds to me like it's true for SQL Server too then.
I'm neutral on this point. We could deprecate, but since unionDistinct() is just a proxy to union() anyway it doesn't seem to me to be worth the effort.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-03-11 22:51:53 |
We have Jenkins issues with code blocks in query.php. Could someone look at that?
What issues? Which code blocks?
JM solved it already. It passes now.
It is possible to join 2 databases at the same time in a single query?
For example: I want to see how many users I have on my server and how many users I have on an external server, all in a single SQL query.
I've been testing the use of union and JDatabase:
http://docs.joomla.org/Using_the_union_methods_in_database_queries
http://docs.joomla.org/How_to_connect_to_an_external_database
@joboca You're a bit off topic here. But maybe look at this: http://stackoverflow.com/questions/1423907/how-do-you-join-tables-from-two-different-sql-server-instances-in-one-sql-query
Travis build failed because of test