ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10425


Ignore:
Timestamp:
Jan 26, 2009, 7:50:16 PM (12 years ago)
Author:
ebihara
Message:

#3372:added functional tests for a community member

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/test/functional/pc_frontend/communityTopicActionsTest.php

    r10423 r10425  
    2323
    2424include(dirname(__FILE__).'/../../bootstrap/functional.php');
    25 $user = new sfTestFunctional(new sfBrowser(), new lime_test(378, new lime_output_color()));
     25$user = new sfTestFunctional(new sfBrowser(), new lime_test(524, new lime_output_color()));
    2626
    2727// create a test user: Mr_OpenPNE (community admin)
     
    947947    ->isParameter('module', 'communityTopic')
    948948    ->isParameter('action', 'delete')
    949   ->end()
    950   ;
     949  ->end();
     950
     951// create a test user: sasaki (community member)
     952init();
     953$sasaki = createUser('sasaki@example.com', $user);
     954$sasaki
     955->info('public_flag: auth_commu_member, topic_authority: admin_only')
     956->get('/community/1')
     957  ->info('1. sasaki can access the community home')
     958  ->isStatusCode(200)
     959  ->with('request')->begin()
     960    ->isParameter('module', 'community')
     961    ->isParameter('action', 'home')
     962  ->end()
     963  ->with('response')->begin()
     964    ->info('1-a. sasaki can see "コミュニティ掲示板"')
     965    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', true)
     966    ->info('1-b. sasaki cannot see "トピック作成"')
     967    ->checkElement('#communityHome td a:contains("トピック作成")', false)
     968  ->end()
     969->get('/communityTopic/listCommunity/1')
     970  ->info('2. sasaki can access the community topic list')
     971  ->isStatusCode(200)
     972  ->with('request')->begin()
     973    ->isParameter('module', 'communityTopic')
     974    ->isParameter('action', 'listCommunity')
     975  ->end()
     976  ->with('response')->begin()
     977    ->info('2-a. sasaki cannot see "トピックを作成する"')
     978    ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
     979    ->info('2-b. sasaki can see "トピック一覧"')
     980    ->checkElement('.topicList h3:contains("トピック一覧")', true)
     981    ->info('2-c. sasaki can see two "もっと見る(1)"')
     982    ->checkElement('.topicList td a:contains("もっと見る(1)")', true, array('count' => 2))
     983    ->info('2-d. sasaki cannot see "編集"')
     984    ->checkElement('.topicList td a:contains("編集")', false)
     985  ->end()
     986->get('/communityTopic/1')
     987  ->info('3. sasaki can access the community topic')
     988  ->isStatusCode(200)
     989  ->with('request')->begin()
     990    ->isParameter('module', 'communityTopic')
     991    ->isParameter('action', 'show')
     992  ->end()
     993  ->with('response')->begin()
     994    ->info('3-a. sasaki cannot see "トピック編集"')
     995    ->checkElement('.topicTitle .operation:contains("トピック編集")', false)
     996    ->info('3-b. sasaki can see "書き込み"')
     997    ->checkElement('.commentList h3:contains("書き込み")', true)
     998    ->info('3-c. sasaki cannot see "削除"')
     999    ->checkElement('.commentList td:contains("削除")', false)
     1000    ->info('3-d. sasaki can see "コメント書き込み"')
     1001    ->checkElement('#formCommunityTopicComment h3:contains("コメント書き込み")', true)
     1002  ->end()
     1003  ->info('3e. sasaki can create a new topic comment')
     1004  ->click('送信', array('community_topic_comment' => array(
     1005    'body' => 'test',
     1006  )))
     1007  ->isStatusCode(302)
     1008  ->with('request')->begin()
     1009    ->isParameter('module', 'communityTopicComment')
     1010    ->isParameter('action', 'create')
     1011  ->end()
     1012->get('/communityTopic/new/1')
     1013  ->info('4. sasaki cannot access communityTopic_new')
     1014  ->isStatusCode(404)
     1015  ->with('request')->begin()
     1016    ->isParameter('module', 'communityTopic')
     1017    ->isParameter('action', 'new')
     1018  ->end()
     1019->get('/communityTopic/edit/1')
     1020  ->info('5. sasaki cannot access communityTopic_edit')
     1021  ->isStatusCode(404)
     1022  ->with('request')->begin()
     1023    ->isParameter('module', 'communityTopic')
     1024    ->isParameter('action', 'edit')
     1025  ->end()
     1026->get('/communityTopic/comment/deleteConfirm/1')
     1027  ->info('6. sasaki cannot access communityTopicComment_deleteConfirm')
     1028  ->isStatusCode(404)
     1029  ->with('request')->begin()
     1030    ->isParameter('module', 'communityTopicComment')
     1031    ->isParameter('action', 'deleteConfirm')
     1032  ->end()
     1033->get('/communityTopic/deleteConfirm/1')
     1034  ->info('7. sasaki cannot access communityTopic_deleteConfirm')
     1035  ->isStatusCode(404)
     1036  ->with('request')->begin()
     1037    ->isParameter('module', 'communityTopic')
     1038    ->isParameter('action', 'deleteConfirm')
     1039  ->end()
     1040
     1041->info('public_flag: public, topic_authority: admin_only')
     1042->get('/community/2')
     1043  ->info('1. sasaki can access the community home')
     1044  ->isStatusCode(200)
     1045  ->with('request')->begin()
     1046    ->isParameter('module', 'community')
     1047    ->isParameter('action', 'home')
     1048  ->end()
     1049  ->with('response')->begin()
     1050    ->info('1-a. sasaki can see "コミュニティ掲示板"')
     1051    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', true)
     1052    ->info('1-b. sasaki cannot see "トピック作成"')
     1053    ->checkElement('#communityHome td a:contains("トピック作成")', false)
     1054  ->end()
     1055->get('/communityTopic/listCommunity/2')
     1056  ->info('2. sasaki can access the community topic list')
     1057  ->isStatusCode(200)
     1058  ->with('request')->begin()
     1059    ->isParameter('module', 'communityTopic')
     1060    ->isParameter('action', 'listCommunity')
     1061  ->end()
     1062  ->with('response')->begin()
     1063    ->info('2-a. sasaki cannot see "トピックを作成する"')
     1064    ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
     1065    ->info('2-b. sasaki can see "トピック一覧"')
     1066    ->checkElement('.topicList h3:contains("トピック一覧")', true)
     1067    ->info('2-c. sasaki can see two "もっと見る(1)"')
     1068    ->checkElement('.topicList td a:contains("もっと見る(1)")', true, array('count' => 2))
     1069    ->info('2-d. sasaki cannot see a "編集"')
     1070    ->checkElement('.topicList td a:contains("編集")', false)
     1071  ->end()
     1072->get('/communityTopic/2')
     1073  ->info('3. sasaki can access the community topic')
     1074  ->isStatusCode(200)
     1075  ->with('request')->begin()
     1076    ->isParameter('module', 'communityTopic')
     1077    ->isParameter('action', 'show')
     1078  ->end()
     1079  ->with('response')->begin()
     1080    ->info('3-a. sasaki cannot see "トピック編集"')
     1081    ->checkElement('.topicTitle .operation:contains("トピック編集")', false)
     1082    ->info('3-b. sasaki can see "書き込み"')
     1083    ->checkElement('.commentList h3:contains("書き込み")', true)
     1084    ->info('3-c. sasaki cannot see "削除"')
     1085    ->checkElement('.commentList td:contains("削除")', false)
     1086    ->info('3-d. sasaki can see "コメント書き込み"')
     1087    ->checkElement('#formCommunityTopicComment h3:contains("コメント書き込み")', true)
     1088  ->end()
     1089  ->info('3e. sasaki can create a new topic comment')
     1090  ->click('送信', array('community_topic_comment' => array(
     1091    'body' => 'test',
     1092  )))
     1093  ->isStatusCode(302)
     1094  ->with('request')->begin()
     1095    ->isParameter('module', 'communityTopicComment')
     1096    ->isParameter('action', 'create')
     1097  ->end()
     1098->get('/communityTopic/new/2')
     1099  ->info('4. sasaki cannot access communityTopic_new')
     1100  ->isStatusCode(404)
     1101  ->with('request')->begin()
     1102    ->isParameter('module', 'communityTopic')
     1103    ->isParameter('action', 'new')
     1104  ->end()
     1105->get('/communityTopic/edit/2')
     1106  ->info('5. sasaki cannot access communityTopic_edit')
     1107  ->isStatusCode(404)
     1108  ->with('request')->begin()
     1109    ->isParameter('module', 'communityTopic')
     1110    ->isParameter('action', 'edit')
     1111  ->end()
     1112->get('/communityTopic/comment/deleteConfirm/2')
     1113  ->info('6. sasaki cannot access communityTopicComment_deleteConfirm')
     1114  ->isStatusCode(404)
     1115  ->with('request')->begin()
     1116    ->isParameter('module', 'communityTopicComment')
     1117    ->isParameter('action', 'deleteConfirm')
     1118  ->end()
     1119->get('/communityTopic/deleteConfirm/2')
     1120  ->info('7. sasaki cannot access communityTopic_deleteConfirm')
     1121  ->isStatusCode(404)
     1122  ->with('request')->begin()
     1123    ->isParameter('module', 'communityTopic')
     1124    ->isParameter('action', 'deleteConfirm')
     1125  ->end()
     1126
     1127->info('public_flag: auth_commu_member, topic_authority: public')
     1128->get('/community/3')
     1129  ->info('1. sasaki can access the community home')
     1130  ->isStatusCode(200)
     1131  ->with('request')->begin()
     1132    ->isParameter('module', 'community')
     1133    ->isParameter('action', 'home')
     1134  ->end()
     1135  ->with('response')->begin()
     1136    ->info('1-a. sasaki can see "コミュニティ掲示板"')
     1137    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', true)
     1138    ->info('1-b. sasaki can see "トピック作成"')
     1139    ->checkElement('#communityHome td a:contains("トピック作成")', true)
     1140  ->end()
     1141->get('/communityTopic/listCommunity/3')
     1142  ->info('2. sasaki can access the community topic list')
     1143  ->isStatusCode(200)
     1144  ->with('request')->begin()
     1145    ->isParameter('module', 'communityTopic')
     1146    ->isParameter('action', 'listCommunity')
     1147  ->end()
     1148  ->with('response')->begin()
     1149    ->info('2-a. sasaki can see "トピックを作成する"')
     1150    ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
     1151    ->info('2-b. sasaki can see "トピック一覧"')
     1152    ->checkElement('.topicList h3:contains("トピック一覧")', true)
     1153    ->info('2-c. sasaki can see two "もっと見る(1)"')
     1154    ->checkElement('.topicList td a:contains("もっと見る(1)")', true, array('count' => 2))
     1155    ->info('2-d. sasaki cannot see two "編集"')
     1156    ->checkElement('.topicList td a:contains("編集")', false)
     1157  ->end()
     1158->get('/communityTopic/3')
     1159  ->info('3. sasaki can access the community topic')
     1160  ->isStatusCode(200)
     1161  ->with('request')->begin()
     1162    ->isParameter('module', 'communityTopic')
     1163    ->isParameter('action', 'show')
     1164  ->end()
     1165  ->with('response')->begin()
     1166    ->info('3-a. sasaki cannot see "トピック編集"')
     1167    ->checkElement('.topicTitle .operation:contains("トピック編集")', false)
     1168    ->info('3-b. sasaki can see "書き込み"')
     1169    ->checkElement('.commentList h3:contains("書き込み")', true)
     1170    ->info('3-c. sasaki cannot see "削除"')
     1171    ->checkElement('.commentList td:contains("削除")', false)
     1172    ->info('3-d. sasaki can see "コメント書き込み"')
     1173    ->checkElement('#formCommunityTopicComment h3:contains("コメント書き込み")', true)
     1174  ->end()
     1175  ->info('3e. sasaki can create a new topic comment')
     1176  ->click('送信', array('community_topic_comment' => array(
     1177    'body' => 'test',
     1178  )))
     1179  ->isStatusCode(302)
     1180  ->with('request')->begin()
     1181    ->isParameter('module', 'communityTopicComment')
     1182    ->isParameter('action', 'create')
     1183  ->end()
     1184->get('/communityTopic/new/3')
     1185  ->info('4. sasaki can access communityTopic_new')
     1186  ->isStatusCode(200)
     1187  ->with('request')->begin()
     1188    ->isParameter('module', 'communityTopic')
     1189    ->isParameter('action', 'new')
     1190  ->end()
     1191  ->info('4a. sasaki can create a new topic')
     1192  ->click('送信', array('community_topic' => array(
     1193    'name' => 'test',
     1194    'body' => 'test',
     1195  )))
     1196  ->isStatusCode(302)
     1197  ->with('request')->begin()
     1198    ->isParameter('module', 'communityTopic')
     1199    ->isParameter('action', 'create')
     1200  ->end()
     1201->get('/communityTopic/edit/3')
     1202  ->info('5. sasaki cannot access communityTopic_edit')
     1203  ->isStatusCode(404)
     1204  ->with('request')->begin()
     1205    ->isParameter('module', 'communityTopic')
     1206    ->isParameter('action', 'edit')
     1207  ->end()
     1208->get('/communityTopic/comment/deleteConfirm/3')
     1209  ->info('6. sasaki can access communityTopicComment_deleteConfirm')
     1210  ->isStatusCode(404)
     1211  ->with('request')->begin()
     1212    ->isParameter('module', 'communityTopicComment')
     1213    ->isParameter('action', 'deleteConfirm')
     1214  ->end()
     1215->get('/communityTopic/deleteConfirm/3')
     1216  ->info('7. sasaki cannot access communityTopic_deleteConfirm')
     1217  ->isStatusCode(404)
     1218  ->with('request')->begin()
     1219    ->isParameter('module', 'communityTopic')
     1220    ->isParameter('action', 'deleteConfirm')
     1221  ->end()
     1222
     1223->info('public_flag: public, topic_authority: public')
     1224->get('/community/4')
     1225  ->info('1. sasaki can access the community home')
     1226  ->isStatusCode(200)
     1227  ->with('request')->begin()
     1228    ->isParameter('module', 'community')
     1229    ->isParameter('action', 'home')
     1230  ->end()
     1231  ->with('response')->begin()
     1232    ->info('1-a. sasaki can see "コミュニティ掲示板"')
     1233    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', true)
     1234    ->info('1-b. sasaki can see "トピック作成"')
     1235    ->checkElement('#communityHome td a:contains("トピック作成")', true)
     1236  ->end()
     1237->get('/communityTopic/listCommunity/4')
     1238  ->info('2. sasaki can access the community topic list')
     1239  ->isStatusCode(200)
     1240  ->with('request')->begin()
     1241    ->isParameter('module', 'communityTopic')
     1242    ->isParameter('action', 'listCommunity')
     1243  ->end()
     1244  ->with('response')->begin()
     1245    ->info('2-a. sasaki can see "トピックを作成する"')
     1246    ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
     1247    ->info('2-b. sasaki can see "トピック一覧"')
     1248    ->checkElement('.topicList h3:contains("トピック一覧")', true)
     1249    ->info('2-c. sasaki can see two "もっと見る(1)"')
     1250    ->checkElement('.topicList td a:contains("もっと見る(1)")', true, array('count' => 2))
     1251    ->info('2-d. sasaki cannot see "編集"')
     1252    ->checkElement('.topicList td a:contains("編集")', false)
     1253  ->end()
     1254->get('/communityTopic/4')
     1255  ->info('3. sasaki can access the community topic')
     1256  ->isStatusCode(200)
     1257  ->with('request')->begin()
     1258    ->isParameter('module', 'communityTopic')
     1259    ->isParameter('action', 'show')
     1260  ->end()
     1261  ->with('response')->begin()
     1262    ->info('3-a. sasaki cannot see "トピック編集"')
     1263    ->checkElement('.topicTitle .operation:contains("トピック編集")', false)
     1264    ->info('3-b. sasaki can see "書き込み"')
     1265    ->checkElement('.commentList h3:contains("書き込み")', true)
     1266    ->info('3-c. sasaki cannot see "削除"')
     1267    ->checkElement('.commentList td:contains("削除")', false)
     1268    ->info('3-d. sasaki can see "コメント書き込み"')
     1269    ->checkElement('#formCommunityTopicComment h3:contains("コメント書き込み")', true)
     1270  ->end()
     1271  ->info('3e. sasaki can create a new topic comment')
     1272  ->click('送信', array('community_topic_comment' => array(
     1273    'body' => 'test',
     1274  )))
     1275  ->isStatusCode(302)
     1276  ->with('request')->begin()
     1277    ->isParameter('module', 'communityTopicComment')
     1278    ->isParameter('action', 'create')
     1279  ->end()
     1280->get('/communityTopic/new/4')
     1281  ->info('4. sasaki can access communityTopic_new')
     1282  ->isStatusCode(200)
     1283  ->with('request')->begin()
     1284    ->isParameter('module', 'communityTopic')
     1285    ->isParameter('action', 'new')
     1286  ->end()
     1287  ->info('4a. sasaki can create a new topic')
     1288  ->click('送信', array('community_topic' => array(
     1289    'name' => 'test',
     1290    'body' => 'test',
     1291  )))
     1292  ->isStatusCode(302)
     1293  ->with('request')->begin()
     1294    ->isParameter('module', 'communityTopic')
     1295    ->isParameter('action', 'create')
     1296  ->end()
     1297->get('/communityTopic/edit/4')
     1298  ->info('5. sasaki cannot access communityTopic_edit')
     1299  ->isStatusCode(404)
     1300  ->with('request')->begin()
     1301    ->isParameter('module', 'communityTopic')
     1302    ->isParameter('action', 'edit')
     1303  ->end()
     1304->get('/communityTopic/comment/deleteConfirm/4')
     1305  ->info('6. sasaki cannot access communityTopicComment_deleteConfirm')
     1306  ->isStatusCode(404)
     1307  ->with('request')->begin()
     1308    ->isParameter('module', 'communityTopicComment')
     1309    ->isParameter('action', 'deleteConfirm')
     1310  ->end()
     1311->get('/communityTopic/deleteConfirm/4')
     1312  ->info('7. sasaki cannot access communityTopic_deleteConfirm')
     1313  ->isStatusCode(404)
     1314  ->with('request')->begin()
     1315    ->isParameter('module', 'communityTopic')
     1316    ->isParameter('action', 'deleteConfirm')
     1317  ->end();
Note: See TracChangeset for help on using the changeset viewer.