* @license PHP License * @package WB * @subpackage unittest */ /** * Unit Test * * * * @version 0.1.1 * @package WB * @subpackage unittest */ class TestCasePatFormsElementXinha extends UnitTestCase { /** * keep error reporting level */ protected $oldErrorReportingLevel; protected $formDef = array( 'article' => array( 'type' => 'Xinha', 'attributes' => array( 'maxlength' => 1000 ) ) ); /** * set up error reporting level */ public function __construct() { $this->req = WBClass::create('WBRequest'); $this->oldErrorReportingLevel = error_reporting(E_ALL); } /** * reset error reporting level */ public function __destruct() { $this->req->import(array('save' => null)); error_reporting($this->oldErrorReportingLevel); } /** * load class and start */ public function xtestInit() { $form = $this->mkForm(); $el = $form->getElementByName('article'); /** @var $el patForms_Element */ $this->assertIsA($el, 'patForms_Element'); $this->assertIsA($el, 'patForms_Element_Xinha'); $this->assertFalse($el->validate('anything'), 'Element should not be valid'); $errors = $el->getValidationErrors(); $this->assertEqual(count($errors), 1, 'There should be 1 error'); } public function testSetGet() { $form = $this->mkForm(); $set = array(); $set['article'] = '
Simple Article
'; $set['article'] = 'Simple Article with
" . htmlspecialchars($in) . '