| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
|---|
| 4 | require_once($HOME . "/tests/class/Common_TestCase.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_Utils::sfGetTimestamp()のテストクラス. |
|---|
| 29 | * |
|---|
| 30 | * |
|---|
| 31 | * @author Hiroko Tamagawa |
|---|
| 32 | * @version $Id$ |
|---|
| 33 | */ |
|---|
| 34 | class SC_Utils_sfGetTimestampTest extends Common_TestCase { |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | protected function setUp() { |
|---|
| 38 | parent::setUp(); |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | protected function tearDown() { |
|---|
| 42 | parent::tearDown(); |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | ///////////////////////////////////////// |
|---|
| 46 | public function testSfGetTimestamp_年が設定されていない場合_0バイト文字列が返る() { |
|---|
| 47 | $year = ''; |
|---|
| 48 | $month = '10'; |
|---|
| 49 | $day = '23'; |
|---|
| 50 | |
|---|
| 51 | $this->expected = ''; |
|---|
| 52 | $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day); |
|---|
| 53 | $this->verify(); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | public function testSfGetTimestamp_月が設定されていない場合_0バイト文字列が返る() { |
|---|
| 57 | $year = '2012'; |
|---|
| 58 | $month = ''; |
|---|
| 59 | $day = '13'; |
|---|
| 60 | |
|---|
| 61 | $this->expected = ''; |
|---|
| 62 | $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day); |
|---|
| 63 | $this->verify(); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | public function testSfGetTimestamp_日が設定されていない場合_0バイト文字列が返る() { |
|---|
| 67 | $year = '1999'; |
|---|
| 68 | $month = '09'; |
|---|
| 69 | $day = ''; |
|---|
| 70 | |
|---|
| 71 | $this->expected = ''; |
|---|
| 72 | $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day); |
|---|
| 73 | $this->verify(); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | public function testSfGetTimestamp_年月日すべて設定されている場合_連結された文字列が返る() { |
|---|
| 77 | $year = '1999'; |
|---|
| 78 | $month = '09'; |
|---|
| 79 | $day = '23'; |
|---|
| 80 | |
|---|
| 81 | $this->expected = '1999-09-23 00:00:00'; |
|---|
| 82 | $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day); |
|---|
| 83 | |
|---|
| 84 | $this->verify(); |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | public function testSfGetTimestamp_最終時刻フラグがONの場合_時刻が深夜のものになる() { |
|---|
| 88 | $year = '1999'; |
|---|
| 89 | $month = '09'; |
|---|
| 90 | $day = '23'; |
|---|
| 91 | |
|---|
| 92 | $this->expected = '1999-09-23 23:59:59'; |
|---|
| 93 | $this->actual = SC_Utils::sfGetTimestamp($year, $month, $day, true); |
|---|
| 94 | |
|---|
| 95 | $this->verify(); |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | ////////////////////////////////////////// |
|---|
| 99 | |
|---|
| 100 | } |
|---|
| 101 | |
|---|