This is just a proof of concept implementation, based on my very limited test of Concordion, which looks awesome.
By contrast, Comity is a gruesome hack which runs tests inline with report generation, rather than generating static reports offline.
The code was cobbled together quickly on the bus this morning, and debugged a little at lunch.
It’s called Comity because that’s the nicest word I found when typing Concord into thesaurus.com :-)
Comity is currently meant to work in conjunction with Minim by adding some new template functions. These allow you to do the following:
<p>
The name
<? $exec('$result = splitName(#TEXT)') ?>John Smith<? $endExec() ?>
should be split into the first name
<? $assertEquals('$result->firstName') ?>John<? $endAssert() ?>
and the last name
<? $assertEquals('$result->lastName') ?>Smith<? $endAssert() ?>.
</p>
The controller behind this template must extend Comity_Test:
class Test extends Comity_Test
{
function index()
{
$this->render('test');
}
function splitName($name)
{
$result = explode(' ', $name, 2);
return (object) array(
'firstName' => @$result[0],
'lastName' => @$result[1]
);
}
}
The template, when executed, will display something like this:
The name John Smith should be split into the first name John and the last name Smith.