Page MenuHomePhabricator

Write unit tests for various bits of code (PHPUnit)
Closed, ResolvedPublic

Description

While we've started on parser tests, and the Unicode normalization class has its
own test suite, there's still a lot of code with no automated, objective tests.

It would be nice to have a set of unit tests, perhaps using the PHPUnit/PHPUnit2
package (it's in PEAR) to test various functions and classes. This would also
encourage refactoring code in less global-dependent ways.


Version: 1.4.x
Severity: enhancement

Details

Reference
bz699

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 6:58 PM
bzimport set Reference to bz699.
bzimport added a subscriber: Unknown Object (MLST).

wmahan_04 wrote:

Fix breakage in unit tests

It looks like Brion started on some tests but they
since became out of date. Here is a patch that makes
them work again.

To summarize, I removed the Latin-1 encoding tests
and support for MySQL v3, removed references to a
renamed profiling include file, modified
SearchMySQL4Test to use a new results interface,
and modified the database tests to create a
connection, which is now required required even
for simple operations like the addslashes()
wrapper.

With the patch all 40 tests pass, at least for me.
I'm using PHPUnit 1.3.2.

attachment unittests.diff ignored as obsolete

wmahan_04 wrote:

Take 2 - don't die horribly if LocalTestSettings.php is not set up

attachment unittests2.diff ignored as obsolete

Marking this bug resolved since we now have PHPUnit tests. Although the current coverage is far from being complete ...