|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* Copyright 2014-2017 Arnaud Bienvenu |
|
4
|
|
|
* |
|
5
|
|
|
* This file is part of Kyela. |
|
6
|
|
|
|
|
7
|
|
|
* Kyela is free software: you can redistribute it and/or modify |
|
8
|
|
|
* it under the terms of the GNU Affero General Public License as published by |
|
9
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
10
|
|
|
* (at your option) any later version. |
|
11
|
|
|
|
|
12
|
|
|
* Kyela is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
|
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
* along with Kyela. If not, see <http://www.gnu.org/licenses/>. |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace Abienvenu\KyelaBundle\Tests\Controller; |
|
23
|
|
|
|
|
24
|
|
|
class PollControllerTest extends PollWebTestCase |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* Creates, edits and deletes a poll |
|
28
|
|
|
*/ |
|
29
|
|
|
public function testCompleteScenario() |
|
30
|
|
|
{ |
|
31
|
|
|
// Create entry |
|
32
|
|
|
$crawler = self::createPollEntry(); |
|
33
|
|
|
|
|
34
|
|
|
// Check it was created |
|
35
|
|
|
$filter = 'h3.panel-title:contains("' . self::$translator->trans('success') . '")'; |
|
36
|
|
|
$this->checkElement($crawler, $filter); |
|
37
|
|
|
$title = self::$translator->trans('new.poll'); |
|
38
|
|
|
$filter = 'a:contains("' . $title . '")'; |
|
39
|
|
|
$this->checkElement($crawler, $filter); |
|
40
|
|
|
|
|
41
|
|
|
// Edit entry |
|
42
|
|
|
$newtitle = "M $title"; |
|
43
|
|
|
$crawler = self::clickLink($crawler, 'edit.poll'); |
|
44
|
|
|
$crawler = self::submitForm($crawler, 'save', 'poll', ['title' => $newtitle]); |
|
45
|
|
|
|
|
46
|
|
|
// Check the edition worked |
|
47
|
|
|
$filter = 'a:contains("' . $newtitle . '")'; |
|
48
|
|
|
$this->checkElement($crawler, $filter); |
|
49
|
|
|
|
|
50
|
|
|
// Delete entry |
|
51
|
|
|
$crawler = self::deletePollEntry($crawler); |
|
52
|
|
|
|
|
53
|
|
|
// Check it was deleted |
|
54
|
|
|
$filter = 'div.panel-body:contains("' . self::$translator->trans('deleted') . '")'; |
|
55
|
|
|
$this->checkElement($crawler, $filter); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|