Newer
Older
/* Cinquième écran choix du poste */
class AbonneControllerMultimediaHoldDeviceTest extends AbonneControllerMultimediaHoldTestCase {
public function setUp() {
parent::setUp();
$this->_prepareLocationInSession();
$this->_prepareDayInSession();
$this->_prepareTimeAndDurationInSession();
$this->_prepareGroupInSession();
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Multimedia_DeviceHold')
->whenCalled('countBy')
->answers(0);
$this->dispatch('/abonne/multimedia-hold-device', true);
}
/** @test */
public function currentTimelineStepShouldBePoste() {
$this->_assertCurrentTimelineStep('Poste');
}
/** @test */
public function posteUnShouldNotBeHoldable() {
$this->assertNotXPathContentContains('//a','Poste 1');
}
/** @test */
public function posteDeuxShouldBeHoldable() {
$this->assertXPathContentContains('//a[contains(@href, "multimedia-hold-device/device/2")]','Poste 2');
}

pbarroca
committed
}

llaffont
committed
/* Cinquième écran validation du choix du poste, redirection vers la confirmation */

pbarroca
committed
class AbonneControllerMultimediaHoldDeviceChoiceTest extends AbonneControllerMultimediaHoldTestCase {
public function setUp() {
parent::setUp();
$this->_prepareLocationInSession();
$this->_prepareDayInSession();
$this->_prepareTimeAndDurationInSession();
$this->_prepareGroupInSession();
$this->dispatch('/abonne/multimedia-hold-device/device/1', true);
}
/** @test */
public function shouldRedirectToNextStep() {
$this->assertRedirectTo('/abonne/multimedia-hold-confirm');
}
/** @test */
public function beanShouldHaveDeviceSet() {
$this->assertEquals(1, $this->_session->holdBean->device);
}

pbarroca
committed
}

llaffont
committed
class AbonneControllerMultimediaHoldDeviceChoiceErrorTest extends AbonneControllerMultimediaHoldTestCase {
/** @test */
public function withoutGroupShouldRedirectToHoldGroup() {
parent::setUp();
$this->_prepareLocationInSession();
$this->_prepareDayInSession();
$this->_prepareTimeAndDurationInSession();
$this->dispatch('/abonne/multimedia-hold-device/device/1', true);
$this->assertRedirectTo('/abonne/multimedia-hold-group');
}
/* Sixième écran confirmation de la réservation */

pbarroca
committed
class AbonneControllerMultimediaHoldConfirmTest extends AbonneControllerMultimediaHoldTestCase {
public function setUp() {
parent::setUp();
$this->_prepareLocationInSession();
$this->_prepareDayInSession();
$this->_prepareTimeAndDurationInSession();
$this->_prepareGroupInSession();
$this->_bean->device = 23;
Class_Multimedia_Device::getLoader()->newInstanceWithId(23)
->setLibelle('Poste 1')
->setOs('Ubuntu Lucid');
$this->dispatch('/abonne/multimedia-hold-confirm', true);
}

pbarroca
committed
/** @test */
public function currentTimelineStepShouldBeConfirmation() {
$this->_assertCurrentTimelineStep('Confirmation');
}

pbarroca
committed
/** @test */
public function locationShouldBeAntibes() {
$this->assertXPathContentContains('//li', 'Lieu : Médiathèque d\'Antibes');
}

pbarroca
committed
/** @test */
public function dayShouldBeSeptemberTwelve2012() {
$this->assertXPathContentContains('//li', 'Jour : 12 septembre 2012');
}

pbarroca
committed
/** @test */
public function startTimeShouldBe9h45() {
$this->assertXPathContentContains('//li', 'À partir de : 9h45');
}

pbarroca
committed
/** @test */
public function durationShouldBeFortyFiveMinutes() {
$this->assertXPathContentContains('//li', 'Durée : 45mn');
}

pbarroca
committed
/** @test */
public function deviceShouldBePoste1() {
$this->assertXPathContentContains('//li', 'Poste : Poste 1 - Ubuntu Lucid');
}

pbarroca
committed
/** @test */
public function confirmationLinkShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "multimedia-hold-confirm/validate/1")]', 'Confirmer');
}

