TaxonomysSoftwaresControllerTest.php 25.6 KB
Newer Older
1
<?php
2
3

namespace App\Test\TestCase\Controller\Api\V1;
4

5
use App\Controller\TaxonomysSoftwaresController;
6
7

/**
8
 * App\Controller\TaxonomysSoftwaresController Test Case
9
 */
10
class TaxonomysSoftwaresControllerTest extends ApiIntegrationTestCase
11
12
13
14
15
16
17
18
{

    /**
     * Fixtures
     *
     * @var array
     */
    public $fixtures = [
19
        'app.taxonomys_softwares',
20
21
22
23
24
25
26
27
28
29
30
31
        'app.taxonomys',
        'app.softwares',
        'app.licenses',
        'app.licence_types',
        'app.relationships_softwares_users',
        'app.users',
        'app.user_types',
        'app.reviews',
        'app.relationships',
        'app.relationship_types',
        'app.relationships_softwares',
        'app.relationships_users',
32
33
34
35
36
      //  'app.usedsoftwares',
     //   'app.backedsoftwares',
     //   'app.createdsoftwares',
    //    'app.contributionssoftwares',
    //    'app.providerforsoftwares',
37
38
39
40
        'app.screenshots',
        'app.softwares_statistics',
        'app.tags',
        'app.softwares_tags',
41
42
43
44
45
46
47
     //   'app.userssoftwares',
     //   'app.backerssoftwares',
     //   'app.creatorssoftwares',
     //   'app.contributorssoftwares',
     //   'app.providerssoftwares',
     //   'app.workswellsoftwares',
    //    'app.alternativeto'
48
49
    ];

50
51
52
53
54
55

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Public actions /////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    /**
     * MappingForm method used by connected user (type = "Administration")
     * after registering as user of a sofware.
     *
     *      URL: /en/mappingForm/<softwareId>
     *           /fr/mappingForm/<softwareId>
     *
     * @group public
     * @group taxonomy
     * @group taxonomy_public
     * @group taxonomy-software
     * @group taxonomy-software_public
     * @group taxonomy-software_mappingForm
     * @return void
     */
71
    public function testMappingFormDisplay()
72
    {
73
74
        $url =  '/fr/mappingForm/2'; // software ID 2 "Lutèce"
        $title = "<title>Logiciel Lutèce : déclarer vos usages</title>";
75

76
77
78
79
80
81
        // Anonymous user
        $this->setAnonymousUserSession();
        $this->checkUrlRedirectToLogin($url, ['html'], 'fr');

        // Connected user (type != "Administration")
        $this->setConnectedPersonSession();
82
        $this->checkUrlNotAuthorized($url, ['html']);
83
84
85
        $this->setConnectedCompanySession();
        $this->checkUrlNotAuthorized($url, ['html']);
        $this->setConnectedAssociationSession();
86
        $this->checkUrlNotAuthorized($url, ['html']);
87

88
89
        // connected user (type = "Administration")
        $this->setConnectedAdministrationSession();
90
91
92
93
        $r = $this->checkUrlOk($url, ['html']);
        $html = $r['html']['data'];
        $this->assertContains('<html lang="fr">', $html);
        $this->assertContains("$title", $html);
94
95
96
97
98
99
100
101
102
103
104
105
        $this->assertContains('class="taxonomyForm_step1_content"', $html);
        $this->assertNotContains('id="checkbox_1"', $html); // Primary level --> no checkbox
        $this->assertNotContains('id="checkbox_2"', $html); // Primary level --> no checkbox
        $this->assertContains('id="checkbox_3"', $html);
        $this->assertContains('id="checkbox_4"', $html);
        $this->assertContains('id="checkbox_5"', $html);
        $this->assertContains('id="checkbox_6"', $html);
        $this->assertNotContains('id="checkbox_7"', $html); // no found taxon --> no checkbox
        $htmlCheckBox  = '<label for="checkbox_3">';
        $htmlCheckBox .= '<input type="checkbox" name="taxonCheckboxes[]" value="3" id="checkbox_3">';
        $htmlCheckBox .= 'Urbanisme / Espace public / Environnement</label>';
        $this->assertContains($htmlCheckBox, $html); // no found taxon --> no checkbox
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

    /**
     * MappingForm method used by connected user (type = "Administration")
     * after registering as user of a sofware.
     *
     *      URL: /en/mappingForm/<softwareId>
     *           /fr/mappingForm/<softwareId>
     *
     * User sends form several times (add/edit):
     * - Check BEFORE send form data ---> no associed entry (user-software-taxon)
     * - Send form data with 2 associed entries
     * - Check AFTER ---> 2 entries found
     * - Resend form data: user unchecks an entry
     * - Check AFTER ---> only last entry found
     * - Resend form data: user unchecks last entry
     * - Check AFTER ---> no associed entry (user-software-taxon)
     *
     * @group public
     * @group taxonomy
     * @group taxonomy_public
     * @group taxonomy-software
     * @group taxonomy-software_public
     * @group taxonomy-software_mappingForm
131
     *
132
133
134
135
136
137
138
139
     * @return void
     */
    public function testMappingFormSend()
    {
        $taxonIdA = 3;
        $taxonSlugA = 'urbanisme-espace-public-environnement';
        $taxonIdB = 4;
        $taxonSlugB = 'bureautique';
140
141
        $softwareId = 5;
        $softwareSlug = 'soft-5';
142
        $idUserA = 6;
143
144
        $urlForm =  "/fr/mappingForm/$softwareId";
        $softwareUrl =  "/fr/softwares/$softwareId";
145
        $userUrl =  "/fr/users/$idUserA";
146
147
148
149
150
        $testeddUrlTaxonA = "/fr/cartographie/metiers/$taxonSlugA/$softwareSlug/$taxonIdA.$softwareId";
        $redirectUrlTaxonA = "/fr/cartographie/metiers/$taxonSlugA/$taxonIdA";
        $testeddUrlTaxonB = "/fr/cartographie/generiques/$taxonSlugB/$softwareSlug/$taxonIdB.$softwareId";
        $redirectUrlTaxonB = "/fr/cartographie/generiques/$taxonSlugB/$taxonIdB";

151
152
        // connected user (type = "Administration")
        $this->setConnectedAdministrationSession();
153

154
155
156
157
158
159
160
        // Beforehand, the user declares himself/herself to be a user of the software.
        $r = $this->checkUrlOk($userUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertNotContains("id=\"softwarePreviewCard-$softwareId\"", $html);
        $this->post('api/v1/softwares/usersSoftware/5.json');


161
162
163
        // Check BEFORE send form data
        ///////////////////////////////////

164
165
166
        // (1) no entry for current user (ID-6), software ID-5 and taxon ID 3 | 4

        // on mapping page (1)
167
168
169
        $this->checkUrlRedirectToAnotherUrl($testeddUrlTaxonA, $redirectUrlTaxonA, ['html'], 301);
        $this->checkUrlRedirectToAnotherUrl($testeddUrlTaxonB, $redirectUrlTaxonB, ['html'], 301);

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
        // on software page (1)
         $r = $this->checkUrlOk($softwareUrl, ['html'], false);
         $html = $r['html']['data'];
         $this->assertNotContains("id=\"mappingForSoftware-$softwareId\"", $html);
         $this->assertNotContains("class=\"linkMapping-taxonSoftware\"", $html);
         $this->assertNotContains("id=\"linkMapping-taxon-$taxonIdA-Software-$softwareId\"", $html);
         $this->assertNotContains("id=\"linkMapping-taxon-$taxonIdB-Software-$softwareId\"", $html);

        // on user page (1)
        $r = $this->checkUrlOk($userUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertContains("id=\"softwarePreviewCard-$softwareId\"", $html);
        $this->assertNotContains("id=\"mappingForUser-$idUserA\"", $html);
        $this->assertNotContains("class=\"linkMappingTaxon\"", $html);
        $this->assertNotContains("id=\"linkMappingTaxon-$taxonIdA\"", $html);
        $this->assertNotContains("id=\"linkMappingTaxon-$taxonIdB\"", $html);

        // on form page, checkbox (of taxon ID 3|ID 4) must not be checked
        $r = $this->checkUrlOk($urlForm, ['html'], false);
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
        $html = $r['html']['data'];
        $this->assertContains('id="checkbox_'.$taxonIdA.'"', $html);
        $this->assertContains('id="checkbox_'.$taxonIdB.'"', $html);
        $this->assertNotContains('id="checkbox_'.$taxonIdA.'" checked="checked"', $html);
        $this->assertNotContains('id="checkbox_'.$taxonIdB.'" checked="checked"', $html);

        // Send form data
        ///////////////////////////////////
        $data = [ 'id' => "$softwareId", 'taxonCheckboxes' => [$taxonIdA, $taxonIdB]];
        $this->post($urlForm, $data);
        $headers = $this->_response->header();
        $this->assertResponseCode(302);
        $this->assertEquals($softwareUrl, $headers['Location']);

        // Check AFTER send form data
        ///////////////////////////////////

206
207
208
209
210
211
212
213
214
215
216
217
218
219
        // (2) entries found for current user (ID-6), software ID-5 and taxon ID 3 | 4

        // on software page (2)
        $r = $this->checkUrlOk($softwareUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertContains("id=\"mappingForSoftware-$softwareId\"", $html);
        $this->assertContains("class=\"linkMapping-taxonSoftware\"", $html);
        $this->assertContains("id=\"linkMapping-taxon-$taxonIdA-Software-$softwareId\"", $html);
        $this->assertContains("id=\"linkMapping-taxon-$taxonIdB-Software-$softwareId\"", $html);

        // on user page (2)
        $r = $this->checkUrlOk($userUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertContains("id=\"softwarePreviewCard-$softwareId\"", $html);
220
221
222
223
        $this->assertContains("id=\"mappingForUser-$idUserA\"", $html);
        $this->assertContains("class=\"linkMappingTaxon\"", $html);
        $this->assertContains("id=\"linkMappingTaxon-$taxonIdA\"", $html);
        $this->assertContains("id=\"linkMappingTaxon-$taxonIdB\"", $html);
224
225
226

        // on mapping page: entry found for current user (ID-6), software ID-5 and taxon ID 3
        $r = $this->checkUrlOk($testeddUrlTaxonA, ['html'], false);
227
228
229
230
        $html = $r['html']['data'];
        $this->assertContains("id=\"mappingTaxon$taxonIdA-UsersOf$softwareId\"", $html); // <section id="">
        $this->assertContains("id=\"userPreviewCard-$idUserA\"", $html);

231
232
        // on mapping page: entry found for current user (ID-6), software ID-5 and taxon ID 4
        $r = $this->checkUrlOk($testeddUrlTaxonB, ['html'], false);
233
234
235
236
        $html = $r['html']['data'];
        $this->assertContains("id=\"mappingTaxon$taxonIdB-UsersOf$softwareId\"", $html); // <section id="">
        $this->assertContains("id=\"userPreviewCard-$idUserA\"", $html);

237
238
        // on form page, checkbox (of taxon ID3|ID4) must be checked
        $r = $this->checkUrlOk($urlForm, ['html'], false);
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
        $html = $r['html']['data'];
        $this->assertContains('id="checkbox_'.$taxonIdA.'" checked="checked"', $html);
        $this->assertContains('id="checkbox_'.$taxonIdB.'" checked="checked"', $html);

        // Resend form data: user unchecks an entry $taxonIdA
        /////////////////////////////////////////////////////
        $data = [ 'id' => "$softwareId", 'taxonCheckboxes' => [$taxonIdB]];
        $this->post($urlForm, $data);
        $headers = $this->_response->header();
        $this->assertResponseCode(302);
        $this->assertEquals($softwareUrl, $headers['Location']);

        // Check AFTER resend send form data (user unchecks an entry $taxonIdA)
        ///////////////////////////////////////////////////////////////////////

254
255
256
257
258
259
260
261
262
263
264
265
266
267
        // (3) entry found for current user (ID-6), software ID-5 and taxon ID 4, but not for taxon ID 3

        // on software page (3)
        $r = $this->checkUrlOk($softwareUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertContains("id=\"mappingForSoftware-$softwareId\"", $html);
        $this->assertContains("class=\"linkMapping-taxonSoftware\"", $html);
        $this->assertNotContains("id=\"linkMapping-taxon-$taxonIdA-Software-$softwareId\"", $html);
        $this->assertContains("id=\"linkMapping-taxon-$taxonIdB-Software-$softwareId\"", $html);

        // on user page (3)
        $r = $this->checkUrlOk($userUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertContains("id=\"softwarePreviewCard-$softwareId\"", $html);
268
269
270
271
        $this->assertContains("id=\"mappingForUser-$idUserA\"", $html);
        $this->assertContains("class=\"linkMappingTaxon\"", $html);
        $this->assertNotContains("id=\"linkMappingTaxon-$taxonIdA\"", $html);
        $this->assertContains("id=\"linkMappingTaxon-$taxonIdB\"", $html);
272
273

        // on mapping page: no entry for current user (ID-6), software ID-5 and taxon ID 3
274
275
        $this->checkUrlRedirectToAnotherUrl($testeddUrlTaxonA, $redirectUrlTaxonA, ['html'], 301);

276
277
        //  on mapping page: entry found for current user (ID-6), software ID-5 and taxon ID 4
        $r = $this->checkUrlOk($testeddUrlTaxonB, ['html'], false);
278
279
280
281
        $html = $r['html']['data'];
        $this->assertContains("id=\"mappingTaxon$taxonIdB-UsersOf$softwareId\"", $html); // <section id="">
        $this->assertContains("id=\"userPreviewCard-$idUserA\"", $html);

282
283
        // on form page, checkbox (of taxon ID4) must be checked, but not for taxon ID3
        $r = $this->checkUrlOk($urlForm, ['html'], false);
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
        $html = $r['html']['data'];
        $this->assertNotContains('id="checkbox_'.$taxonIdA.'" checked="checked"', $html);
        $this->assertContains('id="checkbox_'.$taxonIdB.'" checked="checked"', $html);


        // Resend form data: user unchecks the last entry $taxonIdB
        /////////////////////////////////////////////////////////////////////////////
        $data = [ 'id' => "$softwareId"];
        $this->post($urlForm, $data);
        $headers = $this->_response->header();
        $this->assertResponseCode(302);
        $this->assertEquals($softwareUrl, $headers['Location']);

        // Check AFTER resend send form data (user unchecks the last entry $taxonIdB)
        /////////////////////////////////////////////////////////////////////////////

300
        // (4) no entry for current user (ID-6), software ID-5 and taxon ID 3 | 4
301

302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
        // on software page (4)
        $r = $this->checkUrlOk($softwareUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertNotContains("id=\"mappingForSoftware-$softwareId\"", $html);
        $this->assertNotContains("class=\"linkMapping-taxonSoftware\"", $html);
        $this->assertNotContains("id=\"linkMapping-taxon-$taxonIdA-Software-$softwareId\"", $html);
        $this->assertNotContains("id=\"linkMapping-taxon-$taxonIdB-Software-$softwareId\"", $html);

        // on user page (4)
        $r = $this->checkUrlOk($userUrl, ['html'], false);
        $html = $r['html']['data'];
        $this->assertContains("id=\"softwarePreviewCard-$softwareId\"", $html);
        $this->assertNotContains("id=\"mappingForUser-$idUserA\"", $html);
        $this->assertNotContains("class=\"linkMappingTaxon\"", $html);
        $this->assertNotContains("id=\"linkMappingTaxon-$taxonIdA\"", $html);
        $this->assertNotContains("id=\"linkMappingTaxon-$taxonIdB\"", $html);

        //  on mapping page (4)
        $this->checkUrlRedirectToAnotherUrl($testeddUrlTaxonA, $redirectUrlTaxonA, ['html'], 301);
321
322
        $this->checkUrlRedirectToAnotherUrl($testeddUrlTaxonB, $redirectUrlTaxonB, ['html'], 301);

323
324
        // on form page, checkbox (of taxon ID 3|ID 4) must not be checked
        $r = $this->checkUrlOk($urlForm, ['html'], false);
325
326
327
328
329
        $html = $r['html']['data'];
        $this->assertNotContains('id="checkbox_'.$taxonIdA.'" checked="checked"', $html);
        $this->assertNotContains('id="checkbox_'.$taxonIdB.'" checked="checked"', $html);
    }

330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
    /**
     * MappingForm method for a not found software
     *
     *      URL: /en/mappingForm/<softwareIdNotFound>   ----> redirect to /en/mapping/
     *           /fr/mappingForm/<softwareIdNotFound>   ----> redirect to /fr/cartographie/
     *
     * @group public
     * @group taxonomy
     * @group taxonomy_public
     * @group taxonomy-software
     * @group taxonomy-software_public
     * @group taxonomy-software_mappingForm
     * @return void
     */
    public function testMappingFormSofwareIdNotFound()
    {
        $url =  '/fr/mappingForm/888'; // software ID 888 ---> not in database

348
349
        // connected user (type = "Administration")
        $this->setConnectedAdministrationSession();
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
        $this->get("/fr/"); // force user language to french
        $expectedUrl = '/fr/cartographie/';
        $this->checkUrlRedirectToAnotherUrl($url, $expectedUrl, ['html'], 301);
    }


    /**
     * MappingForm method with URL prefix /api/v1/
     * - HTML format redirects to the official URL
     * - JSON format returns a 404 "not found" error.
     *
     *    URL: /api/v1/taxonomys-softwares/mappingForm                   ---> redirect to '/en/mapping/'
     *         /api/v1/taxonomys-softwares/mappingForm/<softwareId>      ---> redirect to '/en/mappingForm/<softwareId>'
     *         /api/v1/taxonomys-softwares/mappingForm.json              ---> disable via parent::beforeFilter()
     *         /api/v1/taxonomys-softwares/mappingForm/<softwareId>.json ---> disable via parent::beforeFilter()
     *
     * @group seo
     * @group public
     * @group taxonomy
     * @group taxonomy-software
     * @group taxonomy-software_public
     * @group taxonomy-software_mappingForm
     * @return void
     */
    public function testMappingFormCheckApiPrefixInUrl()
    {
        $urlBase = '/api/v1/taxonomys-softwares/mappingForm'; // missing software ID
        $url = "$urlBase/2"; // software ID 2

379
380
        // connected user (type = "Administration")
        $this->setConnectedAdministrationSession();
381
382
383
384
385
386
387
388
389
390
391
392
393

        // JSON format
        $this->checkUrlNotFound($urlBase, ['json']);
        $this->checkUrlNotFound($url, ['json']);

        // HTML format
        $this->get("/fr/"); // force user language to french
        $expectedUrl = '/fr/cartographie/'; // software ID 2
        $this->checkUrlRedirectToAnotherUrl($urlBase, $expectedUrl, ['html'], 301);
        $expectedUrl = '/fr/mappingForm/2'; // software ID 2
        $this->checkUrlRedirectToAnotherUrl($url, $expectedUrl, ['html'], 301);

        // Connected user (type != "Administration")
394
        $this->setConnectedPersonSession();
395
396
397
398
399
400
401
402
403
404
        $this->checkUrlNotFound($url, ['json']);
        $this->checkUrlNotAuthorized($url, ['html']);

        // Anonymous user
        $this->setAnonymousUserSession();
        $this->checkUrlNotFound($url, ['json']);
        $this->checkUrlRedirectToLogin($url, ['html']);
    }


405
406
407
408
409
410
411
412
413

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Admin actions ---> self-generated by CakePHP  //////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    // Admin user
    /////////////////////////////////////////////////////////////////////////////////////////

414
    /**
415
     * Test index method for admin user ---> allowed
416
     *
417
418
419
420
421
422
     *      URL: /api/v1/taxonomys-softwares
     *           ----> allowed only for user with "admin" role
     *
     * @group admin
     * @group taxonomy
     * @group taxonomy-software
423
424
     * @return void
     */
425
    public function testIndexForAdminUser()
426
    {
427
        $this->setAdminSessionOfPersonType();
428
429
430
        $result = $this->checkUrlOk('/api/v1/taxonomys-softwares');
        $json = $result['json'];
        $html = $result['html'];
431
432
433
434
435
    }

    /**
     * Test view method
     *
436
437
438
439
440
441
     *      URL: /api/v1/taxonomys-softwares/view/1
     *           ----> allowed only for user with "admin" role
     *
     * @group admin
     * @group taxonomy
     * @group taxonomy-software
442
443
     * @return void
     */
444
    public function testViewForAdminUser()
445
    {
446
        $this->setAdminSessionOfPersonType();
447
        $result = $this->checkUrlOk('/api/v1/taxonomys-softwares/view/1');
448
449
450
451
452
    }

    /**
     * Test add method
     *
453
454
455
456
457
458
459
     *      URL: /api/v1/taxonomys-softwares/add
     *           ----> allowed only for user with "admin" role
     *
     * @todo Not implemented yet.
     * @group admin
     * @group taxonomy
     * @group taxonomy-software
460
461
     * @return void
     */
462
    public function testAddForAdminUser()
463
    {
464
        $this->setAdminSessionOfPersonType();
465
466
        $result = $this->checkUrlOk('/api/v1/taxonomys-softwares/add');

467
468
469
470
471
472
        $this->markTestIncomplete('Not implemented yet.');
    }

    /**
     * Test edit method
     *
473
474
475
476
477
478
479
     *      URL: /api/v1/taxonomys-softwares
     *           ----> allowed only for user with "admin" role
     *
     * @todo  not implemented yet.
     * @group admin
     * @group taxonomy
     * @group taxonomy-software
480
481
     * @return void
     */
482
    public function testEditForAdminUser()
483
    {
484
        $this->setAdminSessionOfPersonType();
485
486
        $result = $this->checkUrlOk('/api/v1/taxonomys-softwares/edit/1');

487
488
489
490
491
492
        $this->markTestIncomplete('Not implemented yet.');
    }

    /**
     * Test delete method
     *
493
494
495
496
497
498
499
500
501
502
503
     *      URL: /api/v1/taxonomys-softwares
     *           ----> allowed only for user with "admin" role
     *
     * @todo  not implemented yet.
     * @group admin
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testDeleteForAdminUser()
    {
504
        $this->setAdminSessionOfPersonType();
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684

        $this->markTestIncomplete('Not implemented yet.');
    }


    // Connected user
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Test index method for connected user ---> not authorized
     *
     *      URL: /api/v1/taxonomys-softwares
     *           ----> allowed only for user with "admin" role
     *
     * @group user
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailIndexForConnectedUser()
    {
        $this->setConnectedUserSession();
        $this->checkUrlNotAuthorized('/api/v1/taxonomys-softwares');
    }

    /**
     * Test view method for connected user ---> not authorized
     *
     *      URL: /api/v1/taxonomys-softwares/view/1
     *           ----> allowed only for user with "admin" role
     *
     * @group user
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailViewForConnectedUser()
    {
        $this->setConnectedUserSession();
        $this->checkUrlNotAuthorized('/api/v1/taxonomys-softwares/view/1');
    }

    /**
     * Test add method for connected user
     * GET ---> not authorized
     * POST ---> @todo  not implemented yet
     *
     *      URL: /api/v1/taxonomys-softwares/add
     *           ----> allowed only for user with "admin" role
     *
     * @group user
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailAddForConnectedUser()
    {
        $this->setConnectedUserSession();
        $this->checkUrlNotAuthorized('/api/v1/taxonomys-softwares/add');

        $this->markTestIncomplete('Not implemented yet.');
    }

    /**
     * Test edit method for connected user
     * GET ---> not authorized
     * POST ---> @todo  not implemented yet
     *
     * @group user
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailEditForConnectedUser()
    {
        $this->setConnectedUserSession();
        $this->checkUrlNotAuthorized('/api/v1/taxonomys-softwares/edit/1');

        $this->markTestIncomplete('Not implemented yet.');
    }

    /**
     * Test delete method for connected user
     *
     * @todo    not implemented yet
     * @group user
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailDeleteForConnectedUser()
    {
        $this->markTestIncomplete('Not implemented yet.');
    }


    // Anonymous user
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Test index method for anonymous user ---> redirect to login form
     *
     *      URL: /api/v1/taxonomys-softwares
     *           ----> allowed only for user with "admin" role
     *
     * @group anonymous
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailIndexForAnonymousUser()
    {
        $this->setAnonymousUserSession();
        $this->checkUrlRedirectToLogin('/api/v1/taxonomys-softwares');
    }

    /**
     * Test view method for anonymous user ---> redirect to login form
     *
     *      URL: /api/v1/taxonomys-softwares/view/1
     *           ----> allowed only for user with "admin" role
     *
     * @group anonymous
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailViewForAnonymousUser()
    {
        $this->setAnonymousUserSession();
        $this->checkUrlRedirectToLogin('/api/v1/taxonomys-softwares/view/1');
    }

    /**
     * Test add method for anonymous user
     * GET ---> redirect to login form
     * POST ---> @todo  not implemented yet
     *
     *      URL: /api/v1/taxonomys-softwares/add
     *           ----> allowed only for user with "admin" role
     *
     * @group anonymous
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailAddForAnonymousUser()
    {
        $this->setAnonymousUserSession();
        $this->checkUrlRedirectToLogin('/api/v1/taxonomys-softwares/add');

        $this->markTestIncomplete('Not implemented yet.');
    }

    /**
     * Test edit method for anonymous user
     * GET ---> redirect to login form
     * POST ---> @todo  not implemented yet
     *
     * @group anonymous
     * @group taxonomy
     * @group taxonomy-software
     * @return void
     */
    public function testFailEditForAnonymousUser()
    {
        $this->setAnonymousUserSession();
        $this->checkUrlRedirectToLogin('/api/v1/taxonomys-softwares/edit/1');

        $this->markTestIncomplete('Not implemented yet.');
    }

    /**
     * Test delete method for anonymous user
     *
     * @todo  not implemented yet
     *
     * @group anonymous
     * @group taxonomy
     * @group taxonomy-software
685
686
     * @return void
     */
687
    public function testFailDeleteForAnonymousUser()
688
689
690
691
    {
        $this->markTestIncomplete('Not implemented yet.');
    }
}