/test/functional/mobile_frontend/communityTopicActionsTest.php

https://github.com/kashiwasan/opCommunityTopicPlugin · PHP · 1315 lines · 1288 code · 22 blank · 5 comment · 0 complexity · ddf26e16533e20ef6f637a228081ee10 MD5 · raw file

  1. <?php
  2. ini_set('memory_limit', '256M');
  3. define('MOBILE_USER_AGENT', 'KDDI-CA39 UP.Browser/6.2.0.13.1.5 (FUI) MMP/2.0');
  4. $_SERVER['HTTP_USER_AGENT'] = MOBILE_USER_AGENT;
  5. function init()
  6. {
  7. include(dirname(__FILE__).'/../../bootstrap/functional.php');
  8. include(dirname(__FILE__).'/../../bootstrap/database.php');
  9. }
  10. function createUser($mailAddress, $user)
  11. {
  12. $params = array('authMailAddress' => array(
  13. 'mail_address' => $mailAddress,
  14. 'password' => 'password',
  15. ));
  16. $user->post('/member/login/authMode/MailAddress', $params);
  17. return $user;
  18. }
  19. init();
  20. $browser = new sfBrowser();
  21. $browser->setHttpHeader('User-Agent', MOBILE_USER_AGENT);
  22. $user = new sfTestFunctional($browser, new lime_test(612, new lime_output_color()));
  23. // create a test user: Mr_OpenPNE (community admin)
  24. //sfContext::getInstance()->getUser()->setCulture('en');
  25. $Mr_OpenPNE = createUser('sns@example.com', $user);
  26. $Mr_OpenPNE->getContext()->getUser()->setCulture('en');
  27. $Mr_OpenPNE
  28. ->info('public_flag: auth_commu_member, topic_authority: admin_only')
  29. ->get('/community/home/id/1')
  30. ->info('1. Mr. OpenPNE can access the community home')
  31. ->isStatusCode(200)
  32. ->with('request')->begin()
  33. ->isParameter('module', 'community')
  34. ->isParameter('action', 'home')
  35. ->end()
  36. ->get('/communityTopic/listCommunity/1')
  37. ->info('2. Mr. OpenPNE can access the community topic list')
  38. ->isStatusCode(200)
  39. ->with('request')->begin()
  40. ->isParameter('module', 'communityTopic')
  41. ->isParameter('action', 'listCommunity')
  42. ->end()
  43. ->get('/communityTopic/1')
  44. ->info('3. Mr. OpenPNE can access the community topic')
  45. ->isStatusCode(200)
  46. ->with('request')->begin()
  47. ->isParameter('module', 'communityTopic')
  48. ->isParameter('action', 'show')
  49. ->end()
  50. ->with('response')->begin()
  51. ->info('3-a. Mr. OpenPNE can see "編集"')
  52. ->checkElement('a:contains("Edit")', true)
  53. ->info('3-b. Mr. OpenPNE can see "コメント"')
  54. ->checkElement('center:contains("Comment")', true)
  55. ->info('3-c. Mr. OpenPNE can see "削除"')
  56. ->checkElement('#commentList tr td a:contains("Delete")', true)
  57. ->info('3-d. Mr. OpenPNE can see "コメント"')
  58. ->checkElement('#formTopicComment form label:contains("Comment")', true)
  59. ->end()
  60. ->click('書き込む', array('community_topic_comment' => array(
  61. 'body' => 'test',
  62. )))
  63. ->with('response')->debug()
  64. ->info('3-e. Mr. OpenPNE can create a new topic comment')
  65. ->isStatusCode(302)
  66. ->with('request')->begin()
  67. ->isParameter('module', 'communityTopicComment')
  68. ->isParameter('action', 'create')
  69. ->end()
  70. ->get('/communityTopic/new/1')
  71. ->info('4. Mr. OpenPNE can access communityTopic_new')
  72. ->isStatusCode(200)
  73. ->with('request')->begin()
  74. ->isParameter('module', 'communityTopic')
  75. ->isParameter('action', 'new')
  76. ->end()
  77. ->info('4a. Mr. OpenPNE can create a new topic')
  78. ->click('Send', array('community_topic' => array(
  79. 'name' => 'test',
  80. 'body' => 'test',
  81. )))
  82. ->isStatusCode(302)
  83. ->with('request')->begin()
  84. ->isParameter('module', 'communityTopic')
  85. ->isParameter('action', 'create')
  86. ->end()
  87. ->get('/communityTopic/edit/1')
  88. ->info('5. Mr. OpenPNE can access communityTopic_edit')
  89. ->isStatusCode(200)
  90. ->with('request')->begin()
  91. ->isParameter('module', 'communityTopic')
  92. ->isParameter('action', 'edit')
  93. ->end()
  94. ->info('5a. Mr. OpenPNE can edit the community topic')
  95. ->click('編集')
  96. ->isStatusCode(302)
  97. ->with('request')->begin()
  98. ->isParameter('module', 'communityTopic')
  99. ->isParameter('action', 'update')
  100. ->end()
  101. ->get('/communityTopic/comment/deleteConfirm/1')
  102. ->info('6. Mr. OpenPNE can access communityTopicComment_deleteConfirm')
  103. ->isStatusCode(200)
  104. ->with('request')->begin()
  105. ->isParameter('module', 'communityTopicComment')
  106. ->isParameter('action', 'deleteConfirm')
  107. ->end()
  108. ->info('6a. Mr. OpenPNE can delete the community topic comment')
  109. ->click('削除')
  110. ->isStatusCode(302)
  111. ->with('request')->begin()
  112. ->isParameter('module', 'communityTopicComment')
  113. ->isParameter('action', 'delete')
  114. ->end()
  115. ->get('/communityTopic/deleteConfirm/1')
  116. ->info('7. Mr. OpenPNE can access communityTopic_deleteConfirm')
  117. ->isStatusCode(200)
  118. ->with('request')->begin()
  119. ->isParameter('module', 'communityTopic')
  120. ->isParameter('action', 'deleteConfirm')
  121. ->end()
  122. ->info('7a. Mr. OpenPNE can delete the community topic')
  123. ->click('削除')
  124. ->isStatusCode(302)
  125. ->with('request')->begin()
  126. ->isParameter('module', 'communityTopic')
  127. ->isParameter('action', 'delete')
  128. ->end()
  129. ->info('public_flag: public, topic_authority: admin_only')
  130. ->get('/community/2')
  131. ->info('1. Mr. OpenPNE can access the community home')
  132. ->isStatusCode(200)
  133. ->with('request')->begin()
  134. ->isParameter('module', 'community')
  135. ->isParameter('action', 'home')
  136. ->end()
  137. ->with('response')->begin()
  138. ->info('1-a. Mr. OpenPNE can see "新着トピックリスト"')
  139. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  140. ->info('1-b. Mr. OpenPNE can see "トピックを作成する"')
  141. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  142. ->end()
  143. ->get('/communityTopic/listCommunity/2')
  144. ->info('2. Mr. OpenPNE can access the community topic list')
  145. ->isStatusCode(200)
  146. ->with('request')->begin()
  147. ->isParameter('module', 'communityTopic')
  148. ->isParameter('action', 'listCommunity')
  149. ->end()
  150. ->with('response')->begin()
  151. ->info('2-a. Mr. OpenPNE can see "トピックを作成する"')
  152. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  153. ->info('2-b. Mr. OpenPNE can see "トピック一覧"')
  154. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  155. ->info('2-c. Mr. OpenPNE can see two links')
  156. ->checkElement('.recentList dd a', true, array('count' => 2))
  157. ->end()
  158. ->get('/communityTopic/2')
  159. ->info('3. Mr. OpenPNE can access the community topic')
  160. ->isStatusCode(200)
  161. ->with('request')->begin()
  162. ->isParameter('module', 'communityTopic')
  163. ->isParameter('action', 'show')
  164. ->end()
  165. ->with('response')->begin()
  166. ->info('3-a. Mr. OpenPNE can see "編集"')
  167. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  168. ->info('3-b. Mr. OpenPNE can see "コメント"')
  169. ->checkElement('.commentList h3:contains("コメント")', true)
  170. ->info('3-c. Mr. OpenPNE can see "削除"')
  171. ->checkElement('.commentList div:contains("削除")', true)
  172. ->info('3-d. Mr. OpenPNE can see "コメントを書く"')
  173. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  174. ->end()
  175. ->info('3e. Mr. OpenPNE can create a new topic comment')
  176. ->click('送信', array('community_topic_comment' => array(
  177. 'body' => 'test',
  178. )))
  179. ->isStatusCode(302)
  180. ->with('request')->begin()
  181. ->isParameter('module', 'communityTopicComment')
  182. ->isParameter('action', 'create')
  183. ->end()
  184. ->get('/communityTopic/new/2')
  185. ->info('4. Mr. OpenPNE can access communityTopic_new')
  186. ->isStatusCode(200)
  187. ->with('request')->begin()
  188. ->isParameter('module', 'communityTopic')
  189. ->isParameter('action', 'new')
  190. ->end()
  191. ->info('4a. Mr. OpenPNE can create a new topic')
  192. ->click('送信', array('community_topic' => array(
  193. 'name' => 'test',
  194. 'body' => 'test',
  195. )))
  196. ->isStatusCode(302)
  197. ->with('request')->begin()
  198. ->isParameter('module', 'communityTopic')
  199. ->isParameter('action', 'create')
  200. ->end()
  201. ->get('/communityTopic/edit/2')
  202. ->info('5. Mr. OpenPNE can access communityTopic_edit')
  203. ->isStatusCode(200)
  204. ->with('request')->begin()
  205. ->isParameter('module', 'communityTopic')
  206. ->isParameter('action', 'edit')
  207. ->end()
  208. ->info('5a. Mr. OpenPNE can edit the community topic')
  209. ->click('送信')
  210. ->isStatusCode(302)
  211. ->with('request')->begin()
  212. ->isParameter('module', 'communityTopic')
  213. ->isParameter('action', 'update')
  214. ->end()
  215. ->get('/communityTopic/comment/deleteConfirm/2')
  216. ->info('6. Mr. OpenPNE can access communityTopicComment_deleteConfirm')
  217. ->isStatusCode(200)
  218. ->with('request')->begin()
  219. ->isParameter('module', 'communityTopicComment')
  220. ->isParameter('action', 'deleteConfirm')
  221. ->end()
  222. ->info('6a. Mr. OpenPNE can delete the community topic comment')
  223. ->click('削除')
  224. ->isStatusCode(302)
  225. ->with('request')->begin()
  226. ->isParameter('module', 'communityTopicComment')
  227. ->isParameter('action', 'delete')
  228. ->end()
  229. ->get('/communityTopic/deleteConfirm/2')
  230. ->info('7. Mr. OpenPNE can access communityTopic_deleteConfirm')
  231. ->isStatusCode(200)
  232. ->with('request')->begin()
  233. ->isParameter('module', 'communityTopic')
  234. ->isParameter('action', 'deleteConfirm')
  235. ->end()
  236. ->info('7a. Mr. OpenPNE can delete the community topic')
  237. ->click('削除')
  238. ->isStatusCode(302)
  239. ->with('request')->begin()
  240. ->isParameter('module', 'communityTopic')
  241. ->isParameter('action', 'delete')
  242. ->end()
  243. ->info('public_flag: auth_commu_member, topic_authority: public')
  244. ->get('/community/3')
  245. ->info('1. Mr. OpenPNE can access the community home')
  246. ->isStatusCode(200)
  247. ->with('request')->begin()
  248. ->isParameter('module', 'community')
  249. ->isParameter('action', 'home')
  250. ->end()
  251. ->with('response')->begin()
  252. ->info('1-a. Mr. OpenPNE can see "新着トピックリスト"')
  253. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  254. ->info('1-b. Mr. OpenPNE can see "トピックを作成する"')
  255. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  256. ->end()
  257. ->get('/communityTopic/listCommunity/3')
  258. ->info('2. Mr. OpenPNE can access the community topic list')
  259. ->isStatusCode(200)
  260. ->with('request')->begin()
  261. ->isParameter('module', 'communityTopic')
  262. ->isParameter('action', 'listCommunity')
  263. ->end()
  264. ->with('response')->begin()
  265. ->info('2-a. Mr. OpenPNE can see "トピックを作成する"')
  266. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  267. ->info('2-b. Mr. OpenPNE can see "トピック一覧"')
  268. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  269. ->info('2-c. Mr. OpenPNE can see two links')
  270. ->checkElement('.recentList dd a', true, array('count' => 2))
  271. ->end()
  272. ->get('/communityTopic/3')
  273. ->info('3. Mr. OpenPNE can access the community topic')
  274. ->isStatusCode(200)
  275. ->with('request')->begin()
  276. ->isParameter('module', 'communityTopic')
  277. ->isParameter('action', 'show')
  278. ->end()
  279. ->with('response')->begin()
  280. ->info('3-a. Mr. OpenPNE can see "編集"')
  281. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  282. ->info('3-b. Mr. OpenPNE can see "コメント"')
  283. ->checkElement('.commentList h3:contains("コメント")', true)
  284. ->info('3-c. Mr. OpenPNE can see "削除"')
  285. ->checkElement('.commentList div:contains("削除")', true)
  286. ->info('3-d. Mr. OpenPNE can see "コメントを書く"')
  287. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  288. ->end()
  289. ->info('3e. Mr. OpenPNE can create a new topic comment')
  290. ->click('送信', array('community_topic_comment' => array(
  291. 'body' => 'test',
  292. )))
  293. ->isStatusCode(302)
  294. ->with('request')->begin()
  295. ->isParameter('module', 'communityTopicComment')
  296. ->isParameter('action', 'create')
  297. ->end()
  298. ->get('/communityTopic/new/3')
  299. ->info('4. Mr. OpenPNE can access communityTopic_new')
  300. ->isStatusCode(200)
  301. ->with('request')->begin()
  302. ->isParameter('module', 'communityTopic')
  303. ->isParameter('action', 'new')
  304. ->end()
  305. ->info('4a. Mr. OpenPNE can create a new topic')
  306. ->click('送信', array('community_topic' => array(
  307. 'name' => 'test',
  308. 'body' => 'test',
  309. )))
  310. ->isStatusCode(302)
  311. ->with('request')->begin()
  312. ->isParameter('module', 'communityTopic')
  313. ->isParameter('action', 'create')
  314. ->end()
  315. ->get('/communityTopic/edit/3')
  316. ->info('5. Mr. OpenPNE can access communityTopic_edit')
  317. ->isStatusCode(200)
  318. ->with('request')->begin()
  319. ->isParameter('module', 'communityTopic')
  320. ->isParameter('action', 'edit')
  321. ->end()
  322. ->info('5a. Mr. OpenPNE can edit the community topic')
  323. ->click('送信')
  324. ->isStatusCode(302)
  325. ->with('request')->begin()
  326. ->isParameter('module', 'communityTopic')
  327. ->isParameter('action', 'update')
  328. ->end()
  329. ->get('/communityTopic/comment/deleteConfirm/3')
  330. ->info('6. Mr. OpenPNE can access communityTopicComment_deleteConfirm')
  331. ->isStatusCode(200)
  332. ->with('request')->begin()
  333. ->isParameter('module', 'communityTopicComment')
  334. ->isParameter('action', 'deleteConfirm')
  335. ->end()
  336. ->info('6a. Mr. OpenPNE can delete the community topic comment')
  337. ->click('削除')
  338. ->isStatusCode(302)
  339. ->with('request')->begin()
  340. ->isParameter('module', 'communityTopicComment')
  341. ->isParameter('action', 'delete')
  342. ->end()
  343. ->get('/communityTopic/deleteConfirm/3')
  344. ->info('7. Mr. OpenPNE can access communityTopic_deleteConfirm')
  345. ->isStatusCode(200)
  346. ->with('request')->begin()
  347. ->isParameter('module', 'communityTopic')
  348. ->isParameter('action', 'deleteConfirm')
  349. ->end()
  350. ->info('7a. Mr. OpenPNE can delete the community topic')
  351. ->click('削除')
  352. ->isStatusCode(302)
  353. ->with('request')->begin()
  354. ->isParameter('module', 'communityTopic')
  355. ->isParameter('action', 'delete')
  356. ->end()
  357. ->info('public_flag: public, topic_authority: public')
  358. ->get('/community/4')
  359. ->info('1. Mr. OpenPNE can access the community home')
  360. ->isStatusCode(200)
  361. ->with('request')->begin()
  362. ->isParameter('module', 'community')
  363. ->isParameter('action', 'home')
  364. ->end()
  365. ->with('response')->begin()
  366. ->info('1-a. Mr. OpenPNE can see "新着トピックリスト"')
  367. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  368. ->info('1-b. Mr. OpenPNE can see "トピックを作成する"')
  369. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  370. ->end()
  371. ->get('/communityTopic/listCommunity/4')
  372. ->info('2. Mr. OpenPNE can access the community topic list')
  373. ->isStatusCode(200)
  374. ->with('request')->begin()
  375. ->isParameter('module', 'communityTopic')
  376. ->isParameter('action', 'listCommunity')
  377. ->end()
  378. ->with('response')->begin()
  379. ->info('2-a. Mr. OpenPNE can see "トピックを作成する"')
  380. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  381. ->info('2-b. Mr. OpenPNE can see "トピック一覧"')
  382. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  383. ->info('2-c. Mr. OpenPNE can see two links')
  384. ->checkElement('.recentList dd a', true, array('count' => 2))
  385. ->end()
  386. ->get('/communityTopic/4')
  387. ->info('3. Mr. OpenPNE can access the community topic')
  388. ->isStatusCode(200)
  389. ->with('request')->begin()
  390. ->isParameter('module', 'communityTopic')
  391. ->isParameter('action', 'show')
  392. ->end()
  393. ->with('response')->begin()
  394. ->info('3-a. Mr. OpenPNE can see "編集"')
  395. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  396. ->info('3-b. Mr. OpenPNE can see "コメント"')
  397. ->checkElement('.commentList h3:contains("コメント")', true)
  398. ->info('3-c. Mr. OpenPNE can see "削除"')
  399. ->checkElement('.commentList div:contains("削除")', true)
  400. ->info('3-d. Mr. OpenPNE can see "コメントを書く"')
  401. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  402. ->end()
  403. ->info('3e. Mr. OpenPNE can create a new topic comment')
  404. ->click('送信', array('community_topic_comment' => array(
  405. 'body' => 'test',
  406. )))
  407. ->isStatusCode(302)
  408. ->with('request')->begin()
  409. ->isParameter('module', 'communityTopicComment')
  410. ->isParameter('action', 'create')
  411. ->end()
  412. ->get('/communityTopic/new/4')
  413. ->info('4. Mr. OpenPNE can access communityTopic_new')
  414. ->isStatusCode(200)
  415. ->with('request')->begin()
  416. ->isParameter('module', 'communityTopic')
  417. ->isParameter('action', 'new')
  418. ->end()
  419. ->info('4a. Mr. OpenPNE can create a new topic')
  420. ->click('送信', array('community_topic' => array(
  421. 'name' => 'test',
  422. 'body' => 'test',
  423. )))
  424. ->isStatusCode(302)
  425. ->with('request')->begin()
  426. ->isParameter('module', 'communityTopic')
  427. ->isParameter('action', 'create')
  428. ->end()
  429. ->get('/communityTopic/edit/4')
  430. ->info('5. Mr. OpenPNE can access communityTopic_edit')
  431. ->isStatusCode(200)
  432. ->with('request')->begin()
  433. ->isParameter('module', 'communityTopic')
  434. ->isParameter('action', 'edit')
  435. ->end()
  436. ->info('5a. Mr. OpenPNE can edit the community topic')
  437. ->click('送信')
  438. ->isStatusCode(302)
  439. ->with('request')->begin()
  440. ->isParameter('module', 'communityTopic')
  441. ->isParameter('action', 'update')
  442. ->end()
  443. ->get('/communityTopic/comment/deleteConfirm/4')
  444. ->info('6. Mr. OpenPNE can access communityTopicComment_deleteConfirm')
  445. ->isStatusCode(200)
  446. ->with('request')->begin()
  447. ->isParameter('module', 'communityTopicComment')
  448. ->isParameter('action', 'deleteConfirm')
  449. ->end()
  450. ->info('6a. Mr. OpenPNE can delete the community topic comment')
  451. ->click('削除')
  452. ->isStatusCode(302)
  453. ->with('request')->begin()
  454. ->isParameter('module', 'communityTopicComment')
  455. ->isParameter('action', 'delete')
  456. ->end()
  457. ->get('/communityTopic/deleteConfirm/4')
  458. ->info('7. Mr. OpenPNE can access communityTopic_deleteConfirm')
  459. ->isStatusCode(200)
  460. ->with('request')->begin()
  461. ->isParameter('module', 'communityTopic')
  462. ->isParameter('action', 'deleteConfirm')
  463. ->end()
  464. ->info('7a. Mr. OpenPNE can delete the community topic')
  465. ->click('削除')
  466. ->isStatusCode(302)
  467. ->with('request')->begin()
  468. ->isParameter('module', 'communityTopic')
  469. ->isParameter('action', 'delete')
  470. ->end();
  471. // create a test user: tanaka (topic author)
  472. init();
  473. $tanaka = createUser('tanaka@example.com', $user);
  474. $tanaka
  475. ->info('public_flag: auth_commu_member, topic_authority: admin_only')
  476. ->get('/community/1')
  477. ->info('1. Tanaka can access the community home')
  478. ->isStatusCode(200)
  479. ->with('request')->begin()
  480. ->isParameter('module', 'community')
  481. ->isParameter('action', 'home')
  482. ->end()
  483. ->with('response')->begin()
  484. ->info('1-a. Tanaka can see "新着トピックリスト"')
  485. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  486. ->info('1-b. Tanaka cannot see "トピックを作成する"')
  487. ->checkElement('#communityHome td a:contains("トピックを作成する")', false)
  488. ->end()
  489. ->get('/communityTopic/listCommunity/1')
  490. ->info('2. Tanaka can access the community topic list')
  491. ->isStatusCode(200)
  492. ->with('request')->begin()
  493. ->isParameter('module', 'communityTopic')
  494. ->isParameter('action', 'listCommunity')
  495. ->end()
  496. ->with('response')->begin()
  497. ->info('2-a. Tanaka cannot see "トピックを作成する"')
  498. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
  499. ->info('2-b. Tanaka can see "トピック一覧"')
  500. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  501. ->info('2-c. Tanaka can see two links')
  502. ->checkElement('.recentList dd a', true, array('count' => 2))
  503. ->end()
  504. ->get('/communityTopic/1')
  505. ->info('3. Tanaka can access the community topic')
  506. ->isStatusCode(200)
  507. ->with('request')->begin()
  508. ->isParameter('module', 'communityTopic')
  509. ->isParameter('action', 'show')
  510. ->end()
  511. ->with('response')->begin()
  512. ->info('3-a. Tanaka can see "編集"')
  513. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  514. ->info('3-b. Tanaka can see "コメント"')
  515. ->checkElement('.commentList h3:contains("コメント")', true)
  516. ->info('3-c. Tanaka can see "削除"')
  517. ->checkElement('.commentList div:contains("削除")', true)
  518. ->info('3-d. Tanaka can see "コメントを書く"')
  519. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  520. ->end()
  521. ->info('3e. Tanaka can create a new topic comment')
  522. ->click('送信', array('community_topic_comment' => array(
  523. 'body' => 'test',
  524. )))
  525. ->isStatusCode(302)
  526. ->with('request')->begin()
  527. ->isParameter('module', 'communityTopicComment')
  528. ->isParameter('action', 'create')
  529. ->end()
  530. ->get('/communityTopic/new/1')
  531. ->info('4. Tanaka cannot access communityTopic_new')
  532. ->isStatusCode(404)
  533. ->with('request')->begin()
  534. ->isParameter('module', 'communityTopic')
  535. ->isParameter('action', 'new')
  536. ->end()
  537. ->get('/communityTopic/edit/1')
  538. ->info('5. Tanaka can access communityTopic_edit')
  539. ->isStatusCode(200)
  540. ->with('request')->begin()
  541. ->isParameter('module', 'communityTopic')
  542. ->isParameter('action', 'edit')
  543. ->end()
  544. ->info('5a. Tanaka can edit the community topic')
  545. ->click('送信')
  546. ->isStatusCode(302)
  547. ->with('request')->begin()
  548. ->isParameter('module', 'communityTopic')
  549. ->isParameter('action', 'update')
  550. ->end()
  551. ->get('/communityTopic/comment/deleteConfirm/1')
  552. ->info('6. Tanaka can access communityTopicComment_deleteConfirm')
  553. ->isStatusCode(200)
  554. ->with('request')->begin()
  555. ->isParameter('module', 'communityTopicComment')
  556. ->isParameter('action', 'deleteConfirm')
  557. ->end()
  558. ->info('6a. Tanaka can delete the community topic comment')
  559. ->click('削除')
  560. ->isStatusCode(302)
  561. ->with('request')->begin()
  562. ->isParameter('module', 'communityTopicComment')
  563. ->isParameter('action', 'delete')
  564. ->end()
  565. ->get('/communityTopic/deleteConfirm/1')
  566. ->info('7. Tanaka can access communityTopic_deleteConfirm')
  567. ->isStatusCode(200)
  568. ->with('request')->begin()
  569. ->isParameter('module', 'communityTopic')
  570. ->isParameter('action', 'deleteConfirm')
  571. ->end()
  572. ->info('7a. Tanaka can delete the community topic')
  573. ->click('削除')
  574. ->isStatusCode(302)
  575. ->with('request')->begin()
  576. ->isParameter('module', 'communityTopic')
  577. ->isParameter('action', 'delete')
  578. ->end()
  579. ->info('public_flag: public, topic_authority: admin_only')
  580. ->get('/community/2')
  581. ->info('1. Tanaka can access the community home')
  582. ->isStatusCode(200)
  583. ->with('request')->begin()
  584. ->isParameter('module', 'community')
  585. ->isParameter('action', 'home')
  586. ->end()
  587. ->with('response')->begin()
  588. ->info('1-a. Tanaka can see "新着トピックリスト"')
  589. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  590. ->info('1-b. Tanaka cannot see "トピックを作成する"')
  591. ->checkElement('#communityHome td a:contains("トピックを作成する")', false)
  592. ->end()
  593. ->get('/communityTopic/listCommunity/2')
  594. ->info('2. Tanaka can access the community topic list')
  595. ->isStatusCode(200)
  596. ->with('request')->begin()
  597. ->isParameter('module', 'communityTopic')
  598. ->isParameter('action', 'listCommunity')
  599. ->end()
  600. ->with('response')->begin()
  601. ->info('2-a. Tanaka cannot see "トピックを作成する"')
  602. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
  603. ->info('2-b. Tanaka can see "トピック一覧"')
  604. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  605. ->info('2-c. Tanaka can see two links')
  606. ->checkElement('.recentList dd a', true, array('count' => 2))
  607. ->end()
  608. ->get('/communityTopic/2')
  609. ->info('3. Tanaka can access the community topic')
  610. ->isStatusCode(200)
  611. ->with('request')->begin()
  612. ->isParameter('module', 'communityTopic')
  613. ->isParameter('action', 'show')
  614. ->end()
  615. ->with('response')->begin()
  616. ->info('3-a. Tanaka can see "編集"')
  617. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  618. ->info('3-b. Tanaka can see "コメント"')
  619. ->checkElement('.commentList h3:contains("コメント")', true)
  620. ->info('3-c. Tanaka can see "削除"')
  621. ->checkElement('.commentList div:contains("削除")', true)
  622. ->info('3-d. Tanaka can see "コメントを書く"')
  623. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  624. ->end()
  625. ->info('3e. Tanaka can create a new topic comment')
  626. ->click('送信', array('community_topic_comment' => array(
  627. 'body' => 'test',
  628. )))
  629. ->isStatusCode(302)
  630. ->with('request')->begin()
  631. ->isParameter('module', 'communityTopicComment')
  632. ->isParameter('action', 'create')
  633. ->end()
  634. ->get('/communityTopic/new/2')
  635. ->info('4. Tanaka cannot access communityTopic_new')
  636. ->isStatusCode(404)
  637. ->with('request')->begin()
  638. ->isParameter('module', 'communityTopic')
  639. ->isParameter('action', 'new')
  640. ->end()
  641. ->get('/communityTopic/edit/2')
  642. ->info('5. Tanaka can access communityTopic_edit')
  643. ->isStatusCode(200)
  644. ->with('request')->begin()
  645. ->isParameter('module', 'communityTopic')
  646. ->isParameter('action', 'edit')
  647. ->end()
  648. ->info('5a. Tanaka can edit the community topic')
  649. ->click('送信')
  650. ->isStatusCode(302)
  651. ->with('request')->begin()
  652. ->isParameter('module', 'communityTopic')
  653. ->isParameter('action', 'update')
  654. ->end()
  655. ->get('/communityTopic/comment/deleteConfirm/2')
  656. ->info('6. Tanaka can access communityTopicComment_deleteConfirm')
  657. ->isStatusCode(200)
  658. ->with('request')->begin()
  659. ->isParameter('module', 'communityTopicComment')
  660. ->isParameter('action', 'deleteConfirm')
  661. ->end()
  662. ->info('6a. Tanaka can delete the community topic comment')
  663. ->click('削除')
  664. ->isStatusCode(302)
  665. ->with('request')->begin()
  666. ->isParameter('module', 'communityTopicComment')
  667. ->isParameter('action', 'delete')
  668. ->end()
  669. ->get('/communityTopic/deleteConfirm/2')
  670. ->info('7. Tanaka can access communityTopic_deleteConfirm')
  671. ->isStatusCode(200)
  672. ->with('request')->begin()
  673. ->isParameter('module', 'communityTopic')
  674. ->isParameter('action', 'deleteConfirm')
  675. ->end()
  676. ->info('7a. Tanaka can delete the community topic')
  677. ->click('削除')
  678. ->isStatusCode(302)
  679. ->with('request')->begin()
  680. ->isParameter('module', 'communityTopic')
  681. ->isParameter('action', 'delete')
  682. ->end()
  683. ->info('public_flag: auth_commu_member, topic_authority: public')
  684. ->get('/community/3')
  685. ->info('1. Tanaka can access the community home')
  686. ->isStatusCode(200)
  687. ->with('request')->begin()
  688. ->isParameter('module', 'community')
  689. ->isParameter('action', 'home')
  690. ->end()
  691. ->with('response')->begin()
  692. ->info('1-a. Tanaka can see "新着トピックリスト"')
  693. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  694. ->info('1-b. Tanaka can see "トピックを作成する"')
  695. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  696. ->end()
  697. ->get('/communityTopic/listCommunity/3')
  698. ->info('2. Tanaka can access the community topic list')
  699. ->isStatusCode(200)
  700. ->with('request')->begin()
  701. ->isParameter('module', 'communityTopic')
  702. ->isParameter('action', 'listCommunity')
  703. ->end()
  704. ->with('response')->begin()
  705. ->info('2-a. Tanaka can see "トピックを作成する"')
  706. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  707. ->info('2-b. Tanaka can see "トピック一覧"')
  708. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  709. ->info('2-c. Tanaka can see two links')
  710. ->checkElement('.recentList dd a', true, array('count' => 2))
  711. ->end()
  712. ->get('/communityTopic/3')
  713. ->info('3. Tanaka can access the community topic')
  714. ->isStatusCode(200)
  715. ->with('request')->begin()
  716. ->isParameter('module', 'communityTopic')
  717. ->isParameter('action', 'show')
  718. ->end()
  719. ->with('response')->begin()
  720. ->info('3-a. Tanaka can see "編集"')
  721. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  722. ->info('3-b. Tanaka can see "コメント"')
  723. ->checkElement('.commentList h3:contains("コメント")', true)
  724. ->info('3-c. Tanaka can see "削除"')
  725. ->checkElement('.commentList div:contains("削除")', true)
  726. ->info('3-d. Tanaka can see "コメントを書く"')
  727. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  728. ->end()
  729. ->info('3e. Tanaka can create a new topic comment')
  730. ->click('送信', array('community_topic_comment' => array(
  731. 'body' => 'test',
  732. )))
  733. ->isStatusCode(302)
  734. ->with('request')->begin()
  735. ->isParameter('module', 'communityTopicComment')
  736. ->isParameter('action', 'create')
  737. ->end()
  738. ->get('/communityTopic/new/3')
  739. ->info('4. Tanaka can access communityTopic_new')
  740. ->isStatusCode(200)
  741. ->with('request')->begin()
  742. ->isParameter('module', 'communityTopic')
  743. ->isParameter('action', 'new')
  744. ->end()
  745. ->info('4a. Tanaka can create a new topic')
  746. ->click('送信', array('community_topic' => array(
  747. 'name' => 'test',
  748. 'body' => 'test',
  749. )))
  750. ->isStatusCode(302)
  751. ->with('request')->begin()
  752. ->isParameter('module', 'communityTopic')
  753. ->isParameter('action', 'create')
  754. ->end()
  755. ->get('/communityTopic/edit/3')
  756. ->info('5. Tanaka can access communityTopic_edit')
  757. ->isStatusCode(200)
  758. ->with('request')->begin()
  759. ->isParameter('module', 'communityTopic')
  760. ->isParameter('action', 'edit')
  761. ->end()
  762. ->info('5a. Tanaka can edit the community topic')
  763. ->click('送信')
  764. ->isStatusCode(302)
  765. ->with('request')->begin()
  766. ->isParameter('module', 'communityTopic')
  767. ->isParameter('action', 'update')
  768. ->end()
  769. ->get('/communityTopic/comment/deleteConfirm/3')
  770. ->info('6. Tanaka can access communityTopicComment_deleteConfirm')
  771. ->isStatusCode(200)
  772. ->with('request')->begin()
  773. ->isParameter('module', 'communityTopicComment')
  774. ->isParameter('action', 'deleteConfirm')
  775. ->end()
  776. ->info('6a. Tanaka can delete the community topic comment')
  777. ->click('削除')
  778. ->isStatusCode(302)
  779. ->with('request')->begin()
  780. ->isParameter('module', 'communityTopicComment')
  781. ->isParameter('action', 'delete')
  782. ->end()
  783. ->get('/communityTopic/deleteConfirm/3')
  784. ->info('7. Tanaka can access communityTopic_deleteConfirm')
  785. ->isStatusCode(200)
  786. ->with('request')->begin()
  787. ->isParameter('module', 'communityTopic')
  788. ->isParameter('action', 'deleteConfirm')
  789. ->end()
  790. ->info('7a. Tanaka can delete the community topic')
  791. ->click('削除')
  792. ->isStatusCode(302)
  793. ->with('request')->begin()
  794. ->isParameter('module', 'communityTopic')
  795. ->isParameter('action', 'delete')
  796. ->end()
  797. ->info('public_flag: public, topic_authority: public')
  798. ->get('/community/4')
  799. ->info('1. Tanaka can access the community home')
  800. ->isStatusCode(200)
  801. ->with('request')->begin()
  802. ->isParameter('module', 'community')
  803. ->isParameter('action', 'home')
  804. ->end()
  805. ->with('response')->begin()
  806. ->info('1-a. Tanaka can see "新着トピックリスト"')
  807. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  808. ->info('1-b. Tanaka can see "トピックを作成する"')
  809. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  810. ->end()
  811. ->get('/communityTopic/listCommunity/4')
  812. ->info('2. Tanaka can access the community topic list')
  813. ->isStatusCode(200)
  814. ->with('request')->begin()
  815. ->isParameter('module', 'communityTopic')
  816. ->isParameter('action', 'listCommunity')
  817. ->end()
  818. ->with('response')->begin()
  819. ->info('2-a. Tanaka can see "トピックを作成する"')
  820. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  821. ->info('2-b. Tanaka can see "トピック一覧"')
  822. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  823. ->info('2-c. Tanaka can see two links')
  824. ->checkElement('.recentList dd a', true, array('count' => 2))
  825. ->end()
  826. ->get('/communityTopic/4')
  827. ->info('3. Tanaka can access the community topic')
  828. ->isStatusCode(200)
  829. ->with('request')->begin()
  830. ->isParameter('module', 'communityTopic')
  831. ->isParameter('action', 'show')
  832. ->end()
  833. ->with('response')->begin()
  834. ->info('3-a. Tanaka can see "編集"')
  835. ->checkElement('.topicDetailBox .operation input[value="編集"]', true)
  836. ->info('3-b. Tanaka can see "コメント"')
  837. ->checkElement('.commentList h3:contains("コメント")', true)
  838. ->info('3-c. Tanaka can see "削除"')
  839. ->checkElement('.commentList div:contains("削除")', true)
  840. ->info('3-d. Tanaka can see "コメントを書く"')
  841. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  842. ->end()
  843. ->info('3e. Tanaka can create a new topic comment')
  844. ->click('送信', array('community_topic_comment' => array(
  845. 'body' => 'test',
  846. )))
  847. ->isStatusCode(302)
  848. ->with('request')->begin()
  849. ->isParameter('module', 'communityTopicComment')
  850. ->isParameter('action', 'create')
  851. ->end()
  852. ->get('/communityTopic/new/4')
  853. ->info('4. Tanaka can access communityTopic_new')
  854. ->isStatusCode(200)
  855. ->with('request')->begin()
  856. ->isParameter('module', 'communityTopic')
  857. ->isParameter('action', 'new')
  858. ->end()
  859. ->info('4a. Tanaka can create a new topic')
  860. ->click('送信', array('community_topic' => array(
  861. 'name' => 'test',
  862. 'body' => 'test',
  863. )))
  864. ->isStatusCode(302)
  865. ->with('request')->begin()
  866. ->isParameter('module', 'communityTopic')
  867. ->isParameter('action', 'create')
  868. ->end()
  869. ->get('/communityTopic/edit/4')
  870. ->info('5. Tanaka can access communityTopic_edit')
  871. ->isStatusCode(200)
  872. ->with('request')->begin()
  873. ->isParameter('module', 'communityTopic')
  874. ->isParameter('action', 'edit')
  875. ->end()
  876. ->info('5a. Tanaka can edit the community topic')
  877. ->click('送信')
  878. ->isStatusCode(302)
  879. ->with('request')->begin()
  880. ->isParameter('module', 'communityTopic')
  881. ->isParameter('action', 'update')
  882. ->end()
  883. ->get('/communityTopic/comment/deleteConfirm/4')
  884. ->info('6. Tanaka can access communityTopicComment_deleteConfirm')
  885. ->isStatusCode(200)
  886. ->with('request')->begin()
  887. ->isParameter('module', 'communityTopicComment')
  888. ->isParameter('action', 'deleteConfirm')
  889. ->end()
  890. ->info('6a. Tanaka can delete the community topic comment')
  891. ->click('削除')
  892. ->isStatusCode(302)
  893. ->with('request')->begin()
  894. ->isParameter('module', 'communityTopicComment')
  895. ->isParameter('action', 'delete')
  896. ->end()
  897. ->get('/communityTopic/deleteConfirm/4')
  898. ->info('7. Tanaka can access communityTopic_deleteConfirm')
  899. ->isStatusCode(200)
  900. ->with('request')->begin()
  901. ->isParameter('module', 'communityTopic')
  902. ->isParameter('action', 'deleteConfirm')
  903. ->end()
  904. ->info('7a. Tanaka can delete the community topic')
  905. ->click('削除')
  906. ->isStatusCode(302)
  907. ->with('request')->begin()
  908. ->isParameter('module', 'communityTopic')
  909. ->isParameter('action', 'delete')
  910. ->end();
  911. // create a test user: sasaki (community member)
  912. init();
  913. $sasaki = createUser('sasaki@example.com', $user);
  914. $sasaki
  915. ->info('public_flag: auth_commu_member, topic_authority: admin_only')
  916. ->get('/community/1')
  917. ->info('1. sasaki can access the community home')
  918. ->isStatusCode(200)
  919. ->with('request')->begin()
  920. ->isParameter('module', 'community')
  921. ->isParameter('action', 'home')
  922. ->end()
  923. ->with('response')->begin()
  924. ->info('1-a. sasaki can see "新着トピックリスト"')
  925. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  926. ->info('1-b. sasaki cannot see "トピックを作成する"')
  927. ->checkElement('#communityHome td a:contains("トピックを作成する")', false)
  928. ->end()
  929. ->get('/communityTopic/listCommunity/1')
  930. ->info('2. sasaki can access the community topic list')
  931. ->isStatusCode(200)
  932. ->with('request')->begin()
  933. ->isParameter('module', 'communityTopic')
  934. ->isParameter('action', 'listCommunity')
  935. ->end()
  936. ->with('response')->begin()
  937. ->info('2-a. sasaki cannot see "トピックを作成する"')
  938. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
  939. ->info('2-b. sasaki can see "トピック一覧"')
  940. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  941. ->info('2-c. sasaki can see two links')
  942. ->checkElement('.recentList dd a', true, array('count' => 2))
  943. ->end()
  944. ->get('/communityTopic/1')
  945. ->info('3. sasaki can access the community topic')
  946. ->isStatusCode(200)
  947. ->with('request')->begin()
  948. ->isParameter('module', 'communityTopic')
  949. ->isParameter('action', 'show')
  950. ->end()
  951. ->with('response')->begin()
  952. ->info('3-a. sasaki cannot see "編集"')
  953. ->checkElement('.topicDetailBox .operation input[value="編集"]', false)
  954. ->info('3-b. sasaki can see "コメント"')
  955. ->checkElement('.commentList h3:contains("コメント")', true)
  956. ->info('3-c. sasaki cannot see "削除"')
  957. ->checkElement('.commentList div:contains("削除")', false)
  958. ->info('3-d. sasaki can see "コメントを書く"')
  959. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  960. ->end()
  961. ->info('3e. sasaki can create a new topic comment')
  962. ->click('送信', array('community_topic_comment' => array(
  963. 'body' => 'test',
  964. )))
  965. ->isStatusCode(302)
  966. ->with('request')->begin()
  967. ->isParameter('module', 'communityTopicComment')
  968. ->isParameter('action', 'create')
  969. ->end()
  970. ->get('/communityTopic/new/1')
  971. ->info('4. sasaki cannot access communityTopic_new')
  972. ->isStatusCode(404)
  973. ->with('request')->begin()
  974. ->isParameter('module', 'communityTopic')
  975. ->isParameter('action', 'new')
  976. ->end()
  977. ->get('/communityTopic/edit/1')
  978. ->info('5. sasaki cannot access communityTopic_edit')
  979. ->isStatusCode(404)
  980. ->with('request')->begin()
  981. ->isParameter('module', 'communityTopic')
  982. ->isParameter('action', 'edit')
  983. ->end()
  984. ->get('/communityTopic/comment/deleteConfirm/1')
  985. ->info('6. sasaki cannot access communityTopicComment_deleteConfirm')
  986. ->isStatusCode(404)
  987. ->with('request')->begin()
  988. ->isParameter('module', 'communityTopicComment')
  989. ->isParameter('action', 'deleteConfirm')
  990. ->end()
  991. ->get('/communityTopic/deleteConfirm/1')
  992. ->info('7. sasaki cannot access communityTopic_deleteConfirm')
  993. ->isStatusCode(404)
  994. ->with('request')->begin()
  995. ->isParameter('module', 'communityTopic')
  996. ->isParameter('action', 'deleteConfirm')
  997. ->end()
  998. ->info('public_flag: public, topic_authority: admin_only')
  999. ->get('/community/2')
  1000. ->info('1. sasaki can access the community home')
  1001. ->isStatusCode(200)
  1002. ->with('request')->begin()
  1003. ->isParameter('module', 'community')
  1004. ->isParameter('action', 'home')
  1005. ->end()
  1006. ->with('response')->begin()
  1007. ->info('1-a. sasaki can see "新着トピックリスト"')
  1008. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  1009. ->info('1-b. sasaki cannot see "トピックを作成する"')
  1010. ->checkElement('#communityHome td a:contains("トピックを作成する")', false)
  1011. ->end()
  1012. ->get('/communityTopic/listCommunity/2')
  1013. ->info('2. sasaki can access the community topic list')
  1014. ->isStatusCode(200)
  1015. ->with('request')->begin()
  1016. ->isParameter('module', 'communityTopic')
  1017. ->isParameter('action', 'listCommunity')
  1018. ->end()
  1019. ->with('response')->begin()
  1020. ->info('2-a. sasaki cannot see "トピックを作成する"')
  1021. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', false)
  1022. ->info('2-b. sasaki can see "トピック一覧"')
  1023. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  1024. ->info('2-c. sasaki can see two links')
  1025. ->checkElement('.recentList dd a', true, array('count' => 2))
  1026. ->end()
  1027. ->get('/communityTopic/2')
  1028. ->info('3. sasaki can access the community topic')
  1029. ->isStatusCode(200)
  1030. ->with('request')->begin()
  1031. ->isParameter('module', 'communityTopic')
  1032. ->isParameter('action', 'show')
  1033. ->end()
  1034. ->with('response')->begin()
  1035. ->info('3-a. sasaki cannot see "編集"')
  1036. ->checkElement('.topicDetailBox .operation input[value="編集"]', false)
  1037. ->info('3-b. sasaki can see "コメント"')
  1038. ->checkElement('.commentList h3:contains("コメント")', true)
  1039. ->info('3-c. sasaki cannot see "削除"')
  1040. ->checkElement('.commentList div:contains("削除")', false)
  1041. ->info('3-d. sasaki can see "コメントを書く"')
  1042. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  1043. ->end()
  1044. ->info('3e. sasaki can create a new topic comment')
  1045. ->click('送信', array('community_topic_comment' => array(
  1046. 'body' => 'test',
  1047. )))
  1048. ->isStatusCode(302)
  1049. ->with('request')->begin()
  1050. ->isParameter('module', 'communityTopicComment')
  1051. ->isParameter('action', 'create')
  1052. ->end()
  1053. ->get('/communityTopic/new/2')
  1054. ->info('4. sasaki cannot access communityTopic_new')
  1055. ->isStatusCode(404)
  1056. ->with('request')->begin()
  1057. ->isParameter('module', 'communityTopic')
  1058. ->isParameter('action', 'new')
  1059. ->end()
  1060. ->get('/communityTopic/edit/2')
  1061. ->info('5. sasaki cannot access communityTopic_edit')
  1062. ->isStatusCode(404)
  1063. ->with('request')->begin()
  1064. ->isParameter('module', 'communityTopic')
  1065. ->isParameter('action', 'edit')
  1066. ->end()
  1067. ->get('/communityTopic/comment/deleteConfirm/2')
  1068. ->info('6. sasaki cannot access communityTopicComment_deleteConfirm')
  1069. ->isStatusCode(404)
  1070. ->with('request')->begin()
  1071. ->isParameter('module', 'communityTopicComment')
  1072. ->isParameter('action', 'deleteConfirm')
  1073. ->end()
  1074. ->get('/communityTopic/deleteConfirm/2')
  1075. ->info('7. sasaki cannot access communityTopic_deleteConfirm')
  1076. ->isStatusCode(404)
  1077. ->with('request')->begin()
  1078. ->isParameter('module', 'communityTopic')
  1079. ->isParameter('action', 'deleteConfirm')
  1080. ->end()
  1081. ->info('public_flag: auth_commu_member, topic_authority: public')
  1082. ->get('/community/3')
  1083. ->info('1. sasaki can access the community home')
  1084. ->isStatusCode(200)
  1085. ->with('request')->begin()
  1086. ->isParameter('module', 'community')
  1087. ->isParameter('action', 'home')
  1088. ->end()
  1089. ->with('response')->begin()
  1090. ->info('1-a. sasaki can see "新着トピックリスト"')
  1091. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  1092. ->info('1-b. sasaki can see "トピックを作成する"')
  1093. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  1094. ->end()
  1095. ->get('/communityTopic/listCommunity/3')
  1096. ->info('2. sasaki can access the community topic list')
  1097. ->isStatusCode(200)
  1098. ->with('request')->begin()
  1099. ->isParameter('module', 'communityTopic')
  1100. ->isParameter('action', 'listCommunity')
  1101. ->end()
  1102. ->with('response')->begin()
  1103. ->info('2-a. sasaki can see "トピックを作成する"')
  1104. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  1105. ->info('2-b. sasaki can see "トピック一覧"')
  1106. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  1107. ->info('2-c. sasaki can see two links')
  1108. ->checkElement('.recentList dd a', true, array('count' => 2))
  1109. ->end()
  1110. ->get('/communityTopic/3')
  1111. ->info('3. sasaki can access the community topic')
  1112. ->isStatusCode(200)
  1113. ->with('request')->begin()
  1114. ->isParameter('module', 'communityTopic')
  1115. ->isParameter('action', 'show')
  1116. ->end()
  1117. ->with('response')->begin()
  1118. ->info('3-a. sasaki cannot see "編集"')
  1119. ->checkElement('.topicDetailBox .operation input[value="編集"]', false)
  1120. ->info('3-b. sasaki can see "コメント"')
  1121. ->checkElement('.commentList h3:contains("コメント")', true)
  1122. ->info('3-c. sasaki cannot see "削除"')
  1123. ->checkElement('.commentList div:contains("削除")', false)
  1124. ->info('3-d. sasaki can see "コメントを書く"')
  1125. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  1126. ->end()
  1127. ->info('3e. sasaki can create a new topic comment')
  1128. ->click('送信', array('community_topic_comment' => array(
  1129. 'body' => 'test',
  1130. )))
  1131. ->isStatusCode(302)
  1132. ->with('request')->begin()
  1133. ->isParameter('module', 'communityTopicComment')
  1134. ->isParameter('action', 'create')
  1135. ->end()
  1136. ->get('/communityTopic/new/3')
  1137. ->info('4. sasaki can access communityTopic_new')
  1138. ->isStatusCode(200)
  1139. ->with('request')->begin()
  1140. ->isParameter('module', 'communityTopic')
  1141. ->isParameter('action', 'new')
  1142. ->end()
  1143. ->info('4a. sasaki can create a new topic')
  1144. ->click('送信', array('community_topic' => array(
  1145. 'name' => 'test',
  1146. 'body' => 'test',
  1147. )))
  1148. ->isStatusCode(302)
  1149. ->with('request')->begin()
  1150. ->isParameter('module', 'communityTopic')
  1151. ->isParameter('action', 'create')
  1152. ->end()
  1153. ->get('/communityTopic/edit/3')
  1154. ->info('5. sasaki cannot access communityTopic_edit')
  1155. ->isStatusCode(404)
  1156. ->with('request')->begin()
  1157. ->isParameter('module', 'communityTopic')
  1158. ->isParameter('action', 'edit')
  1159. ->end()
  1160. ->get('/communityTopic/comment/deleteConfirm/3')
  1161. ->info('6. sasaki can access communityTopicComment_deleteConfirm')
  1162. ->isStatusCode(404)
  1163. ->with('request')->begin()
  1164. ->isParameter('module', 'communityTopicComment')
  1165. ->isParameter('action', 'deleteConfirm')
  1166. ->end()
  1167. ->get('/communityTopic/deleteConfirm/3')
  1168. ->info('7. sasaki cannot access communityTopic_deleteConfirm')
  1169. ->isStatusCode(404)
  1170. ->with('request')->begin()
  1171. ->isParameter('module', 'communityTopic')
  1172. ->isParameter('action', 'deleteConfirm')
  1173. ->end()
  1174. ->info('public_flag: public, topic_authority: public')
  1175. ->get('/community/4')
  1176. ->info('1. sasaki can access the community home')
  1177. ->isStatusCode(200)
  1178. ->with('request')->begin()
  1179. ->isParameter('module', 'community')
  1180. ->isParameter('action', 'home')
  1181. ->end()
  1182. ->with('response')->begin()
  1183. ->info('1-a. sasaki can see "新着トピックリスト"')
  1184. ->checkElement('#communityHome th:contains("新着トピックリスト")', true)
  1185. ->info('1-b. sasaki can see "トピックを作成する"')
  1186. ->checkElement('#communityHome td a:contains("トピックを作成する")', true)
  1187. ->end()
  1188. ->get('/communityTopic/listCommunity/4')
  1189. ->info('2. sasaki can access the community topic list')
  1190. ->isStatusCode(200)
  1191. ->with('request')->begin()
  1192. ->isParameter('module', 'communityTopic')
  1193. ->isParameter('action', 'listCommunity')
  1194. ->end()
  1195. ->with('response')->begin()
  1196. ->info('2-a. sasaki can see "トピックを作成する"')
  1197. ->checkElement('#communityTopicList h3:contains("トピックを作成する")', true)
  1198. ->info('2-b. sasaki can see "トピック一覧"')
  1199. ->checkElement('.recentList h3:contains("トピック一覧")', true)
  1200. ->info('2-c. sasaki can see two links')
  1201. ->checkElement('.recentList dd a', true, array('count' => 2))
  1202. ->end()
  1203. ->get('/communityTopic/4')
  1204. ->info('3. sasaki can access the community topic')
  1205. ->isStatusCode(200)
  1206. ->with('request')->begin()
  1207. ->isParameter('module', 'communityTopic')
  1208. ->isParameter('action', 'show')
  1209. ->end()
  1210. ->with('response')->begin()
  1211. ->info('3-a. sasaki cannot see "編集"')
  1212. ->checkElement('.topicDetailBox .operation input[value="編集"]', false)
  1213. ->info('3-b. sasaki can see "コメント"')
  1214. ->checkElement('.commentList h3:contains("コメント")', true)
  1215. ->info('3-c. sasaki cannot see "削除"')
  1216. ->checkElement('.commentList div:contains("削除")', false)
  1217. ->info('3-d. sasaki can see "コメントを書く"')
  1218. ->checkElement('#formCommunityTopicComment h3:contains("コメントを書く")', true)
  1219. ->end()
  1220. ->info('3e. sasaki can create a new topic comment')
  1221. ->click('送信', array('community_topic_comment' => array(
  1222. 'body' => 'test',
  1223. )))
  1224. ->isStatusCode(302)
  1225. ->with('request')->begin()
  1226. ->isParameter('module', 'communityTopicComment')
  1227. ->isParameter('action', 'create')
  1228. ->end()
  1229. ->get('/communityTopic/new/4')
  1230. ->info('4. sasaki can access communityTopic_new')
  1231. ->isStatusCode(200)
  1232. ->with('request')->begin()
  1233. ->isParameter('module', 'communityTopic')
  1234. ->isParameter('action', 'new')
  1235. ->end()
  1236. ->info('4a. sasaki can create a new topic')
  1237. ->click('送信', array('community_topic' => array(
  1238. 'name' => 'test',
  1239. 'body' => 'test',
  1240. )))
  1241. ->isStatusCode(302)
  1242. ->with('request')->begin()
  1243. ->isParameter('module', 'communityTopic')
  1244. ->isParameter('action', 'create')
  1245. ->end()
  1246. ->get('/communityTopic/edit/4')
  1247. ->info('5. sasaki cannot access communityTopic_edit')
  1248. ->isStatusCode(404)
  1249. ->with('request')->begin()
  1250. ->isParameter('module', 'communityTopic')
  1251. ->isParameter('action', 'edit')
  1252. ->end()
  1253. ->get('/communityTopic/comment/deleteConfirm/4')
  1254. ->info('6. sasaki cannot access communityTopicComment_deleteConfirm')
  1255. ->isStatusCode(404)
  1256. ->with('request')->begin()
  1257. ->isParameter('module', 'communityTopicComment')
  1258. ->isParameter('action', 'deleteConfirm')
  1259. ->end()
  1260. ->get('/communityTopic/deleteConfirm/4')
  1261. ->info('7. sasaki cannot access communityTopic_deleteConfirm')
  1262. ->isStatusCode(404)
  1263. ->with('request')->begin()
  1264. ->isParameter('module', 'communityTopic')
  1265. ->isParameter('action', 'deleteConfirm')
  1266. ->end();
  1267. // create a test user: yamada (non-community member)
  1268. init();
  1269. $yamada = createUser('yamada@example.com', $user);
  1270. $yamada
  1271. ->info('public_flag: auth_commu_member, topic_authority: admin_only')
  1272. ->get('/community/1')
  1273. ->info('1. yamada can access the community home')
  1274. ->isStatusCode(200)
  1275. ->with('request')->begin()
  1276. ->isParameter('module', 'community')
  1277. ->isParameter('action', 'home')
  1278. ->end()
  1279. ->with('response')->begin()
  1280. ->info('1-a. yamada cannot see "新着トピックリスト"')
  1281. ->checkElement('#communityHome th:contains("新着トピックリスト")', false)
  1282. ->info('1-b. yamada cannot see "トピックを作成する"')
  1283. ->checkElement('#communityHome td a:contains("トピックを作成する")', false)
  1284. ->end()
  1285. ->get('/communityTopic/listCommunity/1')
  1286. ->info('2. yamada cannot access the community topic list')
  1287. ->isStatusCode(404)
  1288. ->with('request')->begin()
  1289. ->isParameter('module', 'communityTopic')
  1290. ->isParameter('action', 'listCommunity')
  1291. ->end()
  1292. ->get('/communityTopic/1')
  1293. ->info('3. yamada cann