本文整理汇总了PHP中Notification::getAlertId方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::getAlertId方法的具体用法?PHP Notification::getAlertId怎么用?PHP Notification::getAlertId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::getAlertId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetValidProductByAlertId
/**
* test grabbing valid product by alertId
**/
public function testGetValidProductByAlertId()
{
// create a new notification and insert to into mySQL
$newNotification = new Notification(null, $this->alertLevel->getAlertId(), $this->VALID_emailStatus, $this->VALID_notificationDateTime, $this->VALID_notificationHandle, $this->VALID_notificationContent);
$newNotification->insert($this->getPDO());
// grab the data from guzzle
$response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~invtext/backend/php/api/notification/?alertId=' . $newNotification->getAlertId());
$this->assertSame($response->getStatusCode(), 200);
$body = $response->getBody();
$notification = json_decode($body);
$this->assertSame(200, $notification->status);
}
示例2: 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());
}
}
}
示例3: 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());
}
}
}