pbarroca
committed

llaffont
committed
/* Sixième écran, réservation confirmée */

pbarroca
committed
class AbonneControllerMultimediaHoldConfirmValidatedTest extends AbonneControllerMultimediaHoldTestCase {
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
public function setUp() {
parent::setUp();
$this->_prepareLocationInSession();
$this->_prepareDayInSession();
$this->_prepareTimeAndDurationInSession();
$this->_prepareGroupInSession();
$this->_bean->device = 23;
Class_Multimedia_Device::getLoader()->newInstanceWithId(23)
->setLibelle('Poste 1')
->setOs('Ubuntu Lucid');
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Multimedia_DeviceHold')
->whenCalled('save')
->willDo(function ($model) {$model->setId(455);return true;});
$this->dispatch('/abonne/multimedia-hold-confirm/validate/1', true);
}
/** @test */
public function shouldRedirectToHoldView() {
$this->assertRedirectTo('/abonne/multimedia-hold-view/id/455');
}

pbarroca
committed
}

llaffont
committed
/* Septième écran, visualisation de la réservation */

pbarroca
committed
class AbonneControllerMultimediaHoldViewTest extends AbonneControllerMultimediaHoldTestCase {
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
public function setUp() {
parent::setUp();
Class_Multimedia_DeviceHold::newInstanceWithId(455)
->setUser(Class_Users::getIdentity())
->setDevice(Class_Multimedia_Device::newInstanceWithId(34)
->setLibelle('Poste 34')
->setOs('Archlinux')
->setGroup(Class_Multimedia_DeviceGroup::newInstanceWithId(1)
->setLibelle('Groupe 1')
->setLocation(Class_Multimedia_Location::newInstanceWithId(1)
->setLibelle('Antibes')
->setBib(Class_Bib::newInstanceWithId(5)
->setLibelle('Médiathèque d\'Antibes')))))
->setStart(strtotime('2012-12-28 14:30:00'))
->setEnd(strtotime('2012-12-28 16:00:00'));
$this->dispatch('/abonne/multimedia-hold-view/id/455', true);
}
/** @test */
public function locationShouldBeAntibes() {
$this->assertXPathContentContains('//li', 'Lieu : Médiathèque d\'Antibes');
}
/** @test */
public function dayShouldBeSeptemberTwentyHeight2012() {
$this->assertXPathContentContains('//li', 'Jour : 28 décembre 2012');
}
/** @test */
public function startTimeShouldBe14h30() {
$this->assertXPathContentContains('//li', 'À partir de : 14h30');
}
/** @test */
public function durationShouldBeNinetyMinutes() {
$this->assertXPathContentContains('//li', 'Durée : 90mn');
}
/** @test */
public function deviceShouldBePoste34() {
$this->assertXPathContentContains('//li', 'Poste : Poste 34 - Archlinux');
}
/** @test */
public function cancelationLinkShouldBePresent() {
$this->assertXPath('//a[contains(@href, "multimedia-hold-view/id/455/delete/1")]');
}

pbarroca
committed
}

llaffont
committed

pbarroca
committed
class AbonneControllerMultimediaHoldViewDeleteTest extends AbonneControllerMultimediaHoldTestCase {
public function setUp() {
parent::setUp();
Class_Multimedia_DeviceHold::getLoader()->newInstanceWithId(455)
->setUser(Class_Users::getLoader()->getIdentity());
$this->_wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Multimedia_DeviceHold')
->whenCalled('delete')
->answers(null);
$this->dispatch('/abonne/multimedia-hold-view/id/455/delete/1', true);
}

pbarroca
committed
/** @test */
public function deleteShouldHaveBeenCalled() {
$this->assertTrue($this->_wrapper->methodHasBeenCalled('delete'));
}

pbarroca
committed
/** @test */
public function shouldRedirectToFicheAbonne() {
$this->assertRedirectTo('/abonne/fiche');
}

pbarroca
committed
}

