473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 2191
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.