-
Notifications
You must be signed in to change notification settings - Fork 8
/
teamnametest.php
402 lines (397 loc) · 15.8 KB
/
teamnametest.php
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
<?php
include( 'web/includes/default.php' );
function array_equal( $a, $b ) {
return (is_array($a) && is_array($b) && array_diff($a, $b) === array_diff($b, $a));
}
?>
<!DOCTYPE html>
<head>
<title>
Team name test
</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootswatch/3.3.2/paper/bootstrap.min.css">
</head>
<body>
<div class="container">
<table class="table">
<thead>
<tr>
<th>
Status
</th>
<th>
Mock value
</th>
<th>
Match
</th>
</tr>
</thead>
<tbody>
<?php
$mockDataList = array(
array(
'status' => 'Acer Team Championship Kinguin VS dignitas',
'teams' => array(
'teamkinguin',
'teamdignitas'
)
),
array(
'status' => 'FACEIT.com - Starladder XIII - EnVyUs vs Gamers2 0 - 0 (BO3)',
'teams' => array(
'teamenvyus',
'gamers2'
)
),
array(
'status' => 'FACEIT.com - Starladder XIII - Team Kinguin vs ex-Copenhagen Wolves (BO3)',
'teams' => array(
'teamkinguin',
'copenhagenwolves'
)
),
array(
'status' => 'FACEIT.com - FACEIT 2015 League Stage 1 - Day 3 - Grand Final - Ninjas in Pyjamas vs TSM.Kinguin (BO3)',
'teams' => array(
'ninjasinpyjamas',
'teamsolomid'
)
),
array(
'status' => 'Fightdat leageu - gamers2 vs TSM.Kinguin',
'teams' => array(
'gamers2',
'teamsolomid'
)
),
array(
'status' => 'Ora 22:00 Kinguin vs. undefined [SLTV StarSeries XIII]',
'teams' => array(
'teamkinguin',
'-unknown-'
)
),
array(
'status' => 'EnVyUs vs. Gamers2 || StarSeries S13 || @sL4Mtv @sltvstrike',
'teams' => array(
'teamenvyus',
'gamers2'
)
),
array(
'status' => 'КУБОК МУРА, HR vs M5 by Tafa & Strike',
'teams' => array(
'hellraisers',
'moscowfive'
)
),
array(
'status' => 'Team Kinguin vs. Undefined || StarSeries S13 Group D || @sL4Mtv',
'teams' => array(
'teamkinguin',
'-unknown-'
)
),
array(
'status' => 'Na`Vi vs. NiP || Gfinity Spring Masters 2 || by Kvan & Strike',
'teams' => array(
'natusvincere',
'ninjasinpyjamas'
)
),
array(
'status' => 'Liquid vs. VOX || Gfinity Spring Masters 2 || @sL4Mtv @sltvstrike',
'teams' => array(
'teamliquid',
'voxeminor'
)
),
array(
'status' => 'NiP vs. Liquid || Gfinity Spring Masters 2 || @sL4Mtv @sltvstrike',
'teams' => array(
'ninjasinpyjamas',
'teamliquid'
)
),
array(
'status' => 'nerdRage vs. AlienTech.black || FBM S4 || @sL4Mtv @sltvstrike',
'teams' => array(
'nerdrage',
'teamalientech'
)
),
array(
'status' => '[FR] - CounterPit - Team Dignitas vs Virtus Pro',
'teams' => array(
'teamdignitas',
'virtuspro'
)
)
,
array(
'status' => 'Patrick матч FlipSid3 vs. LDLC White',
'teams' => array(
'flipsid3tactics',
'teamldlccom'
)
)
,
array(
'status' => 'FlipSid3 vs. LDLC.White | StarSeries S13 | sL4M',
'teams' => array(
'flipsid3tactics',
'teamldlccom'
)
)
,
array(
'status' => '[ESL /w KeitaTV] (Starts 21.30) LGB eSports vs. KillerFish (Acer Predator Master)',
'teams' => array(
'lgbesports',
'killerfishesport'
)
)
,
array(
'status' => 'LGB vs KillerFish @ Acer Predator Masters powered by Intel',
'teams' => array(
'lgbesports',
'killerfishesport'
)
)
,
array(
'status' => 'ESL Spain: LGB eSports vs KillerFish - TakeTV Acer Predator Master',
'teams' => array(
'lgbesports',
'killerfishesport'
)
),
array(
'status' => 'Acer Predator Masters LIVE 21:30 LGB vs. KILLERFISH www.cmtv.eu #Giveaway',
'teams' => array(
'lgbesports',
'killerfishesport'
)
),
array(
'status' => 'Kibicujemy Polakom G2 vs Virtus',
'teams' => array(
'gamers2',
'virtuspro'
)
),
array(
'status' => '(RU)NAVI vs VEGA by MCS|Oldkinder',
'teams' => array(
'natusvincere',
'vegasquadron'
)
),
// This shouldn't be matched at all
array(
'status' => 'ESWC Khabarovsk',
'teams' => false
),
array(
'status' => '[FR] ESL ESEA Pro League / 20:45 NiP vs. f3 / 21:45 NiP vs. f3 / 22:45 Dignitas vs. Na\'Vi',
'teams' => array(
'ninjasinpyjamas',
'flipsid3tactics'
)
),
array(
'status' => 'F3ide vs. NiP on de_inferno @ ESL ESEA by Flife',
'teams' => array(
'ninjasinpyjamas',
'flipsid3tactics'
)
),
array(
'status' => 'ESL ESEA Pro League - Method vs Tempo Storm',
'teams' => array(
'method',
'tempostorm'
)
),
array(
'status' => '[RETRANSMISSÃO] Keyd vs. CLG --Próximo jogo: Keyd Stars vs. Team Liquid às 20:00 - ESL ESEA Pro League [NA]',
'teams' => array(
'keydstars',
'counterlogicgaming'
)
),
array(
'status' => 'Virtus.PRO vs FlipSide on de_mirage @ ESL ESEA by ceh9',
'teams' => array(
'flipsid3tactics',
'virtuspro'
)
),
array(
'status' => 'Fragbite Masters S4 LIVE : 19:00 Natus Vincerevs. vs Hellraisers #GIVEAWAY www.cmtv.eu',
'teams' => array(
'natusvincere',
'hellraisers'
)
),
array(
'status' => 'CZ/SK DEV1S.com @ fragbite nEph vs. LGB o 22CET',
'teams' => array(
'neophyte',
'lgbesports'
)
),
array(
'status' => 'Headshot.bg vs. Tricked - Balkan Championship #2 - Best of 3 Visit CSGOCasino.net 18+ only!',
'teams' => array(
'headshotbg',
'trickedesport'
)
),
array(
'status' => 'Starladder 13 - Na\'Vi [0] vs [0] FlipSide (BO3)',
'teams' => array(
'natusvincere',
'flipsid3tactics'
)
),
array(
'status' => 'Druidz vs Circadian in the ESL Majors!',
'teams' => array(
'-unknown-',
'-unknown-'
)
),
array(
'status' => '[FR] TEAM LEGEND vs GamersLeague eSport 21h cevo',
'teams' => array(
'-unknown-',
'-unknown-'
)
),
array(
'status' => 'TSM Kinguin vs Kinguin - Alienware Area51 CS:GO Cup 2 Finals',
'teams' => array(
'teamsolomid',
'teamkinguin'
)
),
array(
'status' => 'CSGOcup.pl - FINAŁ Boys in Suits vs NEVER-LUCKY',
'teams' => array(
'-unknown-',
'-unknown-'
)
),
array(
'status' => 'FACEIT 2015 League - EU Stage 2 - TSM.Kinguin vs Flipsid3 Tactics',
'teams' => array(
'teamsolomid',
'flipsid3tactics'
)
),
array(
'status' => '[PT-BR] Nihilum vs. Cloud 9 - ESL ESEA Pro League (NA)',
'teams' => array(
'cloud9',
'nihilum'
)
),
array(
'status' => 'GO:CL: VP vs dig w/ follower giveaways! [EN]',
'teams' => array(
'viruspro',
'teamdignitas'
)
),
array(
'status' => 'King of Nordic Finland vs Denmark',
'teams' => array(
'finland',
'denmark'
)
),
array(
'status' => 'TeamKinguin vs. Wyvern | DreamHack Open Summer 2015 BYOC | Giveaway at https://goo.gl/GsT6d5',
'teams' => array(
'teamkinguin',
'-unknown-'
)
)
);
$teamList = new AvailableTeams( 'web/' );
$streamMock = new Stream();
foreach( $mockDataList as $mockData ) :
if( $mockData[ 'teams' ] == false ) :
if( !$streamMock->isCast( $mockData[ 'status' ] ) ) :
$passed = true;
else :
$passed = false;
endif;
else:
$teams = $teamList->getTeamsInString( $mockData[ 'status' ] );
$teamIdentifiers = array( $teams[ 0 ][ 'identifier' ], $teams[ 1 ][ 'identifier' ] );
if( array_equal( $teamIdentifiers, $mockData[ 'teams' ] ) ) :
$passed = true;
else :
$passed = false;
endif;
endif;
?>
<tr <?php
if( $passed ) :
echo 'class="success"';
else :
echo 'class="danger"';
endif;
?>>
<td>
<?php
echo $mockData[ 'status' ];
?>
</td>
<?php
if( $mockData[ 'teams' ] ) :
?>
<td>
<?php
echo implode( ' vs ', $mockData[ 'teams' ] );
?>
</td>
<td>
<?php
echo $teams[ 0 ][ 'identifier' ], ' vs ', $teams[ 1 ][ 'identifier' ];
?>
</td>
<?php
else:
?>
<td>
Is not a cast
</td>
<td>
<?php
if( $passed ) :
echo 'Is not a cast';
else :
echo 'Is cast';
endif;
?>
</td>
<?php
endif;
?>
</tr>
<?php
//print_r( $teams );
endforeach;
?>
</tbody>
</table>
</div>
</body>