function test_fences_must_contain_at_least_2_posts_and_1_railing()
 {
     $a = new PostsRails();
     $this->assertEquals('Error: The minimum number of posts is 2', $a->fenceLength(1, 1));
     $this->assertEquals('Error: The minimum number of rails is 1', $a->fenceLength(2, 0));
 }
<?php

require_once 'src/PostsRails.php';
$a = new PostsRails();
if (isset($_POST['posts'])) {
    $message = $a->fenceLength($_POST['posts'], $_POST['rails']);
}
if (isset($_POST['length']) && $_POST['length'] != '') {
    $message = $a->postsRailsNeeded($_POST['length']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<form action="" method="post">
    Number of posts <input type="text" name="posts" id="posts">
    Number of rails <input type="text" name="rails" id="rails">
    Length of fence required <input type="text" name="length" id="length">
    <input type="submit" value="submit">
</form>

<h1>
    <?php 
echo $message;
?>
</h1>