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 ParticipantControllerTest extends PollWebTestCase |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Creates, edits and deletes a participant |
28
|
|
|
*/ |
29
|
|
|
public function testCompleteScenario() |
30
|
|
|
{ |
31
|
|
|
// Create a poll to work with |
32
|
|
|
$crawler = self::createPollEntry(); |
33
|
|
|
|
34
|
|
|
// Create a participant |
35
|
|
|
$name = uniqid('Test Participant '); |
36
|
|
|
$crawler = self::submitForm($crawler, 'add.a.participant', 'participant', ['name' => $name]); |
37
|
|
|
|
38
|
|
|
// Check data in the show view |
39
|
|
|
$filter = 'a:contains("' . $name . '")'; |
40
|
|
|
self::checkElement($crawler, $filter); |
41
|
|
|
|
42
|
|
|
// Edit the participant |
43
|
|
|
$crawler = self::clickLink($crawler, $name); |
44
|
|
|
$name = "M $name"; |
45
|
|
|
$crawler = self::submitForm($crawler, 'save', 'participant', ['name' => $name]); |
46
|
|
|
|
47
|
|
|
// Check data in the show view |
48
|
|
|
$filter = 'a:contains("' . $name . '")'; |
49
|
|
|
self::checkElement($crawler, $filter); |
50
|
|
|
|
51
|
|
|
// Delete the participant |
52
|
|
|
$crawler = self::clickLink($crawler, $name); |
53
|
|
|
$crawler = self::submitForm($crawler, 'delete'); |
54
|
|
|
|
55
|
|
|
// Check the participant has been deleted from the list |
56
|
|
|
$this->assertNotRegExp("/$name/", self::$client->getResponse()->getContent()); |
57
|
|
|
|
58
|
|
|
// Delete the poll |
59
|
|
|
self::deletePollEntry($crawler); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|