if (empty($fromLocationId) === false) { $reply->data = Movement::getMovementByFromLocationId($pdo, $fromLocationId)->toArray(); } else { if (empty($toLocationId) === false) { $reply->data = Movement::getMovementByToLocationId($pdo, $toLocationId)->toArray(); } else { if (empty($productId) === false) { $reply->data = Movement::getMovementByProductId($pdo, $productId)->toArray(); } else { if (empty($userId) === false) { $reply->data = Movement::getMovementByUserId($pdo, $userId)->toArray(); } else { if (empty($movementDate) === false) { $movementDateTime = new DateTime(); $movementDateTime->setTimestamp($movementDate / 1000); $reply->data = Movement::getMovementByMovementDate($pdo, $movementDateTime); } else { if (empty($movementType) === false) { $reply->data = Movement::getMovementByMovementType($pdo, $movementType)->toArray(); } else { if (is_int($page) === true && $page >= 0) { $reply->data = Movement::getAllMovements($pdo, $page)->toArray(); } else { throw new InvalidArgumentException("no parameters given", 405); } } } } } } }
/** * test grabbing a Movement by movementDate that does not exist **/ public function testGetInvalidMovementByMovementDate() { // grab an movementDate that does not exist $pdoMovement = Movement::getMovementByMovementDate($this->getPDO(), $this->INVALID_movementDate); foreach ($pdoMovement as $pdoM) { $this->assertNull($pdoM); } }