예제 #1
0
 /**
  * @test
  */
 public function InjectedErrorDoesNotShowsIfNotSubmitted()
 {
     $form = new \Form\controller\FormController("TestForm");
     $form->AddInput((new \Form\model\input\Text("username"))->SetValidation(new \Form\model\validation\Required("message")), new \Form\model\input\Submit("submit", "Send"));
     $this->assertFalse($form->WasSubmitted());
     $message = "This is an errormessage";
     $form->InjectInputError('username', $message);
     $dom = new \DOMDocument();
     $dom->loadHTML($form->GetView());
     $xpath = new \DOMXpath($dom);
     $result = $xpath->query('//ul[@class="error-messages"]');
     $this->assertTrue($result->length == 0);
 }
예제 #2
0
    <small>Execution time: <?php 
echo round(microtime(TRUE) - $start_time, 4);
?>
s</small>
</p>
<p class="warning center">
    For a more complex example, see <a href="https://github.com/ehamrin/1dv608/tree/master/Project_4" target="_blank">Assignment 4 for course 1DV608</a> with the Form Handler integrated.<br/>
    The form is used in <a href="https://github.com/ehamrin/1dv608/blob/master/Project_4/src/view/RegistrationView.php" target="_blank"><code>src/view/RegistrationView</code></a> and <a href="https://github.com/ehamrin/1dv608/blob/master/Project_4/src/view/LoginView.php" target="_blank"><code>src/view/LoginView</code></a><br/>
    The application can be tested live <a href="http://1dv608.erikhamrin.se/Project_4/" target="_blank">here</a>

</p>
<pre class="result"><?php 
if (isset($data)) {
    var_dump($data);
}
?>
</pre>
<?php 
echo $form->GetView();
?>

<div class="gist">
    <h2>Source code</h2>
    <span><em>(<a href="http://gist-it.appspot.com/">http://gist-it.appspot.com/</a>)</em></span>
    <script src="http://gist-it.appspot.com/https://github.com/ehamrin/1dv608/blob/master/Project/example-usage.php?footer=0"></script>
</div>

<div class="source-code"><a href="https://github.com/ehamrin/1dv608/tree/master/Project" target="_blank">See it on GitHub!</a></div>

</body>
</html>