472,958 Members | 2,258 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Using PHPUnit2

Howdy,

For the last couple of days I've been trying to get PHPUnit2 (the one
from Pear) working on my system.

I have read the documentation over and over but still can't get any
tests to run. I've created the following trivial piece of testcode and
put it in TrueTest.php. When I try to run 'phpunit TrueTest' nothing
happens, the same with 'phpunit TrueTest.php' and 'phpunit TrueTest
TrueTest.php'. If I run phpunit without arguments I get the expected
help information. What am I missing?

<?php

require_once 'PHPUnit2/Framework/TestCase.php';
require_once 'controller/frontcontroller.php';

class TrueTest extends PHPUnit2_Framework_TestCase {

public function __construct($string) {
parent::__construct($string);
}

public function testTrue() {
self::assertTrue(true);
}

}

$suite = new PHPUnit2_Framework_TestSuite('TrueTest');
$result = $suite->run();

?>

--
Med venlig hilsen
- Jacob Atzen
Jul 17 '05 #1
3 2178
On 2005-04-05, Jacob Atzen <ja***@aub.dk> wrote:
For the last couple of days I've been trying to get PHPUnit2 (the one
from Pear) working on my system.

I have read the documentation over and over but still can't get any
tests to run. I've created the following trivial piece of testcode and
put it in TrueTest.php. When I try to run 'phpunit TrueTest' nothing
happens, the same with 'phpunit TrueTest.php' and 'phpunit TrueTest
TrueTest.php'. If I run phpunit without arguments I get the expected
help information. What am I missing?


Apparently I was missing some undocumented use patterns. For future
reference it's easier to use the --skeleton on an existing class.
Something along the lines of 'phpunit --skeleton [classname]'.

--
Cheers
- Jacob Atzen
Jul 17 '05 #2
Jacob Atzen wrote:
On 2005-04-05, Jacob Atzen <ja***@aub.dk> wrote:
For the last couple of days I've been trying to get PHPUnit2 (the one
from Pear) working on my system.

I have read the documentation over and over but still can't get any
tests to run. I've created the following trivial piece of testcode and
put it in TrueTest.php. When I try to run 'phpunit TrueTest' nothing
happens, the same with 'phpunit TrueTest.php' and 'phpunit TrueTest
TrueTest.php'. If I run phpunit without arguments I get the expected
help information. What am I missing?

Apparently I was missing some undocumented use patterns. For future
reference it's easier to use the --skeleton on an existing class.
Something along the lines of 'phpunit --skeleton [classname]'.

Do you mean you got it working? If you don't, you could try pnt/unit,
see http://www.phppeanuts.org/examples/pntUnit/index.php
(It is undocumeted, included in the framework download, but you do not
need the framework to run it (would'nt be of much use for testing the
framework it errors in the framework could break the unit testing tool ;-)

Greetings,

Henk Verhoeven.
Jul 17 '05 #3
On 2005-04-06, Henk Verhoeven <ne***@phppeanutsREMOVE-THIS.org> wrote:
Do you mean you got it working? If you don't, you could try pnt/unit,
see http://www.phppeanuts.org/examples/pntUnit/index.php
(It is undocumeted, included in the framework download, but you do not
need the framework to run it (would'nt be of much use for testing the
framework it errors in the framework could break the unit testing tool
;-)


Yes, I finally managed to run some tests with PHPUnit2.

--
Cheers,
- Jacob Atzen
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: xu | last post by:
Hi is anyone working with PHPUnit2? I've got a problem, i dont know how to run a testsuite in a browser. At this moment i'm accessing the methods of the test classes, to see if i get any errors....
0
by: mirnazim | last post by:
hi, how do I use code coverage and test skeleton generators to work in PHPUnit2. I used following commands 1) phpunit --coverage-html SomeTest 2) phpunit --skeleton SomeClass as described...
2
by: rawCoder | last post by:
Hi All, I have a *.cer file, a public key of some one and I want to encrypt some thing using this public key. Can someone point me to a sample code for Encrypting some file using...
1
by: Mike | last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta; frameworkv2.0.50215 ) the source code below I get errors (listed below due to the use of ICallBackEventHandler. Ultimately I...
10
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org ...
17
by: beliavsky | last post by:
Many of my C++ programs have the line using namespace std; but the "Accelerated C++" book of Koenig and Moo has many examples where the library names are included one at a time, for example ...
8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
14
by: john.burton.email | last post by:
I've done some extensive searching and can't seem to find an answer to this - Is it correct to using "using" with templates, for example: using std::vector; Or do I need to specify the type...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.