Home

Alex Aitken

Welcome to the PHP pUnit framework.

So, why pUnit? Why not some of the other more established frameworks out there?

Well, because the other frameworks that I have seen really just don't have nice syntax. That isn't necessarily because they were developed to look bad; it's just because the language in general is hacked together for objects. PHP is very clunky, so I'm trying to remove that with some nicer syntax around your tests.

Other Projects Included

  • pCollection

A collection namespace which will be developed over time.

  • pComparable

A comparable namespace that allows objects to be compared with each other.

Current Project Admins

Project Admins:

How To use the Code


Equality

Assurance that your two objects will be either equal, using the IEquatable interface that will be included as part of the project; or using PHP inbuilt === for equality.

Assert::That(1, Is::EqualTo(1));
Assert::AreEqual(1, 1);

Comparisons

Assurance that your two objects will be testing using the IComparable interface that will be included as part of the project; or using PHP inbuilt > (greater than) or < (less than).

Assert::That(1, Is::GreaterThan(0));
Assert::That(0, Is::LessThan(1));

Collections

Assurance that your collection has some objects in it. It takes in an IEnumerable interface that will be included as part of the project; or using PHP inbuilt arrays.

Assert::That(1, Is::MemberOf(array(1,2,3)));

Exceptions

Assurance that your code should or should not throw some sort of exception. No interfaces needed here. Because of how PHP works, we can't pass in things like Actions as C#. So, strings will have to do for now.

Assert::Throws("ArgumentException", "function name", array("params"));
Assert::DoesNotThrow("function name", array("params"));