public function setUp() { Input::clear(); \Former\Former::horizontal_open(); \Former\Former::populate(array()); \Former\Former::withErrors(null); \Former\Former::config('automatic_label', true); \Former\Former::config('push_checkboxes', false); \Former\Former::framework('bootstrap'); }
/** * Set the errors to use for validations * * @param \Former\Message $validator The result from a validation * @return void * @static */ public static function withErrors($validator = null) { \Former\Former::withErrors($validator); }
public function testErrors() { $validator = Validator::make(array('required' => null), array('required' => 'required')); $validator->speaks('en'); $validator->valid(); Former::withErrors($validator); $required = Former::text('required')->__toString(); $matcher = '<div class="control-group error">' . '<label for="required" class="control-label">Required</label>' . '<div class="controls">' . '<input type="text" name="required" id="required">' . '<span class="help-inline">The required field is required.</span>' . '</div>' . '</div>'; $this->assertEquals($matcher, $required); }