/**
  * @group utility
  */
 function testIsProductDirection()
 {
     $this->assertFalse(InputValidator::isProductDirection("Some String"));
     $this->assertFalse(InputValidator::isProductDirection(3));
     $this->assertFalse(InputValidator::isProductDirection(null));
     $this->assertFalse(InputValidator::isProductDirection(1.2));
     $this->assertFalse(InputValidator::isProductDirection("ASC"));
     $this->assertTrue(InputValidator::isProductDirection("asc"));
 }
Exemplo n.º 2
0
 /**
  * This function sets the direction to show.
  *
  * @author David Pauli <*****@*****.**>
  * @since 0.0.0
  * @since 0.1.0 Use attribute unstatic.
  * @api
  * @param String $direction The direction to filter.
  * @return boolean True if setting the direction works, false if not.
  */
 public function setDirection($direction)
 {
     if (!InputValidator::isProductDirection($direction)) {
         return false;
     }
     $this->direction = $direction;
     return true;
 }
 /**
  * This function sets the direction to show.
  *
  * @author David Pauli <*****@*****.**>
  * @param String $direction The direction to filter.
  * @return boolean True if setting the direction works, false if not.
  * @since 0.0.0
  * @since 0.1.0 Use attribute unstatic.
  * @since 0.1.2 Add error reporting.
  */
 public function setDirection($direction)
 {
     $this->errorReset();
     if (!InputValidator::isProductDirection($direction)) {
         $this->errorSet("PF-5");
         Logger::warning("The direction " . $direction . " as a product filter direction has not a valid value.");
         return false;
     }
     $this->direction = $direction;
     return true;
 }