// setDefaultFormFormatterName() $t->diag('setDefaultFormFormatterName()'); $w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2)); $t->isa_ok($w->getFormFormatter(), 'sfWidgetFormSchemaFormatterTable', 'setDefaultFormFormatterName() has the "sfWidgetFormSchemaFormatterTable" form formatter by default'); sfWidgetFormSchema::setDefaultFormFormatterName('list'); $w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2)); $t->isa_ok($w->getFormFormatter(), 'sfWidgetFormSchemaFormatterList', 'setDefaultFormFormatterName() changes the default form formatter name correctly'); class MyWidget extends sfWidgetForm { protected function configure($options = array(), $attributes = array()) { $this->addRequiredOption('name'); } public function render($name, $value = null, $attributes = array(), $errors = array()) { return null; } public function getJavaScripts() { return array('/path/to/a/' . $this->getOption('name') . '.js', '/path/to/foo.js'); } public function getStylesheets() { return array('/path/to/a/' . $this->getOption('name') . '.css' => 'all', '/path/to/foo.css' => 'all'); } } // ->getJavaScripts() ->getStylesheets() $t->diag('->getJavaScripts() ->getStylesheets()'); $w = new sfWidgetFormSchema(array('foo' => new MyWidget(array('name' => 'foo')), 'bar' => new MyWidget(array('name' => 'bar')))); $t->is($w->getJavaScripts(), array('/path/to/a/foo.js', '/path/to/foo.js', '/path/to/a/bar.js'), '->getJavaScripts() returns an array of stylesheets'); $t->is($w->getStylesheets(), array('/path/to/a/foo.css' => 'all', '/path/to/foo.css' => 'all', '/path/to/a/bar.css' => 'all'), '->getStylesheets() returns an array of JavaScripts');