{ return null; } public function getJavaScripts() { return array('/path/to/a/' . $this->getOption('name') . '.js'); } public function getStylesheets() { return array('/path/to/a/' . $this->getOption('name') . '.css' => 'all'); } } $f = new FormTest(); $f->setWidgets(array('foo' => new MyWidget(array('name' => 'foo')), 'bar' => new MyWidget(array('name' => 'bar')))); $t->is($f->getJavaScripts(), array('/path/to/a/foo.js', '/path/to/a/bar.js'), '->getJavaScripts() returns the stylesheets of all widgets'); $t->is($f->getStylesheets(), array('/path/to/a/foo.css' => 'all', '/path/to/a/bar.css' => 'all'), '->getStylesheets() returns the JavaScripts of all widgets'); // ->getFormFieldSchema() $t->diag('->getFormFieldSchema()'); $f = new NumericFieldsForm(array('5' => 'default')); $t->is_deeply($f->getFormFieldSchema()->getValue(), array('5' => 'default'), '->getFormFieldSchema() includes default numeric fields'); $f->bind(array('5' => 'bound')); $t->is_deeply($f->getFormFieldSchema()->getValue(), array('5' => 'bound'), '->getFormFieldSchema() includes bound numeric fields'); // bind with a simulated file upload in the POST array $f = new FormTest(); try { $f->bind(array('file' => array('name' => 'foo.txt', 'type' => 'text/plain', 'tmp_name' => 'somefile', 'error' => 0, 'size' => 10))); $t->fail('Cannot fake a file upload with a POST'); } catch (InvalidArgumentException $e) { $t->pass('Cannot fake a file upload with a POST'); } $f = new FormTest();