|
Revision 75, 1.0 kB
(checked in by nperriault, 5 months ago)
|
[1.1]:
- Companies and people modules migrated, with according form classes and templates, and functional test suite
- Enhanced SymfoniansTestBrowser?
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
require_once(dirname(__FILE__).'/../bootstrap/unit.php'); |
|---|
| 3 |
require_once(dirname(__FILE__).'/../../lib/form/shared/BaseForm.class.php'); |
|---|
| 4 |
require_once(dirname(__FILE__).'/../../lib/widget/sfWidgetFormSchemaFormatterDiv.class.php'); |
|---|
| 5 |
|
|---|
| 6 |
$t = new lime_test(2, new lime_output_color()); |
|---|
| 7 |
|
|---|
| 8 |
class TestBaseForm extends BaseForm |
|---|
| 9 |
{ |
|---|
| 10 |
public function configure() |
|---|
| 11 |
{ |
|---|
| 12 |
$this->setWidgets(array( |
|---|
| 13 |
'f1' => new sfWidgetFormInput(), |
|---|
| 14 |
'f2' => new sfWidgetFormInput(), |
|---|
| 15 |
)); |
|---|
| 16 |
|
|---|
| 17 |
$this->setValidators(array( |
|---|
| 18 |
'f1' => new sfValidatorString(array('min_length' => 2, 'required' => true)), |
|---|
| 19 |
'f2' => new sfValidatorString(array('min_length' => 2, 'required' => false)), |
|---|
| 20 |
)); |
|---|
| 21 |
|
|---|
| 22 |
$this->getWidgetSchema()->setFormFormatterName('div'); |
|---|
| 23 |
} |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
$f = new TestBaseForm(); |
|---|
| 27 |
$t->like($f['f1']->render(), '/class="required"/', 'handleRequiredFields() handles required field'); |
|---|
| 28 |
$t->unlike($f['f2']->render(), '/class="(.?)+required(.?)+"/', 'handleRequiredFields() does not handle unrequired field'); |
|---|
| 29 |
|
|---|
| 30 |
var_dump($f['f1']->renderRow()); |
|---|