how to setup environment for phpunit for joomla testing?
-
- Joomla! Intern
- Posts: 54
- Joined: Fri Jan 23, 2009 10:39 pm
how to setup environment for phpunit for joomla testing?
I have winXP + wamp server 2.0i:
1. wamp root (done )
C:\wamp
2. wamp PHP (done )
C:\wamp\bin\php\php5.3.0
3. wamp PEAR (done )
C:\wamp\bin\php\php5.3.0\PEAR
4. PHPUnit 3.4.0 in 2 folders
C:\wamp\bin\php\php5.3.0\PEAR\PHPUnit
and
C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests
Next, I open CMD(command line)
#command1:
cd C:\wamp\bin\php\
//cause simple php doesn't work in global environment, it's a bug and haven't found the way to fix it even if to add it in win register
#command2:
--- php phpunit Alltests.php
// I asume that the file is in C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests
and then get the error:
Argument #1 of PHPUnit_Util_Fileloader:checkAndLoad() is no existing file
what is the problem? and how to fix it?
1. wamp root (done )
C:\wamp
2. wamp PHP (done )
C:\wamp\bin\php\php5.3.0
3. wamp PEAR (done )
C:\wamp\bin\php\php5.3.0\PEAR
4. PHPUnit 3.4.0 in 2 folders
C:\wamp\bin\php\php5.3.0\PEAR\PHPUnit
and
C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests
Next, I open CMD(command line)
#command1:
cd C:\wamp\bin\php\
//cause simple php doesn't work in global environment, it's a bug and haven't found the way to fix it even if to add it in win register
#command2:
--- php phpunit Alltests.php
// I asume that the file is in C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests
and then get the error:
Argument #1 of PHPUnit_Util_Fileloader:checkAndLoad() is no existing file
what is the problem? and how to fix it?
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: how to setup environment for phpunit for joomla testing?
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Intern
- Posts: 54
- Joined: Fri Jan 23, 2009 10:39 pm
Re: how to setup environment for phpunit for joomla testing?
Where you able to make Unittesting work on wamp server? Cause I asume that unittesting is incompatible with wamp server.
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: how to setup environment for phpunit for joomla testing?
No, I haven't tried it, but there are a few people who claim to work on WAMP with PHPUnit.
Did you ask the guys at the PHPUnit project?
Olaf
Did you ask the guys at the PHPUnit project?
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Intern
- Posts: 54
- Joined: Fri Jan 23, 2009 10:39 pm
Re: how to setup environment for phpunit for joomla testing?
I wish if phpunit had any forum like in joomla or any other opensource project but it doesn't and I can't dirrectly communicate with people who use this project.ooffick wrote:No, I haven't tried it, but there are a few people who claim to work on WAMP with PHPUnit.
Did you ask the guys at the PHPUnit project?
Olaf
I wrote a letter to Bergmann, but haven't got any answer yet.
I have spent few days with no luck trying to make it work,phpunit has a good guide about the testing itself, but the problem is just how to setup environment for it on winOS.
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: how to setup environment for phpunit for joomla testing?
There are a couple of tutorials which explain how to install phpunit on http://www.google.com/search?q=phpunit+wamp
Olaf
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Intern
- Posts: 54
- Joined: Fri Jan 23, 2009 10:39 pm
Re: how to setup environment for phpunit for joomla testing?
Will try to explain you one more time:ooffick wrote:There are a couple of tutorials which explain how to install phpunit on http://www.google.com/search?q=phpunit+wamp
Olaf
1. Yes I do have installed wamp->pear->phpunit. Yes I do have used google and searched a lot.
2. when I try to run phpunit it shows that it is installed. But when I try to run a test with phpunit
it gives an error which I mentioned above and I haven't found any solution for this.
Argument #1 of PHPUnit_Util_Fileloader:checkAndLoad() is no existing file
what is the problem? and how to fix it?
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: how to setup environment for phpunit for joomla testing?
Did you try adding your PHP and Pear directory to your path?devlabs wrote:Will try to explain you one more time:ooffick wrote:There are a couple of tutorials which explain how to install phpunit on http://www.google.com/search?q=phpunit+wamp
Olaf
1. Yes I do have installed wamp->pear->phpunit. Yes I do have used google and searched a lot.
2. when I try to run phpunit it shows that it is installed. But when I try to run a test with phpunit
it gives an error which I mentioned above and I haven't found any solution for this.
Argument #1 of PHPUnit_Util_Fileloader:checkAndLoad() is no existing file
what is the problem? and how to fix it?
What tests are you trying to run?
Ian
-
- Joomla! Intern
- Posts: 54
- Joined: Fri Jan 23, 2009 10:39 pm
Re: how to setup environment for phpunit for joomla testing?
ianmac wrote:Did you try adding your PHP and Pear directory to your path?devlabs wrote:Will try to explain you one more time:ooffick wrote:There are a couple of tutorials which explain how to install phpunit on http://www.google.com/search?q=phpunit+wamp
Olaf
1. Yes I do have installed wamp->pear->phpunit. Yes I do have used google and searched a lot.
2. when I try to run phpunit it shows that it is installed. But when I try to run a test with phpunit
it gives an error which I mentioned above and I haven't found any solution for this.
Argument #1 of PHPUnit_Util_Fileloader:checkAndLoad() is no existing file
what is the problem? and how to fix it?
What tests are you trying to run?
Ian
before doing
#command2:
php phpunit Alltests.php
I do
#command1:
cd C:\wamp\bin\php\
so I am already in the php folder
I am trying to run some default test(if any) to see how it works.
C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests\Alltests.php
Code: Select all
<?php
error_reporting(E_ALL | E_STRICT);
require_once 'PHPUnit/Util/Filter.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/Extensions/PhptTestSuite.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Framework' . DIRECTORY_SEPARATOR . 'AllTests.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Extensions' . DIRECTORY_SEPARATOR . 'AllTests.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Runner' . DIRECTORY_SEPARATOR . 'AllTests.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Util' . DIRECTORY_SEPARATOR . 'AllTests.php';
PHPUnit_Util_Filter::$filterPHPUnit = FALSE;
class AllTests
{
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
$suite->addTest(Framework_AllTests::suite());
$suite->addTest(Extensions_AllTests::suite());
$suite->addTest(Runner_AllTests::suite());
$suite->addTest(Util_AllTests::suite());
$suite->addTest(new PHPUnit_Extensions_PhptTestSuite(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Regression'));
$suite->addTest(new PHPUnit_Extensions_PhptTestSuite(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'TextUI'));
return $suite;
}
}
?>
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: how to setup environment for phpunit for joomla testing?
Hmm... right now I'm only using the standard phpunit runner. I have a basic test like:devlabs wrote:ianmac wrote: Did you try adding your PHP and Pear directory to your path?
What tests are you trying to run?
Ian
before doing
#command2:
php phpunit Alltests.php
I do
#command1:
cd C:\wamp\bin\php\
so I am already in the php folder
I am trying to run some default test(if any) to see how it works.
C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests\Alltests.php
I asume that this should work.Code: Select all
<?php error_reporting(E_ALL | E_STRICT); require_once 'PHPUnit/Util/Filter.php'; PHPUnit_Util_Filter::addFileToFilter(__FILE__); require_once 'PHPUnit/Framework/TestSuite.php'; require_once 'PHPUnit/Extensions/PhptTestSuite.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Framework' . DIRECTORY_SEPARATOR . 'AllTests.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Extensions' . DIRECTORY_SEPARATOR . 'AllTests.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Runner' . DIRECTORY_SEPARATOR . 'AllTests.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Util' . DIRECTORY_SEPARATOR . 'AllTests.php'; PHPUnit_Util_Filter::$filterPHPUnit = FALSE; class AllTests { public static function suite() { $suite = new PHPUnit_Framework_TestSuite('PHPUnit'); $suite->addTest(Framework_AllTests::suite()); $suite->addTest(Extensions_AllTests::suite()); $suite->addTest(Runner_AllTests::suite()); $suite->addTest(Util_AllTests::suite()); $suite->addTest(new PHPUnit_Extensions_PhptTestSuite(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Regression')); $suite->addTest(new PHPUnit_Extensions_PhptTestSuite(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'TextUI')); return $suite; } } ?>
Code: Select all
<?php
require_once 'PHPUnit/Framework.php';
class StackTest extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$stack = array();
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}
phpunit tests
I haven't gotten into the complexities though that you are trying to wade through.
Ian
-
- Joomla! Intern
- Posts: 54
- Joined: Fri Jan 23, 2009 10:39 pm
Re: how to setup environment for phpunit for joomla testing?
Can you tell me theianmac wrote: That runs. I have that file in a folder called tests. I run it by doing:
phpunit tests
I haven't gotten into the complexities though that you are trying to wade through.
Ian
1.full path to the file?
1.full path to the phpunit?
1.full path to the localhost website?
Is it
C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests\tests.php
or
C:\wamp\www\tests.php
or
it's in some another folder? where to create this file?
when you run in cmd
php phpunit
where is your location or it doesn't matter from what folder to run that command?
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: how to setup environment for phpunit for joomla testing?
Well, I'm not on wamp server, so it may be differentdevlabs wrote:Can you tell me theianmac wrote: That runs. I have that file in a folder called tests. I run it by doing:
phpunit tests
I haven't gotten into the complexities though that you are trying to wade through.
Ian
1.full path to the file?
1.full path to the phpunit?
1.full path to the localhost website?
Is it
C:\wamp\bin\php\php5.3.0\tests\PHPUnit\PHPUnit\Tests\tests.php
or
C:\wamp\www\tests.php
or
it's in some another folder? where to create this file?
when you run in cmd
php phpunit
where is your location or it doesn't matter from what folder to run that command?
I don't run php phpunit. I just run phpunit.
My full path to phpunit is /usr/bin/phpunit.
The localhost website doesn't matter, as PHPUnit doesn't run in the browser, it runs from the cli.
I would advise you to find your php executable and your phpunit executable and put those in your path. Then start working from there.
Ian
- ianmac
- Joomla! Virtuoso
- Posts: 4784
- Joined: Sat Sep 24, 2005 11:01 pm
- Location: Toronto, Canada
Re: how to setup environment for phpunit for joomla testing?
Try looking at:
http://jsdoodnauth.wordpress.com/2008/1 ... n-windows/
That may offer some assistance.
Ian
http://jsdoodnauth.wordpress.com/2008/1 ... n-windows/
That may offer some assistance.
Ian