コード例 #1
0
ファイル: LoginForm.php プロジェクト: tornado05/phpAuthTask
 public function RenderHTML()
 {
     $labelLogin = new Label();
     $labelLogin->value = 'LOGIN';
     $labelPassword = new Label();
     $labelPassword->value = 'PASSWORD';
     $inputLogin = new Input();
     $inputLogin->id = 'login';
     $inputLogin->type = 'text';
     $inputLogin->name = 'login';
     $inputLogin->value = '';
     $inputPassword = new Input();
     $inputPassword->id = 'password';
     $inputPassword->type = 'password';
     $inputPassword->name = 'password';
     $inputPassword->value = '';
     $inputSubmit = new Input();
     $inputSubmit->id = '';
     $inputSubmit->type = 'submit';
     $inputSubmit->name = '';
     $inputSubmit->value = 'LogIn';
     return '<form id="form_auth" method="post">' . $labelLogin->RenderHTML() . '<br>' . $inputLogin->RenderHTML() . '<br>' . $labelPassword->RenderHTML() . '<br>' . $inputPassword->RenderHTML() . '<br>' . $inputSubmit->RenderHTML() . '</form>';
 }
コード例 #2
0
ファイル: TestInput.php プロジェクト: tornado05/phpAuthTask
<?php

require_once __DIR__ . '/../public/private/Controllers/Input.php';
$id = 'login';
$type = 'text';
$name = 'login';
$value = '';
$expected = '<input id="' . $id . '" type="' . $type . '" name="' . $name . '" value="' . $value . '">';
$input = new Input();
$input->id = $id;
$input->type = $type;
$input->name = $name;
$input->value = $value;
$acquired = $input->RenderHTML();
if ($acquired == $expected) {
    echo 'Test passed!';
} else {
    echo 'acquired:' . $acquired;
    echo 'expected:' . $expected;
}