-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResultFormatterTest.php
90 lines (84 loc) · 2.96 KB
/
ResultFormatterTest.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
<?php
namespace Tests\DataFormatters;
use Jadgray\FullTimeApi\DataFormatters\ResultFormatter;
use PHPUnit\Framework\TestCase;
class ResultFormatterTest extends TestCase
{
/**
* @return void
*/
public function testArrayIsFormattedCorrectly(): void
{
$resultFormatter = new ResultFormatter();
$this->assertEquals(
$this->getFormattedResults(),
$resultFormatter->formatResults($this->getUnFormattedResults())
);
}
/**
* @return array
*/
private function getUnFormattedResults(): array
{
return [
["29/05/21 09:30", "Mill Hill Juniors - Red U14S", "0 - 2", "Wilpshire Wanderers - Blue U14S", "SURRIDGE SPORTS U14S CUP 2020 - 2021"],
["22/05/21 11:30", "Wilpshire Wanderers - Red U14S", "2 - 2", "Rosegrove FC - Warriors U14S", "UNDER 14S"],
["15/05/21 11:45", "Junior Gardeners FC - U14S", "1 - 3", "Rossendale United JFC - Royals U14S", "UNDER 14S"],
["15/05/21 11:00", "Mill Hill Juniors - Red U14S", "5 - 1", "Rosegrove FC - Warriors U14S", "UNDER 14S"],
["15/05/21 10:45", "Langho Juniors - U14S", "5 - 1", "Rossendale Valley - Wasps U14S", "UNDER 14S"]
];
}
/**
* @return array
*/
private function getFormattedResults(): array
{
return [
[
'Date' => '29/05/2021',
'Time' => '09:30',
'Home' => 'Mill Hill Juniors - Red U14S',
'HomeScore' => '0',
'Away' => 'Wilpshire Wanderers - Blue U14S',
'AwayScore' => '2',
'FullScore' => '0 - 2',
],
[
'Date' => '22/05/2021',
'Time' => '11:30',
'Home' => 'Wilpshire Wanderers - Red U14S',
'HomeScore' => '2',
'Away' => 'Rosegrove FC - Warriors U14S',
'AwayScore' => '2',
'FullScore' => '2 - 2',
],
[
'Date' => '15/05/2021',
'Time' => '11:45',
'Home' => 'Junior Gardeners FC - U14S',
'HomeScore' => '1',
'Away' => 'Rossendale United JFC - Royals U14S',
'AwayScore' => '3',
'FullScore' => '1 - 3',
],
[
'Date' => '15/05/2021',
'Time' => '11:00',
'Home' => 'Mill Hill Juniors - Red U14S',
'HomeScore' => '5',
'Away' => 'Rosegrove FC - Warriors U14S',
'AwayScore' => '1',
'FullScore' => '5 - 1',
],
[
'Date' => '15/05/2021',
'Time' => '10:45',
'Home' => 'Langho Juniors - U14S',
'HomeScore' => '5',
'Away' => 'Rossendale Valley - Wasps U14S',
'AwayScore' => '1',
'FullScore' => '5 - 1',
],
];
}
}