llaffont
committed

pbarroca
committed
class AbonneControllerMultimediaHoldViewOfAnotherUserTest extends AbonneControllerMultimediaHoldTestCase {
public function setUp() {
parent::setUp();
Class_Multimedia_DeviceHold::getLoader()->newInstanceWithId(455)
->setUser(Class_Users::getLoader()->newInstanceWithId(999));
$this->dispatch('/abonne/multimedia-hold-view/id/455', true);
}
/** @test */
public function shouldRedirectToFicheAbonne() {
$this->assertRedirectTo('/abonne/fiche');
}

pbarroca
committed
}

llaffont
committed

pbarroca
committed
class AbonneControllerMultimediaHoldFicheAbonneTest extends AbstractControllerTestCase {
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
public function setUp() {
parent::setUp();
Class_AdminVar::newInstanceWithId('MULTIMEDIA_KEY')->setValeur('aaaaaaaaaaaaaaabbaabba');
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Multimedia_DeviceHold')
->whenCalled('getFutureHoldsOfUser')
->with(Class_Users::getIdentity())
->answers([Class_Multimedia_DeviceHold::newInstanceWithId(12)
->setStart(strtotime('2012-12-28 14:00:00'))
->setEnd(strtotime('2012-12-28 15:00:00'))
->setDevice(Class_Multimedia_Device::newInstanceWithId(34)
->setLibelle('Poste 1')
->setOs('Archlinux')
->setGroup(Class_Multimedia_DeviceGroup::newInstanceWithId(3)
->setLocation(Class_Multimedia_Location::newInstanceWithId(2)
->setLibelle('Antibes')
->setBib(Class_Bib::newInstanceWithId(5)
->setLibelle('Médiathèque d\'Antibes')))))
]);
$this->fixture('Class_Ouverture', ['id' => 1]);
$this->dispatch('/abonne/fiche', true);
}
/** @test */
public function addHoldLinkShouldBePresent() {
$this->assertXPath('//a[contains(@href, "multimedia-hold-location")]');
}
/** @test */
public function viewHoldLinkShouldBePresent() {
$this->assertXPath('//a[contains(@href, "multimedia-hold-view/id/12")]');
}
/** @test */
public function viewHoldLinkShouldBeDisplayLibelleBibOsAndTime() {
$this->assertXPathContentContains('//a[contains(@href, "multimedia-hold-view/id/12")]',
'Poste 1 - Archlinux, le 28 décembre 2012 à 14h00 pour 60mn, Médiathèque d\'Antibes');
}
}

llaffont
committed
class AbonneControllerMultimediaUsersFixtures {
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
public static function getLaurent() {
return Class_Users::getLoader()->newInstanceWithId(8)
->setLogin("laurent")
->setPassword("afi")
->setNom('laffont')
->setPrenom('laurent')
->setRoleLevel(2)
->setIdabon('bca2')
->setNaissance('1978-02-17');
}
public static function getBaptiste() {
return Class_Users::getLoader()->newInstanceWithId(9)
->setLogin("baptiste")
->setPassword("afi")
->beAbonneSIGB()
->setNaissance('2005-02-17')
->setDateDebut('1978-05-23')
->setDateFin('3000-01-01');
}
public static function getMireille() {
return Class_Users::getLoader()->newInstanceWithId(10)
->beAbonneSIGB()
->setLogin("mireille")
->setPassword("afi")
->setDateFin('1999-01-01');
}
public static function getInvite() {
return Class_Users::getLoader()->newInstanceWithId(12)
->beInvite()
->setLogin("invite")
->setPassword("invite");
}
public static function getArnaud() {
return Class_Users::getLoader()->newInstanceWithId(11)
->beAbonneSIGB()
->setLogin("arnaud")
->setPassword("lelache");
}