Changeset 23528
- Timestamp:
- 2014/06/05 17:13:38 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/tests/class/SC_CheckError/SC_CheckError_HTML_TAG_CHECKTest.php
r22857 r23528 33 33 $masterData = new SC_DB_MasterData_Ex(); 34 34 $this->arrAllowedTag = $masterData->getMasterData('mtb_allowed_tag'); 35 $this->target_func = 'HTML_TAG_CHECK'; 35 36 } 36 37 … … 42 43 ///////////////////////////////////////// 43 44 44 public function testHTML_TAG_CHECK_ scriptタグが含まれる()45 public function testHTML_TAG_CHECK_許可されていないhtmlタグが含まれる() 45 46 { 46 $arrForm = array('form' => '<script></script>'); 47 $not_allowed_tag = 'script'; 48 49 // 許可するタグリストに含まれていれば削除しておく 50 if ($key = array_search($not_allowed_tag, $this->arrAllowedTag)) { 51 unset($this->arrAllowedTag[$key]); 52 } 53 54 $disp_name = $this->target_func; 55 $arrForm = array( 56 'form' => "<{$not_allowed_tag}>not allowed</{$not_allowed_tag}>", 57 ); 47 58 $objErr = new SC_CheckError_Ex($arrForm); 48 $objErr->doFunc(array('HTML_TAG_CHECK', 'form', $this->arrAllowedTag) ,array('HTML_TAG_CHECK')); 59 $objErr->doFunc(array($disp_name, 'form', $this->arrAllowedTag), 60 array($this->target_func)); 49 61 50 $this->expected = '※ HTML_TAG_CHECKに許可されていないタグ [script], [script] が含まれています。<br />'; 62 $this->expected = sprintf( 63 '※ %sに許可されていないタグ [%s], [%s] が含まれています。<br />', 64 $disp_name, $not_allowed_tag, $not_allowed_tag); 51 65 $this->actual = $objErr->arrErr['form']; 52 66 $this->verify(''); 53 67 } 54 68 55 public function testHTML_TAG_CHECK_ pタグが含まれる()69 public function testHTML_TAG_CHECK_許可されているhtmlタグが含まれる() 56 70 { 57 $arrForm = array('form' => '<p><p><p>'); 71 $allowed_tag = 'p'; 72 73 // 許可するタグリストに含まれていなければ追加しておく 74 if (!in_array($allowed_tag, $this->arrAllowedTag)) { 75 $this->arrAllowedTag[] = $allowed_tag; 76 } 77 78 $disp_name = $this->target_func; 79 $arrForm = array( 80 'form' => "<{$allowed_tag}>allowed</{$allowed_tag}>", 81 ); 58 82 $objErr = new SC_CheckError_Ex($arrForm); 59 $objErr->doFunc(array('HTML_TAG_CHECK', 'form', $this->arrAllowedTag) ,array('HTML_TAG_CHECK')); 83 $objErr->doFunc(array($disp_name, 'form', $this->arrAllowedTag), 84 array($this->target_func)); 60 85 61 86 $this->expected = ''; … … 66 91 public function testHTML_TAG_CHECK_htmlタグが含まれない() 67 92 { 68 $arrForm = array('form' => ' 69 htmlを含まないテスト文章。 70 htmlを含まないテスト文章。 71 htmlを含まないテスト文章。 72 '); 93 $disp_name = $this->target_func; 94 $arrForm = array('form' => 'htmlタグを含まないテスト文章。'); 73 95 $objErr = new SC_CheckError_Ex($arrForm); 74 $objErr->doFunc(array('HTML_TAG_CHECK', 'form', $this->arrAllowedTag) ,array('HTML_TAG_CHECK')); 96 $objErr->doFunc(array($disp_name, 'form', $this->arrAllowedTag), 97 array($this->target_func)); 75 98 76 99 $this->expected = '';
Note: See TracChangeset
for help on using the changeset viewer.