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?
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 <mariu...@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:
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/
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?
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\JApplica tionHelperTest.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.
On Thursday, July 19, 2012 1:52:40 AM UTC-4, marius wrote:
> 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\JApplica tionHelperTest.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.
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).
> On Thursday, July 19, 2012 1:52:40 AM UTC-4, marius wrote:
>> 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\JApplica tionHelperTest.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.
<mariu...@gmail.com> wrote:
> 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 :)
> On Thu, Jul 19, 2012 at 9:19 PM, Elin Waring <elin.war...@gmail.com> wrote:
>> The best instructions are in the manual.
>> On Thursday, July 19, 2012 1:52:40 AM UTC-4, marius wrote:
>>> 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\JApplica tionHelperTest.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.
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.
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.
> 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?