1 | <?php |
||
12 | class ServiceTest extends TestCase |
||
13 | { |
||
14 | const RESOURCES_HEALTHY_EVERYWHERE = 8; |
||
15 | |||
16 | const ALL_RESOURCES = [ |
||
17 | 'AppKey', |
||
18 | 'Broadcasting', |
||
19 | 'Cache', |
||
20 | 'ConfigurationCached', |
||
21 | 'Database', |
||
22 | 'DebugMode', |
||
23 | 'DirectoryPermissions', |
||
24 | 'DiskSpace', |
||
25 | 'DocuSign', |
||
26 | 'ElasticsearchConnectable', |
||
27 | 'EnvExists', |
||
28 | 'Filesystem', |
||
29 | 'Framework', |
||
30 | 'Horizon', |
||
31 | 'Http', |
||
32 | 'Https', |
||
33 | 'LaravelServices', |
||
34 | 'Latency', |
||
35 | 'LocalStorage', |
||
36 | 'Mail', |
||
37 | 'MailgunConnectable', |
||
38 | 'MemcachedConnectable', |
||
39 | 'MigrationsUpToDate', |
||
40 | 'MySql', |
||
41 | 'MySqlConnectable', |
||
42 | 'NewrelicDeamon', |
||
43 | 'NginxServer', |
||
44 | 'PackagesUpToDate', |
||
45 | 'Php', |
||
46 | 'PostgreSqlConnectable', |
||
47 | 'PostgreSqlServer', |
||
48 | 'Queue', |
||
49 | 'QueueWorkers', |
||
50 | 'RebootRequired', |
||
51 | 'Redis', |
||
52 | 'RedisConnectable', |
||
53 | 'RedisServer', |
||
54 | 'RoutesCached', |
||
55 | 'S3', |
||
56 | 'SecurityChecker', |
||
57 | 'ServerLoad', |
||
58 | 'ServerUptime', |
||
59 | 'Sshd', |
||
60 | 'Supervisor', |
||
61 | ]; |
||
62 | |||
63 | const RESOURCES_HEALTHY = [ |
||
64 | 'Cache', |
||
65 | 'Debug Mode', |
||
66 | 'Directory Permissions', |
||
67 | 'Disk Space', |
||
68 | 'Filesystem', |
||
69 | 'Framework', |
||
70 | 'LaravelServices', |
||
71 | 'LocalStorage', |
||
72 | 'Mail', |
||
73 | 'Mailgun Connectable', |
||
74 | 'Memcached Connectable', |
||
75 | 'MySql', |
||
76 | 'MySQL Connectable', |
||
77 | 'Packages up to date', |
||
78 | 'PostgreSqlConnectable', |
||
79 | 'PostgreSqlServer', |
||
80 | 'Php', |
||
81 | 'Queue', |
||
82 | 'QueueWorkers', |
||
83 | 'RebootRequired', |
||
84 | 'Redis', |
||
85 | 'Redis Connectable', |
||
86 | 'RedisServer', |
||
87 | 'ServerUptime', |
||
88 | 'Supervisor', |
||
89 | ]; |
||
90 | |||
91 | const RESOURCES_FAILING = [ |
||
92 | 'AppKey', |
||
93 | 'Broadcasting', |
||
94 | 'Cache', |
||
95 | 'ConfigurationCached', |
||
96 | 'Database', |
||
97 | 'DebugMode', |
||
98 | 'DirectoryPermissions', |
||
99 | 'DiskSpace', |
||
100 | 'DocuSign', |
||
101 | 'ElasticsearchConnectable', |
||
102 | 'EnvExists', |
||
103 | 'Filesystem', |
||
104 | 'Framework', |
||
105 | 'Horizon', |
||
106 | 'Http', |
||
107 | 'Https', |
||
108 | 'LaravelServices', |
||
109 | 'Latency', |
||
110 | 'LocalStorage', |
||
111 | 'Mail', |
||
112 | 'MailgunConnectable', |
||
113 | 'MemcachedConnectable', |
||
114 | 'MigrationsUpToDate', |
||
115 | 'MySql', |
||
116 | 'MySqlConnectable', |
||
117 | 'NewrelicDeamon', |
||
118 | 'NginxServer', |
||
119 | 'PackagesUpToDate', |
||
120 | 'Php', |
||
121 | 'PostgreSqlConnectable', |
||
122 | 'PostgreSqlServer', |
||
123 | 'Queue', |
||
124 | 'QueueWorkers', |
||
125 | 'RebootRequired', |
||
126 | 'Redis', |
||
127 | 'RedisConnectable', |
||
128 | 'RedisServer', |
||
129 | 'RoutesCached', |
||
130 | 'S3', |
||
131 | 'SecurityChecker', |
||
132 | 'ServerLoad', |
||
133 | 'ServerUptime', |
||
134 | 'Sshd', |
||
135 | 'Supervisor', |
||
136 | ]; |
||
137 | |||
138 | const RESOURCES_STRING = 'appkeyFAIL-brdcFAIL-cshOK-cfgcchFAIL-dbFAIL-debugOK-dirpermOK-dskspcOK-dcsgnFAIL-redisconnFAIL-envexistsFAIL-flstmOK-frmwrkOK-httpFAIL-httpsFAIL-lvsOK-latencyFAIL-lclstrgOK-mlOK-redisconnOK-redisconnOK-debugFAIL-msqlOK-mysqlgrsqlsrvrconnOK-nwrlcdmnFAIL-ngnxsrvrFAIL-debugFAIL-pkgupdtdOK-phpOK-pstgrsqlsrvrconnOK-pstgrsqlsrvrFAIL-queueOK-qwrkrsOK-rbtrqrdOK-rdsOK-redisconnOK-rdssrvrOK-rtcchFAIL-s3FAIL-loadFAIL-uptmOK-sshdFAIL-sprvsrOK'; |
||
139 | |||
140 | private $service; |
||
141 | |||
142 | private $resources; |
||
143 | |||
144 | private function getResources($force = false) |
||
152 | |||
153 | /** |
||
154 | * Define environment setup. |
||
155 | * |
||
156 | * @param \Illuminate\Foundation\Application $app |
||
157 | * @return void |
||
158 | */ |
||
159 | protected function getEnvironmentSetUp($app) |
||
168 | |||
169 | public function setUp() |
||
175 | |||
176 | private function sortChars($string) |
||
184 | |||
185 | public function testResourcesWhereChecked() |
||
189 | |||
190 | public function testCacheFlush() |
||
194 | |||
195 | public function testUnsorted() |
||
201 | |||
202 | public function testInvalidEnabledResources() |
||
212 | |||
213 | public function testInvalidLoadOneResource() |
||
221 | |||
222 | public function assertCheckedResources($resources) |
||
242 | |||
243 | public function testInstantiation() |
||
247 | |||
248 | public function testResourcesHasTheCorrectCount() |
||
255 | |||
256 | public function testResourcesItemsMatchConfig() |
||
276 | |||
277 | public function testArtisanCommands() |
||
287 | |||
288 | public function testController() |
||
313 | } |
||
314 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: