Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* AFI-OPAC 2.0 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class AbstractFormationsControllerTestCase extends AbstractControllerTestCase {
public function setup() {
parent::setup();
ZendAfi_Auth::getInstance()->clearIdentity();
$test_time = new TimeSourceForTest('2014-05-09 14:00:00');
Class_Formation::setTimeSource($test_time);
Class_SessionFormation::setTimeSource($test_time);
$session_full = $this->fixture('Class_SessionFormation',
['id' => 1,
'formation_id' => 1,
'date_debut' => '2014-07-10',
'date_limite_inscription' => '2014-07-01',
'effectif_min' => 1,
'effectif_max' => 1,
'stagiaires' => []]);
$session_canceled = $this->fixture('Class_SessionFormation',
['id' => 1,
'formation_id' => 1,
'date_debut' => '2014-07-10',
'effectif_min' => 1,
'effectif_max' => 10,
'stagiaires' => []]);
$session_canceled->beAnnule();
$_bonlieu = $this->fixture('Class_Lieu',
['id' => 100,
'libelle' => 'Bonlieu',
'adresse' => "1, rue Jean-Jaures\nBP 294",
'code_postal' => 74007,
'ville' => 'Annecy',
'latitude' => '45.902179',
'longitude' => '6.128715']);
$_session_java_fevrier = $this->fixture('Class_SessionFormation',
['id' => 31,
'formation_id' => 3,
'effectif_min' => 2,
'effectif_max' => 5,
'lieu' => $_bonlieu,
'date_debut' => '2015-02-10',
'date_fin' => '2015-02-20',
'stagiaires' => [],
'date_limite_inscription' => '2015-01-20']);
$session_subscription_exhausted = $this->fixture('Class_SessionFormation',
['id' => 1,
'formation_id' => 1,
'date_debut' => '2014-07-10',
'date_limite_inscription' => '2014-01-10',
'effectif_min' => 1,
'effectif_max' => 10,
'stagiaires' => []]);
$formation = $this->fixture('Class_Formation',
['id' => 1,
'libelle' => 'Farming cerths',
'sessions' => [$session_full,
$session_canceled,
$_session_java_fevrier,
$session_subscription_exhausted]]);
}
class FormationsControllerFormationsSessionFevrierJavaTest extends AbstractFormationsControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/formations/detail-session/id/31', true);
}
/** @test */
public function pageShouldContainsPopupLinkToInscrire() {
$this->assertXPathContentContains('//a[contains(@href, "auth/popup-login/")]',
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
'S\'inscrire', $this->_response->getBody());
}
/** @test */
public function ddShouldContainsNombreDeParticipants() {
$this->assertXPathContentContains('//dl/dd', 'minimum: 2, maximum: 5, actuel: 0');
}
/** @test */
function ddShouldContainsAdresseBonlieu() {
$this->assertXPathContentContains('//dd', 'Bonlieu');
$this->assertXPathContentContains('//dd', '1, rue Jean-Jaures');
$this->assertXPathContentContains('//dd', '74007 Annecy');
}
/** @test */
function ddShouldContainsGoogleMap() {
$this->assertXPath('//dd//img[@src="http://maps.googleapis.com/maps/api/staticmap?sensor=false&zoom=15&size=300x300¢er=45.902179%2C6.128715&markers=45.902179%2C6.128715"]');
}
}
class FormationsControllerAnonymousTest extends AbstractFormationsControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/formations', true);
}
/** @test */
function sessionShouldDisplaySubscribeTime() {
$this->assertXPathContentContains('//tbody//tr/td/span',
'Date de limite d\'inscription:');
}
}
class FormationsControllerFormationsSessionJuilletPythonDetailRetourFicheTest extends AbstractFormationsControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/formations/detail-session/id/31?retour=/opac/abonne/fiche');
}
/** @test */
public function pageShouldContainsAButtontoGoBackToFicheAbonne() {
$this->assertXPathContentContains('//a[contains(@href, "abonne/fiche")]', 'Retour', $this->_response->getBody());
}
}
?>