Exemplo n.º 1
0
 /**
  * Decreases the stock level.
  *
  * @author David Pauli <*****@*****.**>
  * @since 0.1.0
  * @api
  * @param float $step The value the stock level should be decreased, default value is 1.
  * @return float|null The new stock level of the product.
  */
 public function decreaseStockLevel($step = 1.0)
 {
     $this->getStockLevel();
     // cast int to float
     if (InputValidator::isInt($step)) {
         $step = (double) $step;
     }
     if (!InputValidator::isRangedFloat($step, 0.0)) {
         return $this->stockLevel;
     }
     $this->changeStockLevel((double) $step * -1);
     return $this->stockLevel;
 }
 /**
  * @group utility
  */
 function testIsInt()
 {
     $this->assertFalse(InputValidator::isInt("String"));
     $this->assertFalse(InputValidator::isInt(array()));
     $this->assertFalse(InputValidator::isInt(array(12)));
     $this->assertTrue(InputValidator::isInt(3));
     $this->assertFalse(InputValidator::isInt(null));
     $this->assertFalse(InputValidator::isInt(1.2));
     $this->assertTrue(InputValidator::isInt(-3));
 }