Extends
lithium\test\Unit
Tests a simple user lookup. Note that we're not using the password validator; due to the
limitations of this classes first() mock method, password will not be in the dataset
returned by Form::check().
Source
public function testLogin() {
$subject = new Form(array(
'model' => __CLASS__,
'fields' => array('username'),
'validators' => array('password' => false)
));
$request = (object) array('data' => array(
'username' => 'Person'
));
$result = $subject->check($request);
$expected = array('username' => 'Person');
$this->assertEqual($expected, $result);
$subject = new Form(array(
'model' => __CLASS__,
'fields' => array(),
'validators' => array('password' => false)
));
$request = (object) array('data' => array());
$this->assertFalse($subject->check($request));
}