プロジェクト

全般

プロフィール

Bug(バグ) #1680 » 1680_backend-topic-search_test.patch

Yuya Watanabe, 2013-05-31 15:24

差分を表示:

test/fixtures/999_test_data.yml
id: 5
name: "Tom"
is_active: 1
member_html_1:
id: 1055
name: "<&\"'>Member.name ESCAPING HTML TEST DATA"
is_active: 1
MemberConfig:
member_address_1:
......
value: "<?php echo md5('password') ?>"
Member: member_5
AdminUser:
first_admin:
id: ~
username: "admin"
password: "password"
Community:
community_a:
name: "「あ」コミュニティ"
......
body: "こんにちは"
Community: community_e
Member: member_4
community_topic_html_1:
id: 1055
name: "<&\"'>CommunityTopic.name ESCAPING HTML TEST DATA"
body: "<&\"'>CommunityTopic.body ESCAPING HTML TEST DATA"
<?php foreach (range(20, 49) as $id): ?>
community_topic_dummy_<?php echo $id ?>:
id: "<?php echo $id ?>"
name: "dummyTitle<?php echo $id ?>"
body: "dummyBody<?php echo $id ?>"
Community: community_a
Member: member_html_1
Member: member_1
<?php endforeach ?>
CommunityTopicComment:
community_topic_comment_a_2:
......
body: "こんにちは"
CommunityTopic: community_topic_e_4
Member: member_5
community_topic_comment_html_1:
id: 1055
body: "<&\"'>CommunityTopicComment.body ESCAPING HTML TEST DATA"
CommunityTopic: community_topic_html_1
Member: member_html_1
<?php foreach (range(20, 49) as $id): ?>
community_topic_comment_dummy_1_<?php echo $id ?>:
id: "<?php echo $id ?>"
body: "dummyBody<?php echo $id ?>"
CommunityTopic: community_topic_dummy_20
Member: member_1
<?php endforeach ?>
CommunityEvent:
community_event_a_2:
......
open_date_comment: 'いきしちに'
area: '佐賀県'
community_event_html_1:
id: 1055
Community: community_i
Member: member_2
name: "<&\"'>CommunityEvent.name ESCAPING HTML TEST DATA"
body: "<&\"'>CommunityEvent.body ESCAPING HTML TEST DATA"
open_date: '2009-06-11'
open_date_comment: "<&\"'>CommunityEvent.open_date_comment ESCAPING HTML TEST DATA"
area: "<&\"'>CommunityEvent.area ESCAPING HTML TEST DATA"
<?php foreach (range(20, 49) as $id): ?>
community_event_dummy_<?php echo $id ?>:
id: "<?php echo $id ?>"
Community: community_a
Member: member_1
name: "dummyTitle<?php echo $id ?>"
body: "dummyBody<?php echo $id ?>"
open_date: '2000-01-01'
open_date_comment: 'dummyDate<?php echo $id ?>'
area: 'dummyArea<?php echo $id ?>'
<?php endforeach ?>
CommunityEventComment:
community_event_comment_a_2:
......
CommunityEvent: community_event_i_2
Member: member_5
body: 'こんにちは'
community_event_comment_html_1:
id: 1055
CommunityEvent: community_event_html_1
Member: member_html_1
body: "<&\"'>CommunityEventComment.body ESCAPING HTML TEST DATA"
<?php foreach (range(20, 49) as $id): ?>
community_event_comment_dummy_1_<?php echo $id ?>:
id: "<?php echo $id ?>"
CommunityEvent: community_event_dummy_20
body: "dummyBody<?php echo $id ?>"
Member: member_1
<?php endforeach ?>
CommunityEventMember:
community_event_member_a_1:
......
community_event_member_a_2:
CommunityEvent: community_event_a_2
Member: member_2
community_event_member_html_1:
id: 1055
CommunityEvent: community_event_html_1
Member: member_html_1
test/fixtures/999_xss_test_data.yml
id: 1055
name: "<&\"'>Community.name ESCAPING HTML TEST DATA"
CommunityConfig:
html_community_1_public_flag:
id: 1055
Community: html_community_1
name: "public_flag"
value: "public"
CommunityMember:
html_community_1_html_member_1:
Community: html_community_1
test/functional/pc_backend/communityTopicPagerTest.class.php
<?php
$_app = 'pc_backend';
include(dirname(__FILE__).'/../../bootstrap/functional.php');
include(dirname(__FILE__).'/../../bootstrap/database.php');
$test = new opTestFunctional(new opBrowser(), new lime_test(9, new lime_output_color()));
$test
->info('Login')
->get('/default/login')
->click('ログイン', array('admin_user' => array(
'username' => 'admin',
'password' => 'password',
)))
->isStatusCode(302);
foreach (array('topic', 'event') as $target)
{
$test
->info('communityTopic/'.$target.'List: Pager test')
->get('/communityTopic/'.$target.'List')
//-------------------------------------------
// トピック/イベント検索
// 1 ページ目 (30 件中 1 - 20件目)
->click('検索', array('community'.ucfirst($target) => array(
'body' => array('text' => 'dummyBody'),
)))
->with('response')->begin()
->checkElement('th:contains("作成日時")', 20)
->end()
// 2 ページ目 (30 件中 21 - 30件目)
->click('次を表示')
->with('response')->begin()
->checkElement('th:contains("作成日時")', 10)
->end()
//-------------------------------------------
// コメント検索
->info('communityTopic/'.$target.'CommentList: Pager test')
->get('/communityTopic/'.$target.'CommentList')
// 1 ページ目 (30 件中 1 - 20件目)
->click('検索', array('community'.ucfirst($target).'Comment' => array(
'community_'.$target.'_id' => array('text' => '20'), // Bug #2597 のためトピックIDの指定が必須
'body' => array('text' => 'dummyBody'),
)))
->with('response')->begin()
->checkElement('th:contains("作成日時")', 20)
->end()
// 2 ページ目 (30 件中 21 - 30件目)
->click('次を表示')
->with('response')->begin()
->checkElement('th:contains("作成日時")', 10)
->end();
}
    (1-1/1)