|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + +------------------------------------------------------------------------+ |
| 5 | + | Phalcon forum | |
| 6 | + +------------------------------------------------------------------------+ |
| 7 | + | Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) | |
| 8 | + +------------------------------------------------------------------------+ |
| 9 | + | This source file is subject to the New BSD License that is bundled | |
| 10 | + | with this package in the file LICENSE.txt. | |
| 11 | + | | |
| 12 | + | If you did not receive a copy of the license and are unable to | |
| 13 | + | obtain it through the world-wide-web, please send an email | |
| 14 | + | to [email protected] so we can send you a copy immediately. | |
| 15 | + +------------------------------------------------------------------------+ |
| 16 | + | Authors: Sergii Svyrydenko <[email protected]> | |
| 17 | + +------------------------------------------------------------------------+ |
| 18 | + */ |
| 19 | + |
| 20 | +use Helper\Post; |
| 21 | +use Helper\User; |
| 22 | +use Helper\Category; |
| 23 | + |
| 24 | +class PostAndReplyTestCest |
| 25 | +{ |
| 26 | + /** @var Category */ |
| 27 | + protected $category; |
| 28 | + |
| 29 | + /** @var User */ |
| 30 | + protected $user; |
| 31 | + |
| 32 | + /** @var Post */ |
| 33 | + protected $post; |
| 34 | + |
| 35 | + |
| 36 | + protected function _inject(Category $category, User $user, Post $post) |
| 37 | + { |
| 38 | + $this->user = $user; |
| 39 | + $this->post = $post; |
| 40 | + $this->category = $category; |
| 41 | + } |
| 42 | + |
| 43 | + public function shouldCreatePostWithCorrectSymbols(AcceptanceTester $I) |
| 44 | + { |
| 45 | + $I->wantTo("Check special symbols in post's text"); |
| 46 | + |
| 47 | + $user = $this->user->haveUser(); |
| 48 | + $catId = $this->category->haveCategory(); |
| 49 | + |
| 50 | + $postId = $this->post->havePost([ |
| 51 | + 'title' => 'Test special symbols in post text', |
| 52 | + 'content' => "Code < > ' ! <h1>Code content < </h1> `{<h2>Code content2 > ' </h2>}`", |
| 53 | + 'slug' => 'test_spec_sumbol', |
| 54 | + 'users_id' => $user['id'], |
| 55 | + 'categories_id' => $catId, |
| 56 | + ]); |
| 57 | + |
| 58 | + $I->amOnPage("/discussion/{$postId}/test_spec_sumbol"); |
| 59 | + $I->seeInSource('Test special symbols in post text'); |
| 60 | + |
| 61 | + $I->seeInSource("Code < > ' !"); |
| 62 | + $I->seeInSource("<h1>Code content < </h1>"); |
| 63 | + $I->seeInSource("<h2>Code content2 > ' </h2>"); |
| 64 | + } |
| 65 | + |
| 66 | + public function shouldCreateReplyWithCorrectSymbols(AcceptanceTester $I) |
| 67 | + { |
| 68 | + $I->wantTo("Check special symbols in post's reply"); |
| 69 | + |
| 70 | + $user = $this->user->haveUser(); |
| 71 | + $catId = $this->category->haveCategory(); |
| 72 | + |
| 73 | + $postId = $this->post->havePost([ |
| 74 | + 'title' => 'Test special symbols in post reply', |
| 75 | + 'content' => "Test Reply", |
| 76 | + 'slug' => 'test_spec_reply', |
| 77 | + 'users_id' => $user['id'], |
| 78 | + 'categories_id' => $catId, |
| 79 | + ]); |
| 80 | + |
| 81 | + $I->amOnPage("/discussion/{$postId}/test_spec_reply"); |
| 82 | + $I->seeInSource('Test special symbols in post reply'); |
| 83 | + |
| 84 | + $replyId = $this->post->havePostReply([ |
| 85 | + 'posts_id' => $postId, |
| 86 | + 'users_id' => $user['id'], |
| 87 | + 'accepted' => 'N', |
| 88 | + 'content' => "Code < > ' ! <h1>Code content < </h1> `{<h2>Code content > ' </h2>}`", |
| 89 | + ]); |
| 90 | + |
| 91 | + $I->amOnPage("/discussion/{$postId}/test_spec_reply#{$replyId}"); |
| 92 | + $I->seeInSource("Code < > ' !"); |
| 93 | + $I->seeInSource("<h1>Code content < </h1>"); |
| 94 | + $I->seeInSource("<h2>Code content > ' </h2>"); |
| 95 | + } |
| 96 | +} |
0 commit comments