プロジェクト

全般

プロフィール

1680_backend-topic-search_test.patch

Yuya Watanabe, 2013-05-31 15:24

ダウンロード (6.38 KB)

差分を表示:

test/fixtures/999_test_data.yml
19 19
    id: 5
20 20
    name: "Tom"
21 21
    is_active: 1
22
  member_html_1:
23
    id: 1055
24
    name: "<&\"'>Member.name ESCAPING HTML TEST DATA"
25
    is_active: 1
26 22

  
27 23
MemberConfig:
28 24
  member_address_1:
......
86 82
    value: "<?php echo md5('password') ?>"
87 83
    Member: member_5
88 84

  
85
AdminUser:
86
  first_admin:
87
    id: ~
88
    username: "admin"
89
    password: "password"
90

  
89 91
Community:
90 92
  community_a:
91 93
    name: "「あ」コミュニティ"
......
246 248
    body: "こんにちは"
247 249
    Community: community_e
248 250
    Member: member_4
249
  community_topic_html_1:
250
    id: 1055
251
    name: "<&\"'>CommunityTopic.name ESCAPING HTML TEST DATA"
252
    body: "<&\"'>CommunityTopic.body ESCAPING HTML TEST DATA"
251
<?php foreach (range(20, 49) as $id): ?>
252
  community_topic_dummy_<?php echo $id ?>:
253
    id: "<?php echo $id ?>"
254
    name: "dummyTitle<?php echo $id ?>"
255
    body: "dummyBody<?php echo $id ?>"
253 256
    Community: community_a
254
    Member: member_html_1
257
    Member: member_1
258
<?php endforeach ?>
255 259

  
256 260
CommunityTopicComment:
257 261
  community_topic_comment_a_2:
......
286 290
    body: "こんにちは"
287 291
    CommunityTopic: community_topic_e_4
288 292
    Member: member_5
289
  community_topic_comment_html_1:
290
    id: 1055
291
    body: "<&\"'>CommunityTopicComment.body ESCAPING HTML TEST DATA"
292
    CommunityTopic: community_topic_html_1
293
    Member: member_html_1
293
<?php foreach (range(20, 49) as $id): ?>
294
  community_topic_comment_dummy_1_<?php echo $id ?>:
295
    id: "<?php echo $id ?>"
296
    body: "dummyBody<?php echo $id ?>"
297
    CommunityTopic: community_topic_dummy_20
298
    Member: member_1
299
<?php endforeach ?>
294 300

  
295 301
CommunityEvent:
296 302
  community_event_a_2:
......
311 317
    open_date_comment: 'いきしちに'
312 318
    area: '佐賀県'
313 319

  
314
  community_event_html_1:
315
    id: 1055
316
    Community: community_i
317
    Member: member_2
318
    name: "<&\"'>CommunityEvent.name ESCAPING HTML TEST DATA"
319
    body: "<&\"'>CommunityEvent.body ESCAPING HTML TEST DATA"
320
    open_date: '2009-06-11'
321
    open_date_comment: "<&\"'>CommunityEvent.open_date_comment ESCAPING HTML TEST DATA"
322
    area: "<&\"'>CommunityEvent.area ESCAPING HTML TEST DATA"
320
<?php foreach (range(20, 49) as $id): ?>
321
  community_event_dummy_<?php echo $id ?>:
322
    id: "<?php echo $id ?>"
323
    Community: community_a
324
    Member: member_1
325
    name: "dummyTitle<?php echo $id ?>"
326
    body: "dummyBody<?php echo $id ?>"
327
    open_date: '2000-01-01'
328
    open_date_comment: 'dummyDate<?php echo $id ?>'
329
    area: 'dummyArea<?php echo $id ?>'
330
<?php endforeach ?>
323 331

  
324 332
CommunityEventComment:
325 333
  community_event_comment_a_2:
......
330 338
    CommunityEvent: community_event_i_2
