forked from pocketsave/bestbuy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestCase.php
44 lines (27 loc) · 1003 Bytes
/
TestCase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
//This is a test case script for testing the functionality.
include 'BestBuyProcessor/BB_MinPriceCalculator.php';
include 'Product.php';
// We actually provide array of prices to _comparePricesForLeast() from E-commerce APIs.
//There will be separate code to group all prices into a single array from different API providers
$MinPriceObj = new BB_MinPriceCalculator();
$prices=array(5,2, 3, 1, 6, 7);
$min= $MinPriceObj->_compareForLeast($prices);
echo $min;
//This is for product class functions test.
$product = new Product();
$disc=5;
echo $product->setDiscOnMinPurchase($disc);
echo $product->getDiscOnMinPurchase();
// _hasCashBack function test..Currently this is failing but will correct soon.
$cashback=8;
echo $product->setCashback($cashback);
echo $product->_hasCashback();
//Array of colours of product test
$array_of_color = array(5,2,1);
$product->setColor($array_of_color);
$arry= $product->getColor();
foreach($arry as $colr) {
printf("$colr\n");
}
?>