1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* ValidateTest4IsHalfWidth |
4
|
|
|
* |
5
|
|
|
* Validate::IsHalfWidth用テストケース |
6
|
|
|
* |
7
|
|
|
* @package risoluto |
8
|
|
|
* @author Risoluto Developers |
9
|
|
|
* @license http://opensource.org/licenses/bsd-license.php new BSD license |
10
|
|
|
* @copyright (C) 2008-2015 Risoluto Developers / All Rights Reserved. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
//------------------------------------------------------// |
14
|
|
|
// 名前空間の定義 |
15
|
|
|
//------------------------------------------------------// |
16
|
|
|
namespace Risoluto; |
17
|
|
|
|
18
|
|
|
//------------------------------------------------------// |
19
|
|
|
// テストクラス定義 |
20
|
|
|
//------------------------------------------------------// |
21
|
|
|
class ValidateTest4IsHalfWidth extends \PHPUnit_Framework_TestCase |
22
|
|
|
{ |
23
|
|
|
//------------------------------------------------------// |
24
|
|
|
// テストメソッド定義 |
25
|
|
|
//------------------------------------------------------// |
26
|
|
|
/** |
27
|
|
|
* setUp() |
28
|
|
|
* |
29
|
|
|
* テストに必要な準備を実施 |
30
|
|
|
*/ |
31
|
|
|
protected function setUp() |
32
|
|
|
{ |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* test_IsHalfWidth_HalfNumeric() |
37
|
|
|
* |
38
|
|
|
* isHalfWidth()の挙動をテストする(半角数字) |
39
|
|
|
*/ |
40
|
|
|
public function test_IsHalfWidth_HalfNumeric() |
41
|
|
|
{ |
42
|
|
|
$test = '0'; |
43
|
|
|
|
44
|
|
|
$this->assertTrue( Validate::isHalfWidth( $test ) ); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* test_IsHalfWidth_HalfAlphabet() |
49
|
|
|
* |
50
|
|
|
* isHalfWidth()の挙動をテストする(半角英字) |
51
|
|
|
*/ |
52
|
|
|
public function test_IsHalfWidth_HalfAlphabet() |
53
|
|
|
{ |
54
|
|
|
$test = 'A'; |
55
|
|
|
|
56
|
|
|
$this->assertTrue( Validate::isHalfWidth( $test ) ); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* test_IsHalfWidth_HalfSymbol() |
61
|
|
|
* |
62
|
|
|
* isHalfWidth()の挙動をテストする(半角記号) |
63
|
|
|
*/ |
64
|
|
|
public function test_IsHalfWidth_HalfSymbol() |
65
|
|
|
{ |
66
|
|
|
$test = '+'; |
67
|
|
|
|
68
|
|
|
$this->assertTrue( Validate::isHalfWidth( $test ) ); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* test_IsHalfWidth_FullNumeric() |
73
|
|
|
* |
74
|
|
|
* isHalfWidth()の挙動をテストする(全角数字) |
75
|
|
|
*/ |
76
|
|
|
public function test_IsHalfWidth_FullNumeric() |
77
|
|
|
{ |
78
|
|
|
$test = '0'; |
79
|
|
|
|
80
|
|
|
$this->assertFalse( Validate::isHalfWidth( $test ) ); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* test_IsHalfWidth_FullAlphabet() |
85
|
|
|
* |
86
|
|
|
* isHalfWidth()の挙動をテストする(全角英字) |
87
|
|
|
*/ |
88
|
|
|
public function test_IsHalfWidth_FullAlphabet() |
89
|
|
|
{ |
90
|
|
|
$test = 'A'; |
91
|
|
|
|
92
|
|
|
$this->assertFalse( Validate::isHalfWidth( $test ) ); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* test_IsHalfWidth_FullSymbol() |
97
|
|
|
* |
98
|
|
|
* isHalfWidth()の挙動をテストする(全角記号) |
99
|
|
|
*/ |
100
|
|
|
public function test_IsHalfWidth_FullSymbol() |
101
|
|
|
{ |
102
|
|
|
$test = '+'; |
103
|
|
|
|
104
|
|
|
$this->assertFalse( Validate::isHalfWidth( $test ) ); |
105
|
|
|
} |
106
|
|
|
} |