<p>I wish to test a function that will generate <code>lorem ipsum</code> text, but it does so within html tags. So I cant know in advance the textual content, but i know the html structure. That is what I want to test. And maybe that the length of the texts are within certain limits.
So what I am wondering is if the assertTags can do this in a way paraphrased bellow:</p>

<pre><code>Result = "&lt;p&gt;Some text&lt;/p&gt;";
Expected = array( 
   '&lt;p' ,
   'regex',
   '/p'
);
assertTags(resutl, expected)
</code></pre>

<p>I am using SimpleTest with CakePHP, but I think it should be a general question.</p>

Extend the SimpleExpectation class and then use your new Expectation class in the assert statement
see:
http://www.lastcraft.com/expectation_documentation.php#extending
the example given is for validating an IP address but should be applicable to your problem:
```
```
class ValidIp extends SimpleExpectation {

  function test($ip) {
    return (ip2long($ip) != -1);
  }

  function testMessage($ip) {
    return "Address [$ip] should be a valid IP address";
  }
}
```
```
then in your test
```
```
$this->assert(new ValidIp(),$server->getIp());
```
```