当前位置: 首页>>代码示例>>PHP>>正文


PHP Product::getProductId方法代码示例

本文整理汇总了PHP中Product::getProductId方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getProductId方法的具体用法?PHP Product::getProductId怎么用?PHP Product::getProductId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Product的用法示例。


在下文中一共展示了Product::getProductId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetValidProductByAlertId

 /**
  * test grabbing a Product by alertId
  **/
 public function testGetValidProductByAlertId()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("alertLevel");
     // create a new alertLevel and insert to into mySQL
     $alertLevel = new AlertLevel(null, $this->VALID_alertCode, $this->VALID_alertFrequency, $this->VALID_alertPoint, $this->VALID_alertOperator);
     $alertLevel->insert($this->getPDO());
     // create a new productAlert and insert to into mySQL
     $productAlert = new productAlert($alertLevel->getAlertId(), $this->product->getProductId(), true);
     $productAlert->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProductArray = AlertLevel::getProductByAlertId($this->getPDO(), $alertLevel->getAlertId());
     for ($i = 0; $i < count($pdoProductArray); $i++) {
         if ($i === 0) {
             $this->assertSame($pdoProductArray[$i]->getAlertCode(), $this->VALID_alertCode);
             $this->assertSame($pdoProductArray[$i]->getAlertFrequency(), $this->VALID_alertFrequency);
             $this->assertSame($pdoProductArray[$i]->getAlertPoint(), $this->VALID_alertPoint);
             $this->assertSame($pdoProductArray[$i]->getAlertOperator(), $this->VALID_alertOperator);
         } else {
             $this->assertSame($pdoProductArray[$i]->getProductId(), $this->product->getProductId());
             $this->assertSame($pdoProductArray[$i]->getVendorId(), $this->product->getVendorId());
             $this->assertSame($pdoProductArray[$i]->getDescription(), $this->product->getDescription());
             $this->assertSame($pdoProductArray[$i]->getSku(), $this->product->getSku());
             $this->assertSame($pdoProductArray[$i]->getTitle(), $this->product->getTitle());
         }
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:30,代码来源:alert-level-test.php

示例2: testGetValidProductByLocationId

 /**
  * test grabbing location by productId
  **/
 public function testGetValidProductByLocationId()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("location");
     // create a new location and insert to into mySQL
     $location = new Location(null, $this->VALID_storageCode, $this->VALID_description);
     $location->insert($this->getPDO());
     $quantity = 5.9;
     // create a new location and insert to into mySQL
     $productLocation = new productLocation($location->getLocationId(), $this->product->getProductId(), $this->unitOfMeasure->getUnitId(), $quantity);
     $productLocation->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProductArray = Location::getProductByLocationId($this->getPDO(), $location->getLocationId());
     for ($i = 0; $i < count($pdoProductArray); $i++) {
         if ($i === 0) {
             $this->assertSame($pdoProductArray[$i]->getStorageCode(), $this->VALID_storageCode);
             $this->assertSame($pdoProductArray[$i]->getDescription(), $this->VALID_description);
         } else {
             $this->assertSame($pdoProductArray[$i]->getProductId(), $this->product->getProductId());
             $this->assertSame($pdoProductArray[$i]->getVendorId(), $this->product->getVendorId());
             $this->assertSame($pdoProductArray[$i]->getDescription(), $this->product->getDescription());
             $this->assertSame($pdoProductArray[$i]->getSku(), $this->product->getSku());
             $this->assertSame($pdoProductArray[$i]->getTitle(), $this->product->getTitle());
         }
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:29,代码来源:location-test.php

示例3: setProduct

 /**
  * The setter of the field product_id.
  * @param Product $product - the product related to the issue
  */
 public function setProduct(Product $product)
 {
     if ($product == NULL) {
         throw new InvalidArgumentException('[Model\\Issue] Invalid Model\\Product.');
     }
     $this->product_id = $product->getProductId();
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:11,代码来源:Issue.php

示例4: testGetInvalidFinishedProductByRawMaterialId

 /**
  * test grabbing a FinishedProduct by rawMaterialId that does not exist
  **/
 public function testGetInvalidFinishedProductByRawMaterialId()
 {
     // grab an rawMaterialId that does not exist
     $finishedProduct = FinishedProduct::getFinishedProductByRawMaterialId($this->getPDO(), $this->rawMaterial->getProductId());
     foreach ($finishedProduct as $fP) {
         $this->assertNull($fP);
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:11,代码来源:finished-product-test.php

示例5: testPostValidMovement

 /**
  * Test Posting Valid Movement
  **/
 public function testPostValidMovement()
 {
     // create a new Movement
     $newMovement = new Movement(null, $this->fromLocation->getLocationId(), $this->toLocation->getLocationId(), $this->product->getProductId(), $this->unitOfMeasure->getUnitId(), $this->user->getUserId(), $this->VALID_cost, $this->VALID_movementDate, $this->VALID_movementType, $this->VALID_price);
     // run a get request to establish session tokens
     $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/movement/?page=0');
     // grab the data from guzzle and enforce the status' match our expectations
     $response = $this->guzzle->post('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/movement/', ['headers' => ['X-XSRF-TOKEN' => $this->getXsrfToken()], 'json' => $newMovement]);
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $movement = json_decode($body);
     $this->assertSame(200, $movement->status);
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:16,代码来源:movement-api-test.php

示例6: testGetValidProductByAlertId

 /**
  * Test grabbing Valid Product by alertId
  **/
 public function testGetValidProductByAlertId()
 {
     // create a new AlertLevel
     $newAlertLevel = new AlertLevel(null, $this->VALID_alertCode, $this->VALID_alertFrequency, $this->VALID_alertPoint, $this->VALID_alertOperator);
     $newAlertLevel->insert($this->getPDO());
     // create a new ProductAlert
     $newProductAlert = new ProductAlert($newAlertLevel->getAlertId(), $this->product->getProductId(), true);
     $newProductAlert->insert($this->getPDO());
     // grab the data from guzzle
     $response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/alert-level/?alertId=' . $newAlertLevel->getAlertId() . "&getProducts=true");
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $alertLevel = json_decode($body);
     $this->assertSame(200, $alertLevel->status);
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:18,代码来源:alert-level-api-test.php

示例7: testGetValidProductLocationByProductId

 /**
  * test grabbing a ProductLocation by productId
  **/
 public function testGetValidProductLocationByProductId()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("productLocation");
     // create a new ProductLocation and insert to into mySQL
     $productLocation = new ProductLocation($this->location->getLocationId(), $this->product->getProductId(), $this->unitOfMeasure->getUnitId(), $this->VALID_quantity);
     $productLocation->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProductLocation = ProductLocation::getProductLocationByProductId($this->getPDO(), $this->product->getProductId());
     foreach ($pdoProductLocation as $pdoPL) {
         $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("productLocation"));
         $this->assertSame($pdoPL->getLocationId(), $this->location->getLocationId());
         $this->assertSame($pdoPL->getUnitId(), $this->unitOfMeasure->getUnitId());
         $this->assertSame($pdoPL->getQuantity(), $this->VALID_quantity);
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:19,代码来源:product-location-test.php

示例8: testGetValidProductAlertByAlertEnabled

 /**
  * test grabbing a ProductAlert by alertEnabled
  **/
 public function testGetValidProductAlertByAlertEnabled()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("productAlert");
     // create a new ProductAlert and insert to into mySQL
     $productAlert = new ProductAlert($this->alertLevel->getAlertId(), $this->product->getProductId(), $this->VALID_alertEnabled);
     $productAlert->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProductAlert = ProductAlert::getProductAlertByAlertEnabled($this->getPDO(), $productAlert->isAlertEnabled());
     foreach ($pdoProductAlert as $pdoPA) {
         $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("productAlert"));
         $this->assertSame($pdoPA->getAlertId(), $this->alertLevel->getAlertId());
         $this->assertSame($pdoPA->getProductId(), $this->product->getProductId());
         $this->assertSame($pdoPA->isAlertEnabled(), $this->VALID_alertEnabled);
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:19,代码来源:product-alert-test.php

示例9: testGetValidProductByLocationId

 /**
  * Test grabbing Valid Product by LocationId
  **/
 public function testGetValidProductByLocationId()
 {
     // create a new location and insert to into mySQL
     $newLocation = new Location(null, $this->VALID_storageCode, $this->VALID_description);
     $newLocation->insert($this->getPDO());
     $quantity = 5.9;
     // create a new location and insert to into mySQL
     $productLocation = new productLocation($newLocation->getLocationId(), $this->product->getProductId(), $this->unitOfMeasure->getUnitId(), $quantity);
     $productLocation->insert($this->getPDO());
     // grab the data from guzzle
     $response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/location/?locationId=' . $newLocation->getLocationId() . "&getProducts=true");
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $location = json_decode($body);
     echo $body . PHP_EOL;
     $this->assertSame(200, $location->status);
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:20,代码来源:location-api-test.php

示例10: testGetValidAllMovements

 /**
  * test grabbing a Movement by movementType
  **/
 public function testGetValidAllMovements()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("movement");
     // create a new Movement and insert to into mySQL
     $movement = new Movement(null, $this->fromLocation->getLocationId(), $this->toLocation->getLocationId(), $this->product->getProductId(), $this->unitOfMeasure->getUnitId(), $this->user->getUserId(), $this->VALID_cost, $this->VALID_movementDate, $this->VALID_movementType, $this->VALID_price);
     $movement->insert($this->getPDO());
     $page = 1;
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoMovement = Movement::getAllMovements($this->getPDO(), $page);
     foreach ($pdoMovement as $pdoM) {
         $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("movement"));
         $this->assertSame($pdoM->getFromLocationId(), $this->fromLocation->getLocationId());
         $this->assertSame($pdoM->getToLocationId(), $this->toLocation->getLocationId());
         $this->assertSame($pdoM->getProductId(), $this->product->getProductId());
         $this->assertSame($pdoM->getUnitId(), $this->unitOfMeasure->getUnitId());
         $this->assertSame($pdoM->getUserId(), $this->user->getUserId());
         $this->assertSame($pdoM->getCost(), $this->VALID_cost);
         $this->assertEquals($pdoM->getMovementDate(), $this->VALID_movementDate);
         $this->assertSame($pdoM->getMovementType(), $this->VALID_movementType);
         $this->assertSame($pdoM->getPrice(), $this->VALID_price);
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:26,代码来源:movement-test.php

示例11: testDeleteValidProduct

 /**
  * test deleting a valid Product
  **/
 public function testDeleteValidProduct()
 {
     // create a new Product
     $newProduct = new Product(null, $this->vendor->getVendorId(), $this->VALID_description, $this->VALID_leadTime, $this->VALID_sku, $this->VALID_title);
     $newProduct->insert($this->getPDO());
     // grab the data from guzzle and enforce the status' match our expectations
     $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/' . $newProduct->getProductId());
     $response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/' . $newProduct->getProductId(), ['headers' => ['X-XSRF-TOKEN' => $this->getXsrfToken()]]);
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $product = json_decode($body);
     $this->assertSame(200, $product->status);
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:16,代码来源:product-api-test.php

示例12: verifyXsrf

                     }
                 }
             }
         }
     }
     // post to a new Product
 } else {
     if ($method === "POST") {
         // convert POSTed JSON to an object
         verifyXsrf();
         $requestContent = file_get_contents("php://input");
         $requestObject = json_decode($requestContent);
         $product = new Product(null, $requestObject->vendorId, $requestObject->description, $requestObject->leadTime, $requestObject->sku, $requestObject->title);
         $product->insert($pdo);
         unset($reply->data);
         $reply->productId = $product->getProductId();
         $reply->message = "Product created OK";
         // put to an existing Product
     } else {
         if ($method === "PUT") {
             // convert PUTed JSON to an object
             verifyXsrf();
             $requestContent = file_get_contents("php://input");
             $requestObject = json_decode($requestContent);
             $product = new Product($productId, $requestObject->vendorId, $requestObject->description, $requestObject->leadTime, $requestObject->sku, $requestObject->title);
             $product->update($pdo);
             $reply->data = "Product updated OK";
             // delete an existing Product
         } else {
             if ($method === "DELETE") {
                 verifyXsrf();
开发者ID:sandidgec,项目名称:foodinventory,代码行数:31,代码来源:index.php

示例13: testGetValidNotificationsByAlertId

 /**
  * test grabbing an product by alert Id
  **/
 public function testGetValidNotificationsByAlertId()
 {
     // create a new notification and insert to into mySQL
     $notification = new Notification(null, $this->alertLevel->getAlertId(), $this->VALID_emailStatus, $this->VALID_notificationDateTime, $this->VALID_notificationHandle, $this->VALID_notificationContent);
     $notification->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProductArray = Notification::getProductByAlertId($this->getPDO(), $notification->getAlertId());
     for ($i = 0; $i < count($pdoProductArray); $i++) {
         if ($i === 0) {
             $this->assertSame($pdoProductArray[$i]->getAlertId(), $this->alertLevel->getAlertId());
             $this->assertSame($pdoProductArray[$i]->getEmailStatus(), $this->VALID_emailStatus);
             $this->assertEquals($pdoProductArray[$i]->getNotificationDateTime(), $this->VALID_notificationDateTime);
             $this->assertSame($pdoProductArray[$i]->getNotificationHandle(), $this->VALID_notificationHandle);
             $this->assertSame($pdoProductArray[$i]->getNotificationContent(), $this->VALID_notificationContent);
         } else {
             $this->assertSame($pdoProductArray[$i]->getProductId(), $this->product->getProductId());
             $this->assertSame($pdoProductArray[$i]->getVendorId(), $this->product->getVendorId());
             $this->assertSame($pdoProductArray[$i]->getDescription(), $this->product->getDescription());
             $this->assertSame($pdoProductArray[$i]->getSku(), $this->product->getSku());
             $this->assertSame($pdoProductArray[$i]->getTitle(), $this->product->getTitle());
         }
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:26,代码来源:notification-test.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->guzzle = new \GuzzleHttp\Client(['cookies' => true]);
     $this->VALID_notificationDateTime = DateTime::createFromFormat("Y-m-d H:i:s", "2015-09-26 08:45:25");
     $this->INVALID_notificationDateTime = DateTime::createFromFormat("Y-m-d H:i:s", "2015-14-26 06:25:25");
     $alertId = null;
     $alertCode = "33";
     $alertFrequency = "11";
     $alertLevel = "100.01";
     $alertOperator = "1";
     $this->alertLevel = new AlertLevel($alertId, $alertCode, $alertFrequency, $alertLevel, $alertOperator);
     $this->alertLevel->insert($this->getPDO());
     $vendorId = null;
     $contactName = "Trevor Rigler";
     $vendorEmail = "trier@cnm.edu";
     $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());
     $alertId1 = $this->alertLevel->getAlertId();
     $productId1 = $this->product->getProductId();
     $alertEnabled = true;
     $this->productAlert = new ProductAlert($alertId1, $productId1, $alertEnabled);
     $this->productAlert->insert($this->getPDO());
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:34,代码来源:notification-api-test.php

示例15: testGetValidNotificationByProductId

 /**
  * test grabbing product by notification
  **/
 public function testGetValidNotificationByProductId()
 {
     // create a new product and insert to into mySQL
     $product = new Product(null, $this->vendor->getVendorId(), $this->VALID_description, $this->VALID_leadTime, $this->VALID_sku, $this->VALID_title);
     $product->insert($this->getPDO());
     // create a new product and insert to into mySQL
     $productAlert = new ProductAlert($this->alertLevel->getAlertId(), $product->getProductId(), true);
     $productAlert->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoNotificationArray = Product::getNotificationByProductId($this->getPDO(), $product->getProductId());
     for ($i = 0; $i < count($pdoNotificationArray); $i++) {
         if ($i === 0) {
             $this->assertSame($pdoNotificationArray[$i]->getVendorId(), $this->vendor->getVendorId());
             $this->assertSame($pdoNotificationArray[$i]->getDescription(), $this->VALID_description);
             $this->assertSame($pdoNotificationArray[$i]->getLeadTime(), $this->VALID_leadTime);
             $this->assertSame($pdoNotificationArray[$i]->getSku(), $this->VALID_sku);
             $this->assertSame($pdoNotificationArray[$i]->getTitle(), $this->VALID_title);
         } else {
             $this->assertSame($pdoNotificationArray[$i]->getNotificationId(), $this->notification->getNotificationId());
             $this->assertSame($pdoNotificationArray[$i]->getAlertId(), $this->notification->getAlertId());
             $this->assertSame($pdoNotificationArray[$i]->getEmailStatus(), $this->notification->getEmailStatus());
             $this->assertEquals($pdoNotificationArray[$i]->getNotificationDateTime(), $this->notification->getNotificationDateTime());
             $this->assertSame($pdoNotificationArray[$i]->getNotificationHandle(), $this->notification->getNotificationHandle());
             $this->assertSame($pdoNotificationArray[$i]->getNotificationContent(), $this->notification->getNotificationContent());
         }
     }
 }
开发者ID:sandidgec,项目名称:foodinventory,代码行数:30,代码来源:product-test.php


注:本文中的Product::getProductId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。