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