source: branches/version-2_13-dev/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php @ 23651

Revision 23651, 3.9 KB checked in by Seasoft, 9 years ago (diff)

#2631 (「商品登録」「商品登録CSV」での入力必須不整合)

  • 不適切なテストデータを修正
  • Property svn:keywords set to Id Rev Date
Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../../..";
4require_once($HOME . "/tests/class/Common_TestCase.php");
5/*
6 * This file is part of EC-CUBE
7 *
8 * Copyright(c) 2000-2014 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_Utils::sfGetProductClassId()のテストクラス.
29 * TODO del_flgは使わなくて良い??
30 * TODO classcategory_id1とclasscategory_id2を使わないと一意に指定できない。
31 * @author Hiroko Tamagawa
32 * @version $Id$
33 */
34class SC_Utils_sfGetProductClassIdTest extends Common_TestCase
35{
36
37
38  protected function setUp()
39  {
40    parent::setUp();
41    $this->setUpProductsClass();
42  }
43
44  protected function tearDown()
45  {
46    parent::tearDown();
47  }
48
49  /////////////////////////////////////////
50  public function testSfGetProductClassId_存在する製品IDのみを指定した場合_カテゴリ0の対応する製品クラスが取得できる()
51  {
52   
53    $this->expected = '2001';
54    $this->actual = SC_Utils::sfGetProductClassId('2001');
55
56    $this->verify('取得した製品クラス');
57  }
58
59  public function testSfGetProductClassId_存在する製品IDのみを指定してカテゴリ0の製品クラスが存在しなければ_nullが返る()
60  {
61   
62    $this->expected = null;
63    $this->actual = SC_Utils::sfGetProductClassId('1001');
64
65    $this->verify('取得結果が空');
66  }
67
68  public function testSfGetProductClassId_存在する製品IDとカテゴリIDを指定した場合_対応する製品クラスが取得できる()
69  {
70   
71    $this->expected = '1002';
72    $this->actual = SC_Utils::sfGetProductClassId('1001', '2');
73
74    $this->verify('取得した製品クラス');
75  }
76
77  public function testSfGetProductClassId_存在する製品IDと存在しないカテゴリIDを指定した場合_nullが返る()
78  {
79   
80    $this->expected = null;
81    $this->actual = SC_Utils::sfGetProductClassId('1001', '999');
82
83    $this->verify('取得結果が空');
84  }
85
86  public function testSfGetProductClassId_存在しない製品IDを指定した場合_nullが返る()
87  {
88    $this->expected = null;
89    $this->actual = SC_Utils::sfGetProductClassId('9999');
90
91    $this->verify('取得結果が空');
92  }
93
94  //////////////////////////////////////////
95  protected function setUpProductsClass()
96  {
97    $products_class = array(
98      array(
99        'product_class_id' => '2001',
100        'product_id' => '2001',
101        'product_code' => 'code2001',
102        'price02' => '1000',
103        'creator_id' => '1',
104        'update_date' => 'CURRENT_TIMESTAMP'
105      ),
106      array(
107        'product_class_id' => '1001',
108        'product_id' => '1001',
109        'product_code' => 'code1001',
110        'price02' => '1000',
111        'classcategory_id1' => '1',
112        'creator_id' => '1',
113        'update_date' => 'CURRENT_TIMESTAMP'
114      ),
115      array(
116        'product_class_id' => '1002',
117        'product_id' => '1001',
118        'product_code' => 'code1002',
119        'price02' => '1000',
120        'classcategory_id1' => '2',
121        'creator_id' => '1',
122        'update_date' => 'CURRENT_TIMESTAMP'
123      )
124    );
125
126    $this->objQuery->delete('dtb_products_class');
127    foreach ($products_class as $item)
128{
129      $this->objQuery->insert('dtb_products_class', $item);
130    }
131  }
132}
133
Note: See TracBrowser for help on using the repository browser.