1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../.."; |
---|
4 | require_once($HOME . "/tests/class/SC_Product/SC_Product_TestBase.php"); |
---|
5 | /** |
---|
6 | * |
---|
7 | */ |
---|
8 | class SC_Product_findProductsOrderTest extends SC_Product_TestBase { |
---|
9 | |
---|
10 | protected function setUp() { |
---|
11 | parent::setUp(); |
---|
12 | $this->objProducts = new SC_Product_Ex(); |
---|
13 | } |
---|
14 | |
---|
15 | protected function tearDown() { |
---|
16 | parent::tearDown(); |
---|
17 | } |
---|
18 | |
---|
19 | ///////////////////////////////////////// |
---|
20 | |
---|
21 | public function testFindProductIdsOrder_商品ID降順() { |
---|
22 | $this->setUpProductClass(); |
---|
23 | $this->setUpProducts(); |
---|
24 | $this->setUpClassCategory(); |
---|
25 | |
---|
26 | // 商品ID降順で商品IDを取得する |
---|
27 | $this->objQuery->setOrder('product_id DESC'); |
---|
28 | $this->expected = array('2001','1002', '1001'); |
---|
29 | |
---|
30 | $this->actual = $this->objProducts->findProductIdsOrder($this->objQuery); |
---|
31 | |
---|
32 | $this->verify('商品ID降順'); |
---|
33 | } |
---|
34 | |
---|
35 | public function testFindProductIdsOrder_商品名昇順() { |
---|
36 | $this->setUpProductClass(); |
---|
37 | $this->setUpProducts(); |
---|
38 | $this->setUpClassCategory(); |
---|
39 | |
---|
40 | // 商品名昇順で商品IDを取得する |
---|
41 | $this->objQuery->setOrder('product_id ASC'); |
---|
42 | $this->expected = array('1001', '1002','2001'); |
---|
43 | |
---|
44 | $this->actual = $this->objProducts->findProductIdsOrder($this->objQuery); |
---|
45 | |
---|
46 | $this->verify('商品ID昇順'); |
---|
47 | } |
---|
48 | |
---|
49 | public function testFindProductIdsOrder_arrOrderDataの設定による並び順() { |
---|
50 | $this->setUpProductClass(); |
---|
51 | $this->setUpProducts(); |
---|
52 | $this->setUpClassCategory(); |
---|
53 | |
---|
54 | // setProductsOrderを行う |
---|
55 | $this->objProducts->setProductsOrder('product_id'); |
---|
56 | $this->expected = array('1001', '1002','2001'); |
---|
57 | |
---|
58 | $this->actual = $this->objProducts->findProductIdsOrder($this->objQuery); |
---|
59 | |
---|
60 | $this->verify('arrOrderData設定順'); |
---|
61 | } |
---|
62 | |
---|
63 | } |
---|