Re: [jplatform] Setup for running phpunit tests

198 views
Skip to first unread message

Sam Moffatt

unread,
Jul 19, 2012, 1:08:59 AM7/19/12
to joomla-de...@googlegroups.com
I'm not sure I understand. It should be a matter of getting PHPUnit
3.6, grabbing any dependencies (DBUnit primarily springs to mind
though I'm not sure if it's included) and just running "phpunit" in
the root directory of the platform instance. The dependencies can be a
bit of a trick however it'll give you error messages indicating
something you've missed that you can google.


On Wed, Jul 18, 2012 at 8:14 PM, marius <mari...@gmail.com> wrote:
> JPATH_PLATFORM is defined as the directory inside the test directory, but that library directory is empty. Do we need to manualy copy the platform in this directory?

I'm not sure I understand the statement here. JPATH_PLATFORM is
defined as being in the libraries folder (/libraries) of the parent
directory of the tests folder (dirname(JPATH_TESTS)). I put some
var_dump's after each of the define lines and I got the following:

silversaviour:joomla-platform pasamio$ php tests/bootstrap.php
string(55) "/Users/pasamio/Sites/research/git/joomla-platform/tests"
string(59) "/Users/pasamio/Sites/research/git/joomla-platform/libraries"

So the tests directory is the tests directory and the libraries
directory is the libraries directory. The Joomla Platform should be
inside the libraries directory as indicated here and maps to the
following location (at least in my GIT checkout):
https://github.com/joomla/joomla-platform/tree/master/libraries/

There is no library/libraries directory inside the tests directory. My
copy of the "tests" directory reflects this version as shown on the
web:
https://github.com/joomla/joomla-platform/tree/master/tests

What happens when you run phpunit in the root directory of the
platform? Does your repository structure on disk reflect the structure
on the GitHub website?

Cheers,


Sam Moffatt
http://pasamio.id.au

Marius van Rijnsoever

unread,
Jul 19, 2012, 1:52:40 AM7/19/12
to joomla-de...@googlegroups.com
Thanks for the reply Sam. Running it from the githib root directory
fixed that issue, but now I get the following errors:

Normal bootstrap
C:\xampp\php\php.exe C:\Users\htpc\AppData\Local\Temp\ide-phpunit.php
--bootstrap C:\PhpstormProjects\jfusion\jmedia\tests\bootstrap.php
--no-configuration C:\PhpstormProjects\jfusion\jmedia\
Fatal error: Class 'JApplicationHelper' not found in
C:\PhpstormProjects\jfusion\jmedia\tests\suites\legacy\application\JApplicationHelperTest.php
on line 11

Legacy bootstrap
C:\xampp\php\php.exe C:\Users\htpc\AppData\Local\Temp\ide-phpunit.php
--bootstrap C:\PhpstormProjects\jfusion\jmedia\tests\bootstrap.legacy.php
--no-configuration C:\PhpstormProjects\jfusion\jmedia\
Fatal error: Class 'JApplicationCli' not found in
C:\PhpstormProjects\jfusion\jmedia\libraries\legacy\application\cli.php
on line 21

Anything else basic that I am missing? The files are the latest joomla
platform from github.

Thanks, Marius

Elin Waring

unread,
Jul 19, 2012, 9:19:12 AM7/19/12
to joomla-de...@googlegroups.com

Marius van Rijnsoever

unread,
Jul 19, 2012, 10:02:13 AM7/19/12
to joomla-de...@googlegroups.com
Most of the tests run fine. But for some reason the JApplication
Helper Tests cause fatal errors, as the base classes are not included
automatically (see previous emails).

I'll do some more diggin :)

Sam Moffatt

unread,
Jul 19, 2012, 12:07:27 PM7/19/12
to joomla-de...@googlegroups.com
What version of PHPUnit are you running?

Cheers,

Sam Moffatt
http://pasamio.id.au


Chad Windnagle

unread,
Jan 16, 2013, 8:40:36 PM1/16/13
to joomla-de...@googlegroups.com
Did you find a solution to this? I'm having this problem right now. It's phpunit version 3.7.13, is that the problem? If so I can try to downgrade, but I'd be just as interested in finding a way to update the tests to work with the latest version so that this doesn't have to be a concern. 

-Chad

On Wednesday, 18 July 2012 23:14:23 UTC-4, marius wrote:
Hi All,

Quick question running unit tests. The GCoS JS/CSS Media Compressor project is coming along nicely and we are about to implement some unit tests as well. The unit testing documents on the Joomla wiki, seem outdated therefore I am posting here.

In the bootstrap file the paths are defined as:

if (!defined('JPATH_TESTS'))
{
        define('JPATH_TESTS', realpath(__DIR__));
}
if (!defined('JPATH_PLATFORM'))
{
        define('JPATH_PLATFORM', realpath(dirname(JPATH_TESTS) . '/libraries'));
}

JPATH_PLATFORM is defined as the directory inside the test directory, but that library directory is empty. Do we need to manualy copy the platform in this directory?

Thanks, Marius

Reply all
Reply to author
Forward
0 new messages