public function testFormSignatureGeneration()
{
$form = new Form(array('context' => $this->context));
$this->subject->sign($form);
ob_start();
$content = array($form->create(null, array('url' => 'http:///')), $form->text('email', array('value' => 'foo@bar')), $form->password('pass'), $form->hidden('active', array('value' => 'true')), $form->end());
$signature = ob_get_clean();
preg_match('/value="([^"]+)"/', $signature, $match);
list(, $signature) = $match;
$expected = array('#a%3A1%3A%7Bs%3A6%3A%22active%22%3Bs%3A4%3A%22true%22%3B%7D', 'a%3A0%3A%7B%7D', '[a-z0-9]{128}#');
$this->assertPattern(join('::', $expected), $signature);
$request = new Request(array('data' => array('email' => 'foo@baz', 'pass' => 'whatever', 'active' => 'true', 'security' => compact('signature'))));
$this->assertTrue(FormSignature::check($request));
}