fix #1510 이미지 경로 전에 cond사용이 제한되는 문제 고침

- `>`문자열로 img태그의 종료점을 찾으므로 `cond`속성을 먼저 사용할 경우 제한될 수 있었음
- test case 추가
This commit is contained in:
bnu 2015-06-04 15:08:34 +09:00
parent 98cc32a2ce
commit f6a538a655
2 changed files with 17 additions and 2 deletions

View file

@ -213,7 +213,7 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
// issue 584
array(
'<img cond="$oBodex->display_extra_images[\'mobile\'] && $arr_extra && $arr_extra->bodex->mobile" src="./images/common/mobile.gif" title="mobile" alt="mobile" />',
PHP_EOL . 'if($__Context->oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?><img src="./images/common/mobile.gif" title="mobile" alt="mobile" /><?php } ?>'
PHP_EOL . 'if($__Context->oBodex->display_extra_images[\'mobile\'] && $__Context->arr_extra && $__Context->arr_extra->bodex->mobile){ ?><img src="/xe/tests/unit/classes/template/images/common/mobile.gif" title="mobile" alt="mobile" /><?php } ?>'
),
// issue 831
array(
@ -230,6 +230,21 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
'{@ eval(\'$val = $document_srl;\')}',
PHP_EOL . 'eval(\'$__Context->val = $__Context->document_srl;\') ?>'
),
// https://github.com/xpressengine/xe-core/issues/1510
array(
'<img cond="$foo->bar" src="../common/mobile.gif" />',
PHP_EOL . 'if($__Context->foo->bar){ ?><img src="/xe/tests/unit/classes/common/mobile.gif" /><?php } ?>'
),
// https://github.com/xpressengine/xe-core/issues/1510
array(
'<img cond="$foo->bar > 100" alt="a!@#$%^&*()_-=[]{}?/" src="../common/mobile.gif" />',
PHP_EOL . 'if($__Context->foo->bar > 100){ ?><img alt="a!@#$%^&*()_-=[]{}?/" src="/xe/tests/unit/classes/common/mobile.gif" /><?php } ?>'
),
// https://github.com/xpressengine/xe-core/issues/1510
array(
'<img src="../common/mobile.gif" cond="$foo->bar" />',
PHP_EOL . 'if($__Context->foo->bar){ ?><img src="/xe/tests/unit/classes/common/mobile.gif" /><?php } ?>'
),
);
}