[PHPTAL] Unit Tests

Kornel Lesiński kornel at geekhood.net
Thu Jun 2 15:29:37 CEST 2011


On Wed, 01 Jun 2011 11:47:31 +0100, Robert Goldsmith  
<rgoldsmith at names.co.uk> wrote:

> Interesting question - anyone tried unit testing Tales? Any ideas how to  
> do so?

What exactly do you want to test?

If you want to test your TALES expressions or modifiers, then you could  
use PHPTAL->setSource() to create small snippets of code and run them,  
check results:

	$this->assertEquals("HELLO",  
PHPTAL::create()->setSource("${toUpperCase:string:hello}")->execute());

For its own purpose PHPTAL tests result returned by phptal_tales()  
directly, but that exposes more than 3rd party application would want to  
know about PHPTAL internals, so I don't recommend that.

-- 
regards, Kornel Lesiński



More information about the PHPTAL mailing list