Ejemplo n.º 1
0
 /**
  * @spec
  */
 public function testPeek()
 {
     when:
     $this->stack->peek();
     then:
     thrown('Example\\Stack\\EmptyStackException');
 }
Ejemplo n.º 2
0
 /**
  * sets the value of state
  *
  * @param string $newState
  * @throws UnexpectedValueException if not a string
  */
 public function setState($newState)
 {
     //trim the string
     $newState = trim($newState);
     //sanitize the string
     if ($newState = filter_var($newState, FILTER_SANITIZE_STRING) == false) {
         thrown(new UnexpectedValueException("state {$newState} is not a string"));
     }
     //remove from quarantine and assign
     $this->state = $newState;
 }
Ejemplo n.º 3
0
 /**
  * @spec
  */
 public function testExceptionCombination()
 {
     when:
     1 == 1;
     then:
     notThrown("RuntimeException");
     _when:
     throw new \RuntimeException("test");
     _then:
     thrown("RuntimeException");
 }