1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
4
|
|
|
* |
5
|
|
|
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics) |
6
|
|
|
* |
7
|
|
|
* This program is free software; you can redistribute it and/or |
8
|
|
|
* modify it under the terms of the GNU General Public License |
9
|
|
|
* as published by the Free Software Foundation; either version 2 |
10
|
|
|
* of the License, or (at your option) any later version. |
11
|
|
|
* |
12
|
|
|
* This program 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 General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU General Public License |
18
|
|
|
* along with this program; if not, write to the Free Software |
19
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace App\Tests; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* This test just ensures that different pages are available (do not throw an exception) |
29
|
|
|
* @package App\Tests |
30
|
|
|
*/ |
31
|
|
|
class ApplicationAvailabilityFunctionalTest extends WebTestCase |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @dataProvider urlProvider |
35
|
|
|
*/ |
36
|
|
|
public function testPageIsSuccessful(string $url) : void |
37
|
|
|
{ |
38
|
|
|
//We have localized routes |
39
|
|
|
$url = '/en' . $url; |
40
|
|
|
|
41
|
|
|
//Try to access pages with admin, because he should be able to view every page! |
42
|
|
|
$client = static::createClient([], [ |
43
|
|
|
'PHP_AUTH_USER' => 'admin', |
44
|
|
|
'PHP_AUTH_PW' => 'test', |
45
|
|
|
]); |
46
|
|
|
|
47
|
|
|
$client->request('GET', $url); |
48
|
|
|
|
49
|
|
|
$this->assertTrue($client->getResponse()->isSuccessful()); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
public function urlProvider() |
54
|
|
|
{ |
55
|
|
|
//Homepage |
56
|
|
|
yield ['/']; |
57
|
|
|
//User related things |
58
|
|
|
yield ['/user/settings']; |
59
|
|
|
yield ['/user/info']; |
60
|
|
|
|
61
|
|
|
//Part lists |
62
|
|
|
yield ['/category/1/parts']; |
63
|
|
|
yield ['/footprint/1/parts']; |
64
|
|
|
yield ['/manufacturer/1/parts']; |
65
|
|
|
yield ['/store_location/1/parts']; |
66
|
|
|
yield ['/supplier/1/parts']; |
67
|
|
|
yield ['/parts/by_tag/Test']; |
68
|
|
|
yield ['/parts/search/test']; |
69
|
|
|
yield ['/parts']; |
70
|
|
|
|
71
|
|
|
//Login/logout |
72
|
|
|
yield ['/login']; |
73
|
|
|
|
74
|
|
|
//Tree views |
75
|
|
|
yield ['/tree/tools']; |
76
|
|
|
yield ['/tree/category/1']; |
77
|
|
|
yield ['/tree/categories']; |
78
|
|
|
yield ['/tree/footprint/1']; |
79
|
|
|
yield ['/tree/footprints']; |
80
|
|
|
yield ['/tree/location/1']; |
81
|
|
|
yield ['/tree/locations']; |
82
|
|
|
yield ['/tree/manufacturer/1']; |
83
|
|
|
yield ['/tree/manufacturers']; |
84
|
|
|
yield ['/tree/supplier/1']; |
85
|
|
|
yield ['/tree/suppliers']; |
86
|
|
|
//yield ['/tree/device/1']; |
87
|
|
|
yield ['/tree/devices']; |
88
|
|
|
|
89
|
|
|
//Typeahead |
90
|
|
|
yield ['/typeahead/builtInResources/search/DIP8']; |
91
|
|
|
yield ['/typeahead/tags/search/test']; |
92
|
|
|
} |
93
|
|
|
} |