331 339
    Member: member_5
332 340
    body: 'こんにちは'
333
  community_event_comment_html_1:
334
    id: 1055
335
    CommunityEvent: community_event_html_1
336
    Member: member_html_1
337
    body: "<&\"'>CommunityEventComment.body ESCAPING HTML TEST DATA"
341
<?php foreach (range(20, 49) as $id): ?>
342
  community_event_comment_dummy_1_<?php echo $id ?>:
343
    id: "<?php echo $id ?>"
344
    CommunityEvent: community_event_dummy_20
345
    body: "dummyBody<?php echo $id ?>"
346
    Member: member_1
347
<?php endforeach ?>
338 348

  
339 349
CommunityEventMember:
340 350
  community_event_member_a_1:
......
343 353
  community_event_member_a_2:
344 354
    CommunityEvent: community_event_a_2
345 355
    Member: member_2
346
  community_event_member_html_1:
347
    id: 1055
348
    CommunityEvent: community_event_html_1
349
    Member: member_html_1
test/fixtures/999_xss_test_data.yml
43 43
    id: 1055
44 44
    name: "<&\"'>Community.name ESCAPING HTML TEST DATA"
45 45

  
46
CommunityConfig:
47
  html_community_1_public_flag:
48
    id: 1055
49
    Community: html_community_1
50
    name: "public_flag"
51
    value: "public"
52

  
46 53
CommunityMember:
47 54
  html_community_1_html_member_1:
48 55
    Community: html_community_1
test/functional/pc_backend/communityTopicPagerTest.class.php
1
<?php
2

  
3
$_app = 'pc_backend';
4
include(dirname(__FILE__).'/../../bootstrap/functional.php');
5
include(dirname(__FILE__).'/../../bootstrap/database.php');
6

  
7
$test = new opTestFunctional(new opBrowser(), new lime_test(9, new lime_output_color()));
8

  
9
$test
10
  ->info('Login')
11
  ->get('/default/login')
12
  ->click('ログイン', array('admin_user' => array(
13
    'username' => 'admin',
14
    'password' => 'password',
15
  )))
16
  ->isStatusCode(302);
17

  
18
foreach (array('topic', 'event') as $target)
19
{
20
  $test
21
    ->info('communityTopic/'.$target.'List: Pager test')
22
    ->get('/communityTopic/'.$target.'List')
23

  
24
    //-------------------------------------------
25
    // トピック/イベント検索
26

  
27
    // 1 ページ目 (30 件中 1 - 20件目)
28
    ->click('検索', array('community'.ucfirst($target) => array(
29
      'body' => array('text' => 'dummyBody'),
30
    )))
31
    ->with('response')->begin()
32
      ->checkElement('th:contains("作成日時")', 20)
33
    ->end()
34

  
35
    // 2 ページ目 (30 件中 21 - 30件目)
36
    ->click('次を表示')
37
    ->with('response')->begin()
38
      ->checkElement('th:contains("作成日時")', 10)
39
    ->end()
40

  
41
    //-------------------------------------------
42
    // コメント検索
43

  
44
    ->info('communityTopic/'.$target.'CommentList: Pager test')
45
    ->get('/communityTopic/'.$target.'CommentList')
46

  
47
    // 1 ページ目 (30 件中 1 - 20件目)
48
    ->click('検索', array('community'.ucfirst($target).'Comment' => array(
49
      'community_'.$target.'_id' => array('text' => '20'), // Bug #2597 のためトピックIDの指定が必須
50
      'body' => array('text' => 'dummyBody'),
51
    )))
52
    ->with('response')->begin()
53
      ->checkElement('th:contains("作成日時")', 20)
54
    ->end()
55

  
56
    // 2 ページ目 (30 件中 21 - 30件目)
57
    ->click('次を表示')
58
    ->with('response')->begin()
59
      ->checkElement('th:contains("作成日時")', 10)
60
    ->end();
61
}