Exemplo n.º 1
0
 /**
  * Testing error hints.
  */
 public function testErrorHints()
 {
     $signInForm = new SignInForm();
     $signInForm->setValues(['email' => 'test@gmail.co2m', 'password' => '12q34e56t78']);
     $this->assertFalse($signInForm->isValid());
     $errorStorage = new ErrorStorage($signInForm->getErrors());
     $this->assertTrue($errorStorage->hasError('email'));
     $this->assertFalse(empty($errorStorage->getError('email')));
     $this->assertFalse($errorStorage->hasError('password'));
     $this->assertEquals(null, $errorStorage->getError('password'));
 }
Exemplo n.º 2
0
 /**
  * Testing inputs data.
  */
 public function testInputs()
 {
     // valid
     $signInForm = new SignInForm();
     $signInForm->setValues(['email' => '*****@*****.**', 'password' => '12q34e56t78']);
     $this->assertTrue($signInForm->isValid());
     // invalid
     $signInForm = new SignInForm();
     $signInForm->setValues(['email' => '*****@*****.**', 'password' => '']);
     $this->assertFalse($signInForm->isValid());
     $errors = $signInForm->getErrors();
     $this->assertTrue(!empty($errors));
 }