1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
4 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
5 | /** |
---|
6 | * |
---|
7 | */ |
---|
8 | class SC_Utils_sfGetCommaListTest extends Common_TestCase { |
---|
9 | |
---|
10 | protected function setUp() { |
---|
11 | parent::setUp(); |
---|
12 | } |
---|
13 | |
---|
14 | protected function tearDown() { |
---|
15 | parent::tearDown(); |
---|
16 | } |
---|
17 | |
---|
18 | ///////////////////////////////////////// |
---|
19 | public function testSfGetCommaList_配列が空の場合_FALSEが返る() { |
---|
20 | $this->expected = FALSE; |
---|
21 | $this->actual = SC_Utils::sfGetCommaList(array()); |
---|
22 | |
---|
23 | $this->verify('連結済みの文字列'); |
---|
24 | } |
---|
25 | |
---|
26 | public function testSfGetCommaList_スペースフラグが立っている場合_スペース付きで連結される() { |
---|
27 | $this->expected = 'りんご, ミカン, バナナ'; |
---|
28 | $this->actual = SC_Utils::sfGetCommaList( |
---|
29 | array('りんご', 'ミカン', 'バナナ'), |
---|
30 | TRUE, |
---|
31 | array()); |
---|
32 | |
---|
33 | $this->verify('連結済みの文字列'); |
---|
34 | } |
---|
35 | |
---|
36 | public function testSfGetCommaList_スペースフラグが倒れている場合_スペース付きで連結される() { |
---|
37 | $this->expected = 'りんご,ミカン,バナナ'; |
---|
38 | $this->actual = SC_Utils::sfGetCommaList( |
---|
39 | array('りんご', 'ミカン', 'バナナ'), |
---|
40 | FALSE, |
---|
41 | array()); |
---|
42 | |
---|
43 | $this->verify('連結済みの文字列'); |
---|
44 | } |
---|
45 | |
---|
46 | // TODO 要確認:arrpopの役割 |
---|
47 | public function testSfGetCommaList_除外リストが指定されている場合_スペース付きで連結される() { |
---|
48 | $this->expected = 'りんご, バナナ'; |
---|
49 | $this->actual = SC_Utils::sfGetCommaList( |
---|
50 | array('りんご', 'ミカン', 'バナナ'), |
---|
51 | TRUE, |
---|
52 | array('梨', 'ミカン', '柿')); |
---|
53 | |
---|
54 | $this->verify('連結済みの文字列'); |
---|
55 | } |
---|
56 | |
---|
57 | } |
---|
58 | |
---|