本文整理汇总了PHP中Location::getLocationId方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::getLocationId方法的具体用法?PHP Location::getLocationId怎么用?PHP Location::getLocationId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::getLocationId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: testGetValidUnitOfMeasureByProductId
/**
* Test grabbing Valid UnitOfMeasure by productId
**/
public function testGetValidUnitOfMeasureByProductId()
{
// 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());
// create a new ProductLocation
$quantity = 1.5;
$newProductLocation = new ProductLocation($this->location->getLocationId(), $newProduct->getProductId(), $this->unitOfMeasure->getUnitId(), $quantity);
$newProductLocation->insert($this->getPDO());
// grab the data from guzzle
$response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/product/?productId=' . $newProduct->getProductId() . "&getUnitOfMeasure=true");
$this->assertSame($response->getStatusCode(), 200);
$body = $response->getBody();
$product = json_decode($body);
$this->assertSame(200, $product->status);
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: testPutValidLocation
/**
* test ability to Put valid location
**/
public function testPutValidLocation()
{
// create a new Location
$newLocation = new Location(null, $this->VALID_storageCode, $this->VALID_description);
$newLocation->insert($this->getPDO());
// run a get request to establish session tokens
$this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/location/');
// grab the data from guzzle and enforce the status' match our expectations
$response = $this->guzzle->put('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/location/' . $newLocation->getLocationId(), ['headers' => ['X-XSRF-TOKEN' => $this->getXsrfToken()], 'json' => $newLocation]);
$this->assertSame($response->getStatusCode(), 200);
$body = $response->getBody();
$location = json_decode($body);
$this->assertSame(200, $location->status);
}
示例6: history
private function history()
{
$current_location = new Location($this->getLocationId());
$current_location->build();
db_insert('location_history')->fields(array('locationid' => $current_location->getLocationId(), 'name' => $current_location->getName(), 'address' => $current_location->getAddress(), 'address2' => $current_location->getAddress2(), 'city' => $current_location->getCity(), 'state' => $current_location->getState(), 'zip' => $current_location->getZip(), 'saved_userid' => $current_location->getSavedUserID(), 'saved_datetime' => $current_location->getSavedDateTime(), 'history_userid' => $this->getSavedUserID(), 'history_datetime' => $this->getSavedDateTime()))->execute();
}
示例7: 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());
}
}
}
示例8: testGetValidUnitOfMeasurementByProductId
/**
* test grabbing unit of measure by the product id
**/
public function testGetValidUnitOfMeasurementByProductId()
{
// 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());
$quantity = 5.9;
// create a new product and insert to into mySQL
$productLocation = new ProductLocation($this->location->getLocationId(), $product->getProductId(), $this->unitOfMeasure->getUnitId(), $quantity);
$productLocation->insert($this->getPDO());
// grab the data from mySQL and enforce the fields match our expectations
$pdoUnitOfMeasureArray = Product::getUnitOfMeasureByProductId($this->getPDO(), $product->getProductId());
for ($i = 0; $i < count($pdoUnitOfMeasureArray); $i++) {
if ($i === 0) {
$this->assertSame($pdoUnitOfMeasureArray[$i]->getVendorId(), $this->vendor->getVendorId());
$this->assertSame($pdoUnitOfMeasureArray[$i]->getDescription(), $this->VALID_description);
$this->assertSame($pdoUnitOfMeasureArray[$i]->getLeadTime(), $this->VALID_leadTime);
$this->assertSame($pdoUnitOfMeasureArray[$i]->getSku(), $this->VALID_sku);
$this->assertSame($pdoUnitOfMeasureArray[$i]->getTitle(), $this->VALID_title);
} else {
$this->assertSame($pdoUnitOfMeasureArray[$i]->getUnitId(), $this->unitOfMeasure->getUnitId());
$this->assertSame($pdoUnitOfMeasureArray[$i]->getUnitCode(), $this->unitOfMeasure->getUnitCode());
$this->assertSame($pdoUnitOfMeasureArray[$i]->getQuantity(), $this->unitOfMeasure->getQuantity());
}
}
}
示例9: update
public function update(Location $loc)
{
$query = "UPDATE `location` SET `location_name`='" . $loc->getLocationName() . "',`location_city`='" . $loc->getLocationCity() . "',`longitude`='" . $loc->getLongitude() . "',`latitude`='" . $loc->getLatitude() . "',`altitude`='" . $loc->getAltitude() . "' WHERE `idlocation`='" . $loc->getLocationId() . "'";
$this->con->openConnection();
$this->con->executeRawQuery($query);
$this->con->closeConnection();
}