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

Changeset 10427


Ignore:
Timestamp:
Jan 26, 2009, 8:02:52 PM (12 years ago)
Author:
ebihara
Message:

#3372:added functional tests for the non-community member

File:
1 edited

Legend:

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

    r10425 r10427  
    2323
    2424include(dirname(__FILE__).'/../../bootstrap/functional.php');
    25 $user = new sfTestFunctional(new sfBrowser(), new lime_test(524, new lime_output_color()));
     25$user = new sfTestFunctional(new sfBrowser(), new lime_test(634, new lime_output_color()));
    2626
    2727// create a test user: Mr_OpenPNE (community admin)
     
    13161316    ->isParameter('action', 'deleteConfirm')
    13171317  ->end();
     1318
     1319// create a test user: yamada (non-community member)
     1320init();
     1321$yamada = createUser('yamada@example.com', $user);
     1322$yamada
     1323->info('public_flag: auth_commu_member, topic_authority: admin_only')
     1324->get('/community/1')
     1325  ->info('1. yamada can access the community home')
     1326  ->isStatusCode(200)
     1327  ->with('request')->begin()
     1328    ->isParameter('module', 'community')
     1329    ->isParameter('action', 'home')
     1330  ->end()
     1331  ->with('response')->begin()
     1332    ->info('1-a. yamada cannot see "コミュニティ掲示板"')
     1333    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', false)
     1334    ->info('1-b. yamada cannot see "トピック作成"')
     1335    ->checkElement('#communityHome td a:contains("トピック作成")', false)
     1336  ->end()
     1337->get('/communityTopic/listCommunity/1')
     1338  ->info('2. yamada cannot access the community topic list')
     1339  ->isStatusCode(404)
     1340  ->with('request')->begin()
     1341    ->isParameter('module', 'communityTopic')
     1342    ->isParameter('action', 'listCommunity')
     1343  ->end()
     1344->get('/communityTopic/1')
     1345  ->info('3. yamada cannot access the community topic')
     1346  ->isStatusCode(404)
     1347  ->with('request')->begin()
     1348    ->isParameter('module', 'communityTopic')
     1349    ->isParameter('action', 'show')
     1350  ->end()
     1351->get('/communityTopic/new/1')
     1352  ->info('4. yamada cannot access communityTopic_new')
     1353  ->isStatusCode(404)
     1354  ->with('request')->begin()
     1355    ->isParameter('module', 'communityTopic')
     1356    ->isParameter('action', 'new')
     1357  ->end()
     1358->get('/communityTopic/edit/1')
     1359  ->info('5. yamada cannot access communityTopic_edit')
     1360  ->isStatusCode(404)
     1361  ->with('request')->begin()
     1362    ->isParameter('module', 'communityTopic')
     1363    ->isParameter('action', 'edit')
     1364  ->end()
     1365->get('/communityTopic/comment/deleteConfirm/1')
     1366  ->info('6. yamada cannot access communityTopicComment_deleteConfirm')
     1367  ->isStatusCode(404)
     1368  ->with('request')->begin()
     1369    ->isParameter('module', 'communityTopicComment')
     1370    ->isParameter('action', 'deleteConfirm')
     1371  ->end()
     1372->get('/communityTopic/deleteConfirm/1')
     1373  ->info('7. yamada cannot access communityTopic_deleteConfirm')
     1374  ->isStatusCode(404)
     1375  ->with('request')->begin()
     1376    ->isParameter('module', 'communityTopic')
     1377    ->isParameter('action', 'deleteConfirm')
     1378  ->end()
     1379
     1380->info('public_flag: public, topic_authority: admin_only')
     1381->get('/community/2')
     1382  ->info('1. yamada can access the community home')
     1383  ->isStatusCode(200)
     1384  ->with('request')->begin()
     1385    ->isParameter('module', 'community')
     1386    ->isParameter('action', 'home')
     1387  ->end()
     1388  ->with('response')->begin()
     1389    ->info('1-a. yamada can see "コミュニティ掲示板"')
     1390    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', true)
     1391    ->info('1-b. yamada cannot see "トピック作成"')
     1392    ->checkElement('#communityHome td a:contains("トピック作成")', false)
     1393  ->end()
     1394->get('/communityTopic/listCommunity/2')
     1395  ->info('2. yamada can access the community topic list')
     1396  ->isStatusCode(200)
     1397  ->with('request')->begin()
     1398    ->isParameter('module', 'communityTopic')
     1399    ->isParameter('action', 'listCommunity')
     1400  ->end()
     1401  ->with('response')->begin()
     1402    ->info('2-a. yamada cannot see "トピックを作成する"')
     1403    ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
     1404    ->info('2-b. yamada can see "トピック一覧"')
     1405    ->checkElement('.topicList h3:contains("トピック一覧")', true)
     1406    ->info('2-c. yamada can see two "もっと見る(1)"')
     1407    ->checkElement('.topicList td a:contains("もっと見る(1)")', true, array('count' => 2))
     1408    ->info('2-d. yamada cannot see a "編集"')
     1409    ->checkElement('.topicList td a:contains("編集")', false)
     1410  ->end()
     1411->get('/communityTopic/2')
     1412  ->info('3. yamada can access the community topic')
     1413  ->isStatusCode(200)
     1414  ->with('request')->begin()
     1415    ->isParameter('module', 'communityTopic')
     1416    ->isParameter('action', 'show')
     1417  ->end()
     1418  ->with('response')->begin()
     1419    ->info('3-a. yamada cannot see "トピック編集"')
     1420    ->checkElement('.topicTitle .operation:contains("トピック編集")', false)
     1421    ->info('3-b. yamada can see "書き込み"')
     1422    ->checkElement('.commentList h3:contains("書き込み")', true)
     1423    ->info('3-c. yamada cannot see "削除"')
     1424    ->checkElement('.commentList td:contains("削除")', false)
     1425    ->info('3-d. yamada cannot see "コメント書き込み"')
     1426    ->checkElement('#formCommunityTopicComment h3:contains("コメント書き込み")', false)
     1427  ->end()
     1428->get('/communityTopic/new/2')
     1429  ->info('4. yamada cannot access communityTopic_new')
     1430  ->isStatusCode(404)
     1431  ->with('request')->begin()
     1432    ->isParameter('module', 'communityTopic')
     1433    ->isParameter('action', 'new')
     1434  ->end()
     1435->get('/communityTopic/edit/2')
     1436  ->info('5. yamada cannot access communityTopic_edit')
     1437  ->isStatusCode(404)
     1438  ->with('request')->begin()
     1439    ->isParameter('module', 'communityTopic')
     1440    ->isParameter('action', 'edit')
     1441  ->end()
     1442->get('/communityTopic/comment/deleteConfirm/2')
     1443  ->info('6. yamada cannot access communityTopicComment_deleteConfirm')
     1444  ->isStatusCode(404)
     1445  ->with('request')->begin()
     1446    ->isParameter('module', 'communityTopicComment')
     1447    ->isParameter('action', 'deleteConfirm')
     1448  ->end()
     1449->get('/communityTopic/deleteConfirm/2')
     1450  ->info('7. yamada cannot access communityTopic_deleteConfirm')
     1451  ->isStatusCode(404)
     1452  ->with('request')->begin()
     1453    ->isParameter('module', 'communityTopic')
     1454    ->isParameter('action', 'deleteConfirm')
     1455  ->end()
     1456
     1457->info('public_flag: auth_commu_member, topic_authority: public')
     1458->get('/community/3')
     1459  ->info('1. yamada can access the community home')
     1460  ->isStatusCode(200)
     1461  ->with('request')->begin()
     1462    ->isParameter('module', 'community')
     1463    ->isParameter('action', 'home')
     1464  ->end()
     1465  ->with('response')->begin()
     1466    ->info('1-a. yamada cannot see "コミュニティ掲示板"')
     1467    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', false)
     1468    ->info('1-b. yamada cannot see "トピック作成"')
     1469    ->checkElement('#communityHome td a:contains("トピック作成")', false)
     1470  ->end()
     1471->get('/communityTopic/listCommunity/3')
     1472  ->info('2. yamada cannot access the community topic list')
     1473  ->isStatusCode(404)
     1474  ->with('request')->begin()
     1475    ->isParameter('module', 'communityTopic')
     1476    ->isParameter('action', 'listCommunity')
     1477  ->end()
     1478->get('/communityTopic/3')
     1479  ->info('3. yamada cannot access the community topic')
     1480  ->isStatusCode(404)
     1481  ->with('request')->begin()
     1482    ->isParameter('module', 'communityTopic')
     1483    ->isParameter('action', 'show')
     1484  ->end()
     1485->get('/communityTopic/new/3')
     1486  ->info('4. yamada cannot access communityTopic_new')
     1487  ->isStatusCode(404)
     1488  ->with('request')->begin()
     1489    ->isParameter('module', 'communityTopic')
     1490    ->isParameter('action', 'new')
     1491  ->end()
     1492->get('/communityTopic/edit/3')
     1493  ->info('5. yamada cannot access communityTopic_edit')
     1494  ->isStatusCode(404)
     1495  ->with('request')->begin()
     1496    ->isParameter('module', 'communityTopic')
     1497    ->isParameter('action', 'edit')
     1498  ->end()
     1499->get('/communityTopic/comment/deleteConfirm/3')
     1500  ->info('6. yamada cannot access communityTopicComment_deleteConfirm')
     1501  ->isStatusCode(404)
     1502  ->with('request')->begin()
     1503    ->isParameter('module', 'communityTopicComment')
     1504    ->isParameter('action', 'deleteConfirm')
     1505  ->end()
     1506->get('/communityTopic/deleteConfirm/3')
     1507  ->info('7. yamada cannot access communityTopic_deleteConfirm')
     1508  ->isStatusCode(404)
     1509  ->with('request')->begin()
     1510    ->isParameter('module', 'communityTopic')
     1511    ->isParameter('action', 'deleteConfirm')
     1512  ->end()
     1513
     1514->info('public_flag: public, topic_authority: public')
     1515->get('/community/4')
     1516  ->info('1. yamada can access the community home')
     1517  ->isStatusCode(200)
     1518  ->with('request')->begin()
     1519    ->isParameter('module', 'community')
     1520    ->isParameter('action', 'home')
     1521  ->end()
     1522  ->with('response')->begin()
     1523    ->info('1-a. yamada can see "コミュニティ掲示板"')
     1524    ->checkElement('#communityHome th:contains("コミュニティ掲示板")', true)
     1525    ->info('1-b. yamada cannot see "トピック作成"')
     1526    ->checkElement('#communityHome td a:contains("トピック作成")', false)
     1527  ->end()
     1528->get('/communityTopic/listCommunity/4')
     1529  ->info('2. yamada can access the community topic list')
     1530  ->isStatusCode(200)
     1531  ->with('request')->begin()
     1532    ->isParameter('module', 'communityTopic')
     1533    ->isParameter('action', 'listCommunity')
     1534  ->end()
     1535  ->with('response')->begin()
     1536    ->info('2-a. yamada cannot see "トピックを作成する"')
     1537    ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
     1538    ->info('2-b. yamada can see "トピック一覧"')
     1539    ->checkElement('.topicList h3:contains("トピック一覧")', true)
     1540    ->info('2-c. yamada can see two "もっと見る(1)"')
     1541    ->checkElement('.topicList td a:contains("もっと見る(1)")', true, array('count' => 2))
     1542    ->info('2-d. yamada cannot see "編集"')
     1543    ->checkElement('.topicList td a:contains("編集")', false)
     1544  ->end()
     1545->get('/communityTopic/4')
     1546  ->info('3. yamada can access the community topic')
     1547  ->isStatusCode(200)
     1548  ->with('request')->begin()
     1549    ->isParameter('module', 'communityTopic')
     1550    ->isParameter('action', 'show')
     1551  ->end()
     1552  ->with('response')->begin()
     1553    ->info('3-a. yamada cannot see "トピック編集"')
     1554    ->checkElement('.topicTitle .operation:contains("トピック編集")', false)
     1555    ->info('3-b. yamada can see "書き込み"')
     1556    ->checkElement('.commentList h3:contains("書き込み")', true)
     1557    ->info('3-c. yamada cannot see "削除"')
     1558    ->checkElement('.commentList td:contains("削除")', false)
     1559    ->info('3-d. yamada cannot see "コメント書き込み"')
     1560    ->checkElement('#formCommunityTopicComment h3:contains("コメント書き込み")', false)
     1561  ->end()
     1562->get('/communityTopic/new/4')
     1563  ->info('4. yamada cannot access communityTopic_new')
     1564  ->isStatusCode(404)
     1565  ->with('request')->begin()
     1566    ->isParameter('module', 'communityTopic')
     1567    ->isParameter('action', 'new')
     1568  ->end()
     1569->get('/communityTopic/edit/4')
     1570  ->info('5. yamada cannot access communityTopic_edit')
     1571  ->isStatusCode(404)
     1572  ->with('request')->begin()
     1573    ->isParameter('module', 'communityTopic')
     1574    ->isParameter('action', 'edit')
     1575  ->end()
     1576->get('/communityTopic/comment/deleteConfirm/4')
     1577  ->info('6. yamada cannot access communityTopicComment_deleteConfirm')
     1578  ->isStatusCode(404)
     1579  ->with('request')->begin()
     1580    ->isParameter('module', 'communityTopicComment')
     1581    ->isParameter('action', 'deleteConfirm')
     1582  ->end()
     1583->get('/communityTopic/deleteConfirm/4')
     1584  ->info('7. yamada cannot access communityTopic_deleteConfirm')
     1585  ->isStatusCode(404)
     1586  ->with('request')->begin()
     1587    ->isParameter('module', 'communityTopic')
     1588    ->isParameter('action', 'deleteConfirm')
     1589  ->end();
Note: See TracChangeset for help on using the changeset viewer.