title: How to write php unit test to test the stack functionality?
body: <p>I want to write a unit test for a class handling a stack of positive integers.</p>
  
  <p>There are 4 methods in such class: <code>push($x), pop(), getSize(), purge()</code>.</p>
  
  <p>Please help me.</p>
  
  <p>Class looks like :-</p>
  
  <pre><code>class Stack {
  
      private $stack = array();
  
      public function __construct() {
      }
  
      public function push($data) {
          array_push($this-&gt;stack, $data);
      }
  
      public function pop() {
          return array_pop($this-&gt;stack);
      }
  
      public function getSize() {
          return count($this-&gt;stack);
      }
  
      public function purge($element) {
          unset $this-&gt;stack[$element];
      }
  
  }
  
  $s = new Stack();
  </code></pre>