public function configure() { // upload dir sfConfig::add(array('sf_image_dir_name' => $sf_image_dir_name = 'images', 'sf_userimage_dir_name' => $sf_userimage_dir_name = 'userimages', 'sf_userimage_dir' => sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $sf_image_dir_name . DIRECTORY_SEPARATOR . $sf_userimage_dir_name, 'sf_default_photo' => 'avatar.gif', 'sf_badgeimage_dir_name' => $sf_badgeimage_dir_name = "badgeimages", 'sf_badgeimage_dir' => sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $sf_image_dir_name . DIRECTORY_SEPARATOR . $sf_badgeimage_dir_name)); // set default formatter to DIV sfWidgetFormSchemaDecorator::setDefaultFormFormatterName('div'); }
$t->is($w->render(null), fix_linebreaks($output), '->render() decorates the widget'); // implements ArrayAccess $t->diag('implements ArrayAccess'); $w['w2'] = $w2; $t->is($w->getFields(), array('w1' => $w1, 'w2' => $w2), 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->is($ws->getFields(), array('w1' => $w1, 'w2' => $w2), 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); try { $w['w1'] = 'string'; $t->fail('sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); } catch (LogicException $e) { $t->pass('sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); } $w = new sfWidgetFormSchemaDecorator($ws, "<table>\n%content%</table>"); $t->is(isset($w['w1']), true, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->is(isset($w['w2']), true, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->is(isset($ws['w1']), true, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->is(isset($ws['w2']), true, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $w = new sfWidgetFormSchemaDecorator($ws, "<table>\n%content%</table>"); $t->ok($w['w1'] == $w1, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->ok($w['w2'] == $w2, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->ok($ws['w1'] == $w1, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->ok($ws['w2'] == $w2, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $w = new sfWidgetFormSchemaDecorator($ws, "<table>\n%content%</table>"); unset($w['w1']); $t->is($w['w1'], null, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); $t->is($ws['w1'], null, 'sfWidgetFormSchemaDecorator implements the ArrayAccess interface for the fields'); // __clone() $t->diag('__clone()'); $w1 = clone $w; $t->ok($w1->getWidget() !== $w->getWidget(), '__clone() clones the embedded widget'); //$t->ok($w1->getWidget() == $w->getWidget(), '__clone() clones the embedded widget');