[Svn-src-all:3239] [version-2_12-dev 22140] #1977 SC_Utilsの単体テストを追加(※定数を変更している箇所は、まとめてテストするとfailしてしまうので要調整)
shift_hiroko.tamagawa
admin @ mail.ec-cube.net
2012年 12月 16日 (日) 19:02:03 JST
Subversion committed to /home/svn/open 22140
http://svn.ec-cube.net/open_trac/changeset/22140
┌────────────────────────────┐
│更新者 : shift_hiroko.tamagawa │
│更新日時: 2012-12-16 19:02:02 +0900 (日, 16 12月 2012)│
└────────────────────────────┘
Log:
--------------------------------------------------------
#1977 SC_Utilsの単体テストを追加(※定数を変更している箇所は、まとめてテストするとfailしてしまうので要調整)
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_encodeRFC3986Test.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getHash2ArrayTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isBlankTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonDecodeTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonEncodeTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDBDateToTimeTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDispDBDateTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetAddPointTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetBrothersArrayTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetCheckedTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetEnabledTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetErrorColorTest.php
U branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetRandomStringTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetSearchPageMaxTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUniqRandomIdTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMbConvertEncodingTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMultiplyTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainListTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfRmDupSlashTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSetErrorStyleTest.php
A branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_encodeRFC3986Test.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_encodeRFC3986Test.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_encodeRFC3986Test.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,57 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::encodeRFC3986()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_encodeRFC3986Test extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testEncodeRFC3986_チルダが含まれる場合_エンコードされない() {
+ $input = 'http://www.example.co.jp/~';
+ $this->expected = 'http%3A%2F%2Fwww.example.co.jp%2F~';
+ $this->actual = SC_Utils::encodeRFC3986($input);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_encodeRFC3986Test.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getHash2ArrayTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getHash2ArrayTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getHash2ArrayTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,66 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::getHash2Array()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_getHash2ArrayTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ parent::setUp();
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testGetHash2Array_必須キー指定がない場合_値のみの配列が返る() {
+ $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
+ $this->expected = array('りんご', 'バナナ', 'オレンジ');
+ $this->actual = SC_Utils::getHash2Array($input_array);
+
+ $this->verify();
+ }
+
+ public function testGetHash2Array_必須キー指定がある場合_指定キーの値のみの配列が返る() {
+ $input_array = array('apple' => 'りんご', 'banana' => 'バナナ', 'orange' => 'オレンジ');
+ $requires = array('banana', 'apple');
+ $this->expected = array('りんご', 'バナナ');
+ $this->actual = SC_Utils::getHash2Array($input_array, $requires);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_getHash2ArrayTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,75 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::isAbsoluteRealPath()のテストクラス.
+ * テスト用にOSの環境変数を定義することができないため、テストコード内で分岐します.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_Test extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testIsAbsoluteRealPath_絶対パスの場合_trueが返る() {
+
+ if (strpos(PHP_OS, 'WIN')) {
+ $input = 'C:/Program Files/username/hoge/hoge.txt';
+ } else {
+ $input = '/etc/php.ini';
+ }
+ $this->expected = true;
+ $this->actual = SC_Utils::isAbsoluteRealPath($input);
+
+ $this->verify();
+ }
+
+ public function testIsAbsoluteRealPath_相対パスの場合_trueが返る() {
+
+ if (strpos(PHP_OS, 'WIN')) {
+ $input = './system32/hoge/hoge.txt';
+ } else {
+ $input = '../etc/php.ini';
+ }
+ $this->expected = false;
+ $this->actual = SC_Utils::isAbsoluteRealPath($input);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,84 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// テスト用に定数を定義
+define('HTTP_URL', 'http://sample.eccube.jp/');
+define('HTTPS_URL', 'https://sample.eccube.jp/');
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::isAppInnerUrl()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_isAppInnerUrlTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() {
+ $input = 'http://sample.eccube.jp/admin/';
+ $this->expected = true;
+ $this->actual = SC_Utils::isAppInnerUrl($input);
+
+ $this->verify();
+ }
+
+ public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() {
+ $input = 'http://outside.eccube.jp/admin/';
+ $this->expected = false;
+ $this->actual = SC_Utils::isAppInnerUrl($input);
+
+ $this->verify();
+ }
+
+ public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() {
+ $input = 'https://sample.eccube.jp/admin/';
+ $this->expected = true;
+ $this->actual = SC_Utils::isAppInnerUrl($input);
+
+ $this->verify();
+ }
+
+ public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() {
+ $input = 'https://outside.eccube.jp/admin/';
+ $this->expected = false;
+ $this->actual = SC_Utils::isAppInnerUrl($input);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isBlankTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isBlankTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isBlankTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,129 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::isBlank()のテストクラス.
+ * 元々test/class/以下にあったテストを移行しています.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_isBlankTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testIsBlank_0バイト文字列の場合_trueが返る() {
+ $input = '';
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_全角スペースの場合_trueが返る() {
+ $input = ' ';
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_greedy指定なしで全角スペースの場合_falseが返る() {
+ $input = ' ';
+ $this->assertFalse(SC_Utils::isBlank($input, false), $input);
+ }
+
+ public function testIsBlank_空の配列の場合_trueが返る() {
+ $input = array();
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_ネストした配列の場合_trueが返る() {
+ $input = array(array(array()));
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_greedy指定なしでネストした配列の場合_falseが返る() {
+ $input = array(array(array()));
+ $this->assertFalse(SC_Utils::isBlank($input, false), $input);
+ }
+
+ public function testIsBlank_空でない配列の場合_falseが返る() {
+ $input = array(array(array('1')));
+ $this->assertFalse(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_greedy指定なしで空でない配列の場合_falseが返る() {
+ $input = array(array(array('1')));
+ $this->assertFalse(SC_Utils::isBlank($input, false), $input);
+ }
+
+ public function testIsBlank_全角スペースと空白の組み合わせの場合_trueが返る() {
+ $input = " \n ";
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_greedy指定なしで全角スペースと空白の組み合わせの場合_falseが返る() {
+ $input = " \n ";
+ $this->assertFalse(SC_Utils::isBlank($input, false), $input);
+ }
+
+ public function testIsBlank_全角スペースと非空白の組み合わせの場合_falseが返る() {
+ $input = ' A ';
+ $this->assertFalse(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_greedy指定なしで全角スペースと非空白の組み合わせの場合_falseが返る() {
+ $input = ' A ';
+ $this->assertFalse(SC_Utils::isBlank($input, false), $input);
+ }
+
+ public function testIsBlank_数値のゼロを入力した場合_falseが返る() {
+ $input = 0;
+ $this->assertFalse(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_値が空の配列を入力した場合_trueが返る() {
+ $input = array("");
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_すべてのホワイトスペースを並べた場合_trueが返る() {
+ $input = " \t \n\r\x0B\0";
+ $this->assertTrue(SC_Utils::isBlank($input), $input);
+ }
+
+ public function testIsBlank_通常の文字が含まれている場合_falseが返る() {
+ $input = " AB \n\t";
+ $this->assertFalse(SC_Utils::isBlank($input), $input);
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_isBlankTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonDecodeTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonDecodeTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonDecodeTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,63 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::jsonDecode()のテストクラス.
+ * 環境によるfunctionの変更まではカバーできないため、簡単な出力のみテスト.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_jsonDecodeTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testJsonDecode__JSON形式にエンコードされた文字列からarrayに変換される() {
+ $input = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
+
+ $obj = new stdClass;
+ $obj->a = 1;
+ $obj->b = 2;
+ $obj->c = 3;
+ $obj->d = 4;
+ $obj->e = 5;
+ $this->expected = $obj;
+ $this->actual = SC_Utils::jsonDecode($input);
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonDecodeTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonEncodeTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonEncodeTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonEncodeTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,57 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::jsonEncode()のテストクラス.
+ * 環境によるfunctionの変更まではカバーできないため、簡単な出力のみテスト.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_jsonEncodeTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testJsonEncode__JSON形式にエンコードされた文字列が返る() {
+ $input = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
+ $this->expected = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
+ $this->actual = SC_Utils::jsonEncode($input);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_jsonEncodeTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,89 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfArrCombine()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfArrCombineTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfArrCombine_入力の配列が空の場合_結果も空になる() {
+ $keys = array();
+ $values = array();
+
+ $this->expected = array();
+ $this->actual = SC_Utils::sfArrCombine($keys, $values);
+
+ $this->verify();
+ }
+
+ // TODO 要確認 キーの方が短い場合はエラーで良いのでは?
+ public function testSfArrCombine_入力のキー配列の方が短い場合_余った値の配列の要素は無視される() {
+ $keys = array('apple', 'banana');
+ $values = array('りんご', 'バナナ', 'オレンジ', '梨');
+
+ $this->expected = array(
+ 'apple' => 'りんご',
+ 'banana' => 'バナナ',
+ null => '梨'
+ );
+ $this->actual = SC_Utils::sfArrCombine($keys, $values);
+
+ $this->verify();
+ }
+
+ public function testSfArrCombine_入力のキー配列の方が長い場合_余ったキーの配列の要素は空になる() {
+ $keys = array('apple', 'banana', 'orange', 'pear');
+ $values = array('りんご', 'バナナ');
+
+ $this->expected = array(
+ 'apple' => 'りんご',
+ 'banana' => 'バナナ',
+ 'orange' => null,
+ 'pear' => null
+ );
+ $this->actual = SC_Utils::sfArrCombine($keys, $values);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDBDateToTimeTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDBDateToTimeTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDBDateToTimeTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,65 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfDBDatetoTime()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfDBDatetoTimeTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfDbDatetoTime_時刻にマイクロ秒が含まれている場合_マイクロ秒を無視して変換できる() {
+
+ $this->expected = mktime(10, 20, 30, 10, 31, 2012);
+ $this->actual = SC_Utils::sfDbDatetoTime('2012-10-31 10:20:30.000002');
+
+ $this->verify();
+ }
+
+ public function testSfDbDatetoTime_時刻にマイクロ秒が含まれていない場合_そのまま変換できる() {
+
+ $this->expected = mktime(10, 20, 30, 10, 31, 2012);
+ $this->actual = SC_Utils::sfDbDatetoTime('2012-10-31 10:20:30');
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDBDateToTimeTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDispDBDateTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDispDBDateTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDispDBDateTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,90 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfDispDBDate()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfDispDBDateTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ parent::setUp();
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfDispDBDate_年が指定されていない場合_0バイト文字列が返る() {
+ $dbdate = '-01-23 01:12:24';
+
+ $this->expected = '';
+ $this->actual = SC_Utils::sfDispDBDate($dbdate);
+
+ $this->verify();
+ }
+ public function testSfDispDBDate_月が指定されていない場合_0バイト文字列が返る() {
+ $dbdate = '2012--23 01:12:24';
+
+ $this->expected = '';
+ $this->actual = SC_Utils::sfDispDBDate($dbdate);
+
+ $this->verify();
+ }
+ public function testSfDispDBDate_日が指定されていない場合_0バイト文字列が返る() {
+ $dbdate = '2012-01- 01:12:24';
+
+ $this->expected = '';
+ $this->actual = SC_Utils::sfDispDBDate($dbdate);
+
+ $this->verify();
+ }
+ public function testSfDispDBDate_年月日すべて存在する場合_フォーマット済み文字列が返る() {
+ $dbdate = '2012-1-23 1:12:24';
+
+ $this->expected = '2012/01/23 01:12';
+ $this->actual = SC_Utils::sfDispDBDate($dbdate);
+
+ $this->verify();
+ }
+ public function testSfDispDBDate_時刻表示フラグがOFFの場合_時刻なしのフォーマット済み文字列が返る() {
+ $dbdate = '2012-1-23 1:12:24';
+
+ $this->expected = '2012/01/23';
+ $this->actual = SC_Utils::sfDispDBDate($dbdate, false);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfDispDBDateTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetAddPointTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetAddPointTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetAddPointTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,71 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetAddPoint()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetAddPointTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ parent::setUp();
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfGetAddPoint_計算結果が正になる場合_値がそのまま返る() {
+ $totalpoint = 100;
+ $use_point = 2000;
+ $point_rate = 4;
+
+ $this->expected = 20;
+ $this->actual = SC_Utils::sfGetAddPoint($totalpoint, $use_point, $point_rate);
+
+ $this->verify();
+ }
+
+ public function testSfGetAddPoint_計算結果が負になる場合_0が返る() {
+ $totalpoint = 70;
+ $use_point = 2000;
+ $point_rate = 4;
+
+ $this->expected = 0;
+ $this->actual = SC_Utils::sfGetAddPoint($totalpoint, $use_point, $point_rate);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetAddPointTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetBrothersArrayTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetBrothersArrayTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetBrothersArrayTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,67 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetBrothersArray()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetBrothersArrayTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfGetBrothersArray__与えられたIDの兄弟要素だけが抽出される() {
+ $input_array = array(
+ array('parent_id' => '1001', 'child_id' => '1001001'),
+ array('parent_id' => '1002', 'child_id' => '1002001'),
+ array('parent_id' => '1002', 'child_id' => '1002002'),
+ array('parent_id' => '1003', 'child_id' => '1003001'),
+ array('parent_id' => '1004', 'child_id' => '1004001')
+ );
+ $this->expected = array('1002001', '1002002', '1004001');
+ $this->actual = SC_Utils::sfGetBrothersArray(
+ $input_array,
+ 'parent_id',
+ 'child_id',
+ array('1002001', '1004001')
+ );
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetBrothersArrayTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetCheckedTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetCheckedTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetCheckedTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,63 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetChecked()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetCheckedTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfGetChecked_引数が一致する場合_チェック済みの文字列が返る() {
+ $this->expected = 'checked="checked"';
+ $this->actual = SC_Utils::sfGetChecked('1', '1');
+
+ $this->verify();
+ }
+
+ public function testSfGetChecked_引数が一致しない場合_0バイト文字列が返る() {
+ $this->expected = '';
+ $this->actual = SC_Utils::sfGetChecked('2', '1');
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetCheckedTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetEnabledTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetEnabledTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetEnabledTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,68 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// テスト用に背景色を設定
+define('ERR_COLOR', 'blue');
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetEnabled()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetEnabledTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ // TODO 要確認 実際には使われていない?
+ public function testSfGetEnabled_falseを指定した場合_無効化するための文字列が返る() {
+
+ $this->expected = ' disabled="disabled"';
+ $this->actual = SC_Utils::sfGetEnabled(false);
+
+ $this->verify();
+ }
+
+ public function testSfGetEnabled_trueを指定した場合_0バイト文字列が返る() {
+
+ $this->expected = '';
+ $this->actual = SC_Utils::sfGetEnabled(true);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetEnabledTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetErrorColorTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetErrorColorTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetErrorColorTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,68 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// テスト用に背景色を設定
+define('ERR_COLOR', 'blue');
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetErrorColor()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetErrorColorTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ // TODO 要確認 実際には使われていない?
+ public function testSfGetErrorColor_引数が空でない場合_背景色変更用の文字列が返る() {
+
+ $this->expected = 'background-color:blue';
+ $this->actual = SC_Utils::sfGetErrorColor('value');
+
+ $this->verify();
+ }
+
+ public function testSfGetErrorColor_引数が空の場合_0バイト文字列が返る() {
+
+ $this->expected = '';
+ $this->actual = SC_Utils::sfGetErrorColor();
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetErrorColorTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
変更: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetRandomStringTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetRandomStringTest.php 2012-12-16 02:18:18 UTC (rev 22139)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetRandomStringTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -5,7 +5,7 @@
/**
*
*/
-class SC_Utils_Test extends Common_TestCase {
+class SC_Utils_sfGetRandomStringTest extends Common_TestCase {
protected function setUp() {
parent::setUp();
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetSearchPageMaxTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetSearchPageMaxTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetSearchPageMaxTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,83 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// テスト用に定数を指定
+define('SEARCH_PMAX', 20);
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetSearchPageMax()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetSearchPageMaxTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfGetSearchPageMax_正の整数が指定されている場合_指定の値が返る() {
+
+ $this->expected = 100;
+ $this->actual = SC_Utils::sfGetSearchPageMax(100);
+
+ $this->verify();
+ }
+
+ public function testSfGetSearchPageMax_正の小数が指定されている場合_整数に変換される() {
+
+ $this->expected = 99;
+ $this->actual = SC_Utils::sfGetSearchPageMax(99.5);
+
+ $this->verify();
+ }
+
+ public function testSfGetSearchPageMax_負の数が指定されている場合_デフォルト値が返る() {
+
+ $this->expected = 20;
+ $this->actual = SC_Utils::sfGetSearchPageMax(-50);
+
+ $this->verify();
+ }
+
+ public function testSfGetSearchPageMax_指定がない場合_デフォルト値が返る() {
+
+ $this->expected = 20;
+ $this->actual = SC_Utils::sfGetSearchPageMax();
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetSearchPageMaxTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,67 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetUnderChildrenArray()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetUnderChildrenArrayTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfGetUnderChildrenArray__与えられた親IDを持つ要素だけが抽出される() {
+ $input_array = array(
+ array('parent_id' => '1001', 'child_id' => '1001001'),
+ array('parent_id' => '1002', 'child_id' => '1002001'),
+ array('parent_id' => '1002', 'child_id' => '1002002'),
+ array('parent_id' => '1003', 'child_id' => '1003001'),
+ array('parent_id' => '1004', 'child_id' => '1004001')
+ );
+ $this->expected = array('1002001', '1002002');
+ $this->actual = SC_Utils::sfGetUnderChildrenArray(
+ $input_array,
+ 'parent_id',
+ 'child_id',
+ '1002'
+ );
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUniqRandomIdTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUniqRandomIdTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUniqRandomIdTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,70 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfGetUniqRandomId()のテストクラス.
+ * ランダムな生成結果をすべてテストすることはできないため,
+ * 文字数とランダム性のみをチェックする.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfGetUniqRandomIdTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function test_prefix指定が無い場合_21文字のランダムな文字列が生成される() {
+ $output1 = SC_Utils::sfGetUniqRandomId();
+ $output2 = SC_Utils::sfGetUniqRandomId();
+
+ $this->assertEquals(21, strlen($output1), '文字列1の長さ');
+ $this->assertEquals(21, strlen($output2), '文字列2の長さ');
+ $this->assertNotEquals($output1, $output2, '生成結果がランダムになる');
+ }
+
+ public function test_prefix指定がある場合_prefixのあとに21文字のランダムな文字列が生成される() {
+ $output1 = SC_Utils::sfGetUniqRandomId('hello');
+ $output2 = SC_Utils::sfGetUniqRandomId('hello');
+
+ $this->assertEquals(26, strlen($output1), '文字列1の長さ');
+ $this->assertEquals('hello', substr($output1, 0, 5), 'prefix1');
+ $this->assertEquals(26, strlen($output2), '文字列2の長さ');
+ $this->assertEquals('hello', substr($output2, 0, 5), 'prefix2');
+ $this->assertNotEquals($output1, $output2, '生成結果がランダムになる');
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfGetUniqRandomIdTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMbConvertEncodingTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMbConvertEncodingTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMbConvertEncodingTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,63 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfMbConvertEncoding()のテストクラス.
+ * functionを1つ呼び出しているだけなので、エラーにならないことだけ確認する.
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfMbConvertEncodingTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfMbConvertEncoding_MS932の場合_エラーが起きない() {
+ $input = 'あいうえお、今日は良い天気です。';
+ $encode = 'MS932';
+
+ $this->assertNotNull(SC_Utils::sfMbConvertEncoding($input, $encode), '変換結果');
+ }
+
+ public function testSfMbConvertEncoding_UTF8の場合_エラーが起きない() {
+ $input = 'あいうえお、今日は良い天気です。';
+ $encode = 'UTF8';
+
+ $this->assertNotNull(SC_Utils::sfMbConvertEncoding($input, $encode), '変換結果');
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMbConvertEncodingTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMultiplyTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMultiplyTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMultiplyTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,56 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfMultiply()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfMultiplyTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ parent::setUp();
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfMultiply__掛け算の結果が返る() {
+ $this->expected = 520;
+ $this->actual = SC_Utils::sfMultiply(13, 40);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfMultiplyTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainListTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainListTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainListTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,70 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfNoImageMainList()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfNoImageMainListTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfNoImageMainList_ファイル名が空の場合_デフォルトのファイル名が返る() {
+ $this->expected = 'noimage_main_list.jpg';
+ $this->actual = SC_Utils::sfNoImageMainList('');
+
+ $this->verify();
+ }
+
+ public function testSfNoImageMainList_ディレクトリが指定されている場合_そのディレクトリ以下でデフォルトのファイル名が返る() {
+ $this->expected = 'aaa/bbb/noimage_main_list.jpg';
+ $this->actual = SC_Utils::sfNoImageMainList('aaa/bbb/');
+
+ $this->verify();
+ }
+
+ public function testSfNoImageMainList_ファイル名が指定されている場合_指定されたファイル名が返る() {
+ $this->expected = 'aaa/bbb/ccc.png';
+ $this->actual = SC_Utils::sfNoImageMainList('aaa/bbb/ccc.png');
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainListTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,70 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfNoImageMain()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfNoImageMainTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfNoImageMain_ファイル名が空の場合_デフォルトのファイル名が返る() {
+ $this->expected = 'noimage_main.png';
+ $this->actual = SC_Utils::sfNoImageMain('');
+
+ $this->verify();
+ }
+
+ public function testSfNoImageMain_ディレクトリが指定されている場合_そのディレクトリ以下でデフォルトのファイル名が返る() {
+ $this->expected = 'aaa/bbb/noimage_main.png';
+ $this->actual = SC_Utils::sfNoImageMain('aaa/bbb/');
+
+ $this->verify();
+ }
+
+ public function testSfNoImageMain_ファイル名が指定されている場合_指定されたファイル名が返る() {
+ $this->expected = 'aaa/bbb/ccc.png';
+ $this->actual = SC_Utils::sfNoImageMain('aaa/bbb/ccc.png');
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfNoImageMainTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,97 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// テスト用にデフォルトの丸め方法を指定
+define('POINT_RULE', 1); // 四捨五入
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfPrePoint()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfPrePointTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfPrePoint_四捨五入の設定の場合_四捨五入された値が返る() {
+ $rule = 1; // 四捨五入
+
+ $this->expected = 10;
+ $this->actual = SC_Utils::sfPrePoint(100, 9.5, $rule);
+
+ $this->verify();
+ }
+
+ public function testSfPrePoint_切り捨ての設定の場合_切り捨てされた値が返る() {
+ $rule = 2; // 切り捨て
+
+ $this->expected = 9;
+ $this->actual = SC_Utils::sfPrePoint(100, 9.5, $rule);
+
+ $this->verify();
+ }
+
+ public function testSfPrePoint_切り上げの設定の場合_切り上げされた値が返る() {
+ $rule = 3; // 切り上げ
+
+ $this->expected = 10;
+ $this->actual = SC_Utils::sfPrePoint(100, 9.4, $rule);
+
+ $this->verify();
+ }
+
+ public function testSfPrePoint_存在しない選択肢の場合_切り上げされた値が返る() {
+ $rule = 4; // 存在しない選択肢
+
+ $this->expected = 10;
+ $this->actual = SC_Utils::sfPrePoint(100, 9.4, $rule);
+
+ $this->verify();
+ }
+
+ public function testSfPrePoint_丸め方法の指定がない場合_定数で指定された値が使われる() {
+ $this->expected = array(9, 10);
+ $this->actual = array(
+ SC_Utils::sfPrePoint(100, 9.4),
+ SC_Utils::sfPrePoint(100, 9.5)
+ );
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfRmDupSlashTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfRmDupSlashTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfRmDupSlashTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,73 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfRmDupSlash()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfRmDupSlashTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfRmDupSlash_非SSLの場合_スキーマ部分以外の重複スラッシュが1つになる() {
+ $input = 'http://www.example.co.jp///aaa//bb/co.php';
+ $this->expected = 'http://www.example.co.jp/aaa/bb/co.php';
+ $this->actual = SC_Utils::sfRmDupSlash($input);
+
+ $this->verify();
+ }
+
+ public function testSfRmDupSlash_SSLの場合_スキーマ部分以外の重複スラッシュが1つになる() {
+ $input = 'https://www.example.co.jp///aaa//bb/co.php';
+ $this->expected = 'https://www.example.co.jp/aaa/bb/co.php';
+ $this->actual = SC_Utils::sfRmDupSlash($input);
+
+ $this->verify();
+ }
+
+ public function testSfRmDupSlash_上記以外の場合_すべての重複スラッシュが1つになる() {
+ $input = 'hoge//www.example.co.jp///aaa//bb/co.php';
+ $this->expected = 'hoge/www.example.co.jp/aaa/bb/co.php';
+ $this->actual = SC_Utils::sfRmDupSlash($input);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfRmDupSlashTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSetErrorStyleTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSetErrorStyleTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSetErrorStyleTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,59 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+// テスト用に背景色を設定
+define('ERR_COLOR', 'blue');
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfSetErrorStyle()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfSetErrorStyleTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ // parent::setUp();
+ }
+
+ protected function tearDown() {
+ // parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfSetErrorStyle__背景色変更用の文字列が返る() {
+
+ $this->expected = 'style="background-color:blue"';
+ $this->actual = SC_Utils::sfSetErrorStyle();
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSetErrorStyleTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
追加: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php
===================================================================
--- branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php (rev 0)
+++ branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php 2012-12-16 10:02:02 UTC (rev 22140)
@@ -0,0 +1,79 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SC_Utils::sfSwapArray()のテストクラス.
+ *
+ *
+ * @author Hiroko Tamagawa
+ * @version $Id$
+ */
+class SC_Utils_sfSwapArrayTest extends Common_TestCase {
+
+
+ protected function setUp() {
+ parent::setUp();
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ /////////////////////////////////////////
+ public function testSfSwapArray_カラム名ありの指定の場合_キーに名称が入る() {
+ $input_array = array(
+ array('id' => '1001', 'name' => 'name1001'),
+ array('id' => '1002', 'name' => 'name1002')
+ );
+
+ $this->expected = array(
+ 'id' => array('1001', '1002'),
+ 'name' => array('name1001', 'name1002')
+ );
+ $this->actual = SC_Utils::sfSwapArray($input_array);
+
+ $this->verify();
+ }
+
+ public function testSfSwapArray_カラム名なしの指定の場合_キーに名称が入らない() {
+ $input_array = array(
+ array('id' => '1001', 'name' => 'name1001'),
+ array('id' => '1002', 'name' => 'name1002')
+ );
+
+ $this->expected = array(
+ array('1001', '1002'),
+ array('name1001', 'name1002')
+ );
+ $this->actual = SC_Utils::sfSwapArray($input_array, false);
+
+ $this->verify();
+ }
+
+ //////////////////////////////////////////
+
+}
+
Property changes on: branches/version-2_12-dev/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php
___________________________________________________________________
追加: svn:eol-style-native
+
追加: svn:keywords
+ Id Rev Date
Svn-src-all メーリングリストの案内