source: branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php @ 22567

Revision 22567, 2.8 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

  • Property svn:keywords set to Id Rev Date
Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../../..";
4require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php");
5/*
6 * This file is part of EC-CUBE
7 *
8 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
9 *
10 * http://www.lockon.co.jp/
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 */
26
27/**
28 * SC_Helper_Purchase::setShipmentItemTemp()のテストクラス.
29 * 【注意】dtb_baseinfoはインストール時に入るデータをそのまま使用
30 *
31 * @author Hiroko Tamagawa
32 * @version $Id$
33 */
34class SC_Helper_Purchase_setShipmentItemTempTest extends SC_Helper_Purchase_TestBase
35{
36  private $helper;
37
38  protected function setUp()
39  {
40    parent::setUp();
41    $this->setUpProductClass();
42    $this->setUpProducts();
43
44    $_SESSION['shipping']['1001']['shipment_item'] = array(
45      '1001' => array('productsClass' => array('price02' => 9000))
46    );
47    $this->helper = new SC_Helper_Purchase();
48  }
49
50  protected function tearDown()
51  {
52    parent::tearDown();
53  }
54
55  /////////////////////////////////////////
56  public function testSetShipmentItemTemp_製品情報が既に存在する場合_存在する情報が価格に反映される()
57  {
58    $this->helper->setShipmentItemTemp('1001', '1001', 10);
59
60    $this->expected = array(
61      'shipping_id' => '1001',
62      'product_class_id' => '1001',
63      'quantity' => 10,
64      'price' => 9000,
65      'total_inctax' => 94500.0,
66      'productsClass' => array('price02' => 9000)
67    );
68    $this->actual = $_SESSION['shipping']['1001']['shipment_item']['1001'];
69
70    $this->verify();
71  }
72
73  public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映される()
74  {
75    $this->helper->setShipmentItemTemp('1001', '1002', 10);
76
77    $this->expected = array(
78      'shipping_id' => '1001',
79      'product_class_id' => '1002',
80      'quantity' => 10,
81      'price' => '2500',
82      'total_inctax' => 26250.0
83    );
84    $result = $_SESSION['shipping']['1001']['shipment_item']['1002'];
85    unset($result['productsClass']);
86    $this->actual = $result;
87
88    $this->verify();
89  }
90
91  //////////////////////////////////////////
92
93}
94
Note: See TracBrowser for help on using the repository browser.