| @@ 21-82 (lines=62) @@ | ||
| 18 | //------------------------------------------------------// |
|
| 19 | // テストクラス定義 |
|
| 20 | //------------------------------------------------------// |
|
| 21 | class ValidateTest4IsEmailAddr extends \PHPUnit_Framework_TestCase |
|
| 22 | { |
|
| 23 | //------------------------------------------------------// |
|
| 24 | // テストメソッド定義 |
|
| 25 | //------------------------------------------------------// |
|
| 26 | /** |
|
| 27 | * setUp() |
|
| 28 | * |
|
| 29 | * テストに必要な準備を実施 |
|
| 30 | */ |
|
| 31 | protected function setUp() |
|
| 32 | { |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * test_IsEmailAddr_InvalidTextPart1() |
|
| 37 | * |
|
| 38 | * isEmailAddr()の挙動をテストする(メールアドレスじゃない文字列その1) |
|
| 39 | */ |
|
| 40 | public function test_IsEmailAddr_InvalidTextPart1() |
|
| 41 | { |
|
| 42 | $test = '@risoluto This is test!'; |
|
| 43 | ||
| 44 | $this->assertFalse( Validate::isEmailAddr( $test ) ); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * test_IsEmailAddr_InvalidText() |
|
| 49 | * |
|
| 50 | * isEmailAddr()の挙動をテストする(メールアドレスじゃない文字列その2) |
|
| 51 | */ |
|
| 52 | public function test_IsEmailAddr_InvalidTextPart2() |
|
| 53 | { |
|
| 54 | $test = 'test+test-test.test@risoluto_test-test+test.jp'; |
|
| 55 | ||
| 56 | $this->assertFalse( Validate::isEmailAddr( $test ) ); |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * test_IsEmailAddr_ValidTextPart1() |
|
| 61 | * |
|
| 62 | * isEmailAddr()の挙動をテストする(メールアドレスな文字列その1) |
|
| 63 | */ |
|
| 64 | public function test_IsEmailAddr_ValidTextPart1() |
|
| 65 | { |
|
| 66 | $test = '[email protected]'; |
|
| 67 | ||
| 68 | $this->assertTrue( Validate::isEmailAddr( $test ) ); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * test_IsEmailAddr_ValidTextPart2() |
|
| 73 | * |
|
| 74 | * isEmailAddr()の挙動をテストする(メールアドレスな文字列その2) |
|
| 75 | */ |
|
| 76 | public function test_IsEmailAddr_ValidTextPart2() |
|
| 77 | { |
|
| 78 | $test = '[email protected]'; |
|
| 79 | ||
| 80 | $this->assertTrue( Validate::isEmailAddr( $test ) ); |
|
| 81 | } |
|
| 82 | } |
|
| @@ 21-82 (lines=62) @@ | ||
| 18 | //------------------------------------------------------// |
|
| 19 | // テストクラス定義 |
|
| 20 | //------------------------------------------------------// |
|
| 21 | class ValidateTest4IsLeapYear extends \PHPUnit_Framework_TestCase |
|
| 22 | { |
|
| 23 | //------------------------------------------------------// |
|
| 24 | // テストメソッド定義 |
|
| 25 | //------------------------------------------------------// |
|
| 26 | /** |
|
| 27 | * setUp() |
|
| 28 | * |
|
| 29 | * テストに必要な準備を実施 |
|
| 30 | */ |
|
| 31 | protected function setUp() |
|
| 32 | { |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * test_IsLeapYear_InvalidArgPart1() |
|
| 37 | * |
|
| 38 | * isLeapYear()の挙動をテストする(数字2桁) |
|
| 39 | */ |
|
| 40 | public function test_IsLeapYear_InvalidArgPart1() |
|
| 41 | { |
|
| 42 | $test = '13'; |
|
| 43 | ||
| 44 | $this->assertFalse( Validate::isLeapYear( $test ) ); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * test_IsLeapYear_InvalidArgPart2() |
|
| 49 | * |
|
| 50 | * isLeapYear()の挙動をテストする(英字4桁) |
|
| 51 | */ |
|
| 52 | public function test_IsLeapYear_InvalidArgPart2() |
|
| 53 | { |
|
| 54 | $test = 'AAAA'; |
|
| 55 | ||
| 56 | $this->assertFalse( Validate::isLeapYear( $test ) ); |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * test_IsLeapYear_ValidArgPart1() |
|
| 61 | * |
|
| 62 | * isLeapYear()の挙動をテストする(閏年である) |
|
| 63 | */ |
|
| 64 | public function test_IsLeapYear_ValidArgPart1() |
|
| 65 | { |
|
| 66 | $test = '2000'; |
|
| 67 | ||
| 68 | $this->assertTrue( Validate::isLeapYear( $test ) ); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * test_IsLeapYear_ValidArgPart2() |
|
| 73 | * |
|
| 74 | * isLeapYear()の挙動をテストする(閏年でない) |
|
| 75 | */ |
|
| 76 | public function test_IsLeapYear_ValidArgPart2() |
|
| 77 | { |
|
| 78 | $test = '2013'; |
|
| 79 | ||
| 80 | $this->assertFalse( Validate::isLeapYear( $test ) ); |
|
| 81 | } |
|
| 82 | } |
|