/** * Set up to create vendor, product, unitOfMeasure objects * **/ public function setUp() { parent::setUp(); $this->guzzle = new \GuzzleHttp\Client(['cookies' => true]); $vendorId = null; $contactName = "Trevor Rigler"; $vendorEmail = "*****@*****.**"; $vendorName = "TruFork"; $vendorPhoneNumber = "5053594687"; $vendor = new Vendor($vendorId, $contactName, $vendorEmail, $vendorName, $vendorPhoneNumber); $vendor->insert($this->getPDO()); $productId = null; $vendorId = $vendor->getVendorId(); $description = "A glorius bead to use"; $leadTime = 10; $sku = "TGT354"; $title = "Bead-Green-Blue-Circular"; $this->product = new Product($productId, $vendorId, $description, $leadTime, $sku, $title); $this->product->insert($this->getPDO()); $unitId = null; $quantity = 3.5; $unitCode = "ea"; $this->unitOfMeasure = new UnitOfMeasure($unitId, $unitCode, $quantity); $this->unitOfMeasure->insert($this->getPDO()); }
public function setUp() { parent::setUp(); $vendorId = null; $contactName = "Trevor Rigler"; $vendorEmail = "*****@*****.**"; $vendorName = "TruFork"; $vendorPhoneNumber = "5053594687"; $vendor = new Vendor($vendorId, $contactName, $vendorEmail, $vendorName, $vendorPhoneNumber); $vendor->insert($this->getPDO()); $productId = null; $vendorId = $vendor->getVendorId(); $description = "A glorius bead to use"; $leadTime = 10; $sku = "TGT354"; $title = "Bead-Green-Blue-Circular"; $this->product = new Product($productId, $vendorId, $description, $leadTime, $sku, $title); $this->product->insert($this->getPDO()); $locationId = null; $description = "Back Stock"; $storageCode = 7; $this->location = new Location($locationId, $storageCode, $description); $this->location->insert($this->getPDO()); $unitId = null; $unitCode = "pk"; $quantity = 10.5; $this->unitOfMeasure = new UnitOfMeasure($unitId, $unitCode, $quantity); $this->unitOfMeasure->insert($this->getPDO()); }
public function setUp() { parent::setUp(); $this->guzzle = new \GuzzleHttp\Client(['cookies' => true]); $this->VALID_movementDate = DateTime::createFromFormat("Y-m-d H:i:s", "2015-09-26 08:45:25"); $this->INVALID_movementDate = DateTime::createFromFormat("Y-m-d H:i:s", "2015-14-26 06:25:25"); $userId = null; $firstName = "Jim"; $lastName = "Jim"; $root = 1; $attention = "Urgent: "; $addressLineOne = "123 House St."; $addressLineTwo = "P.O Box. 9965"; $city = "Tattoine"; $state = "AK"; $zipCode = "52467"; $email = "*****@*****.**"; $phoneNumber = "5052253231"; $salt = bin2hex(openssl_random_pseudo_bytes(32)); $hash = hash_pbkdf2("sha512", "password1234", $salt, 262144, 128); $this->user = new User($userId, $lastName, $firstName, $root, $attention, $addressLineOne, $addressLineTwo, $city, $state, $zipCode, $email, $phoneNumber, $salt, $hash); $this->user->insert($this->getPDO()); $vendorId = null; $contactName = "Trevor Rigler"; $vendorEmail = "*****@*****.**"; $vendorName = "TruFork"; $vendorPhoneNumber = "5053594687"; $vendor = new Vendor($vendorId, $contactName, $vendorEmail, $vendorName, $vendorPhoneNumber); $vendor->insert($this->getPDO()); $productId = null; $vendorId = $vendor->getVendorId(); $description = "A glorius bead to use"; $leadTime = 10; $sku = "TGT354"; $title = "Bead-Green-Blue-Circular"; $this->product = new Product($productId, $vendorId, $description, $leadTime, $sku, $title); $this->product->insert($this->getPDO()); $locationId = null; $description = "Back Stock"; $storageCode = 13; $this->fromLocation = new Location($locationId, $storageCode, $description); $this->fromLocation->insert($this->getPDO()); $locationId = null; $description = "Front Stock"; $storageCode = 12; $this->toLocation = new Location($locationId, $storageCode, $description); $this->toLocation->insert($this->getPDO()); $unitId = null; $unitCode = "pk"; $quantity = 10.5; $this->unitOfMeasure = new UnitOfMeasure($unitId, $unitCode, $quantity); $this->unitOfMeasure->insert($this->getPDO()); }
/** * Set up for Vendor as well as guzzle/cookies **/ public final function setUp() { parent::setUp(); $vendorId = null; $contactName = "Trevor Rigler"; $vendorEmail = "*****@*****.**"; $vendorName = "TruFork"; $vendorPhoneNumber = "5053594687"; $this->vendor = new Vendor($vendorId, $contactName, $vendorEmail, $vendorName, $vendorPhoneNumber); $this->vendor->insert($this->getPDO()); $locationId = null; $description = "Front Stock"; $storageCode = 12; $this->location = new Location($locationId, $storageCode, $description); $this->location->insert($this->getPDO()); $unitId = null; $unitCode = "pk"; $quantity = 10.5; $this->unitOfMeasure = new UnitOfMeasure($unitId, $unitCode, $quantity); $this->unitOfMeasure->insert($this->getPDO()); $alertCode = "78"; $alertFrequency = "56"; $alertPoint = 1.4; $alertOperator = "A"; $this->alertLevel = new AlertLevel(null, $alertCode, $alertFrequency, $alertPoint, $alertOperator); $this->alertLevel->insert($this->getPDO()); $notificationId = null; $alertId = $this->alertLevel->getAlertId(); $emailStatus = false; $notificationDateTime = null; $notificationHandle = "unit test"; $notificationContent = "place holder"; $notificationDateTime = DateTime::createFromFormat("Y-m-d H:i:s", "1985-06-28 04:26:03"); $this->notification = new Notification($notificationId, $alertId, $emailStatus, $notificationDateTime, $notificationHandle, $notificationContent); $this->notification->insert($this->getPDO()); // create and insert a GuzzleHttp $this->guzzle = new \GuzzleHttp\Client(['cookies' => true]); }
/** * test grabbing a Unit of Measure by unitCode **/ public function testGetValidUserByStorageCode() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("unitOfMeasure"); // create a new Location and insert to into mySQL $unitOfMeasure = new UnitOfMeasure(null, $this->VALID_unitCode, $this->VALID_quantity); $unitOfMeasure->insert($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoUnitOfMeasure = UnitOfMeasure::getUnitOfMeasureByUnitCode($this->getPDO(), $this->VALID_unitCode); foreach ($pdoUnitOfMeasure as $uOM) { $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("unitOfMeasure")); $this->assertSame($uOM->getUnitCode(), $this->VALID_unitCode); $this->assertSame($uOM->getQuantity(), $this->VALID_quantity); } }
$view = PostVar("view"); $Data = PostVar("Data"); $iReportId = PostVar("iUnitId"); $date = date("Y-m-d H:i:s"); $iAdminID = $_SESSION['B2B_SESS_USERID']; /** This is for Check Duplicate Record------------------------------------------- */ $generalobj->getRequestVars(); $redirect_file = "index.php?file={$file}&view={$view}&iUnitId={$iUnitId}"; // $generalobj->checkDuplicate('iSMID', PRJ_DB_PREFIX . "_security_manager", Array('vUserName' => $Data['vUserName']), $redirect_file, USER_ALREADY_EXISTS, $iSMID); if ($view == "add") { // $Data['iAdminID'] = $_SESSION['B2B_SESS_USERID']; //prints($Data);exit; $id = 0; $Data['dADate'] = $date; if (is_array($Data) && count(array_filter($Data)) > 0) { $id = $unitofmeasureObj->insert($Data); } if ($id) { $var_msg = "Record Added Successfully."; unset($Data); } else { $var_msg = "Eror-in Add."; } } else { if ($view == "edit") { // $arr = $secManObj->select($iReportId); $where = " iUnitId = '" . $iUnitId . "'"; $res = $unitofmeasureObj->updateData($Data, $where); if ($res) { $var_msg = "Record Updated Successfully."; } else {