Skip to content

Commit

Permalink
MDL-79215 lib/graphlib: Fix unrelated coding style in graphlib_test.php
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelReyesCatcan committed Aug 14, 2024
1 parent dd97cc8 commit a106889
Showing 1 changed file with 71 additions and 16 deletions.
87 changes: 71 additions & 16 deletions lib/tests/graphlib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,29 @@ public function create_data(): array {
'mock' => [
'survey_name' => 'Survey 101',
'names' => [
'Relevance', 'Reflective thinking', 'Interactivity', 'Tutor support', 'Peer support', 'Interpretation'
'Relevance',
'Reflective thinking',
'Interactivity',
'Tutor support',
'Peer support',
'Interpretation',
],
'buckets1' => [
0.75, 2.5, 1.5, 1.5, 2.5, 2.5
0.75,
2.5,
1.5,
1.5,
2.5,
2.5,
],
'stractual' => 'Actual',
'buckets2' => [
-1, -1, -1, -1, -1, -1
-1,
-1,
-1,
-1,
-1,
-1,
],
'strpreferred' => 'Preferred',
'strimagine' => 'Imagine',
Expand All @@ -63,10 +78,20 @@ public function create_data(): array {
3,
],
'stdev1' => [
0.82915619758885, 1.1180339887499, 1.1180339887499, 1.1180339887499, 1.1180339887499, 1.1180339887499
0.82915619758885,
1.1180339887499,
1.1180339887499,
1.1180339887499,
1.1180339887499,
1.1180339887499,
],
'stdev2' => [
0, 0, 0, 0, 0, 0
0,
0,
0,
0,
0,
0,
],
'stdev3' => [
0.92915619758885,
Expand All @@ -77,7 +102,11 @@ public function create_data(): array {
2.1180339887499,
],
'options' => [
'Almost never', 'Seldom', 'Sometimes', 'Often', 'Almost always'
'Almost never',
'Seldom',
'Sometimes',
'Often',
'Almost always',
],
'maxbuckets1' => 2.5,
'maxbuckets2' => -1,
Expand All @@ -102,11 +131,21 @@ public function test_graphlib($mock): void {
$graph->parameter['zero_axis'] = 'black';
$graph->x_data = $mock['names'];
$graph->y_data['answers1'] = $mock['buckets1'];
$graph->y_format['answers1'] = array('colour' => 'ltblue', 'line' => 'line', 'point' => 'square',
'shadow_offset' => 4, 'legend' => $mock['stractual']);
$graph->y_format['answers1'] = [
'colour' => 'ltblue',
'line' => 'line',
'point' => 'square',
'shadow_offset' => 4,
'legend' => $mock['stractual'],
];
$graph->y_data['answers2'] = $mock['buckets2'];
$graph->y_format['answers2'] = array('colour' => 'ltorange', 'line' => 'line', 'point' => 'square',
'shadow_offset' => 4, 'legend' => $mock['strpreferred']);
$graph->y_format['answers2'] = [
'colour' => 'ltorange',
'line' => 'line',
'point' => 'square',
'shadow_offset' => 4,
'legend' => $mock['strpreferred'],
];
$graph->y_data['answers3'] = $mock['buckets3'];
$graph->y_format['answers3'] = [
'colour' => 'ltred',
Expand All @@ -116,11 +155,21 @@ public function test_graphlib($mock): void {
'legend' => $mock['stractual'],
];
$graph->y_data['stdev1'] = $mock['stdev1'];
$graph->y_format['stdev1'] = array('colour' => 'ltltblue', 'bar' => 'fill',
'shadow_offset' => '4', 'legend' => 'none', 'bar_size' => 0.3);
$graph->y_format['stdev1'] = [
'colour' => 'ltltblue',
'bar' => 'fill',
'shadow_offset' => '4',
'legend' => 'none',
'bar_size' => 0.3,
];
$graph->y_data['stdev2'] = $mock['stdev2'];
$graph->y_format['stdev2'] = array('colour' => 'ltltorange', 'bar' => 'fill',
'shadow_offset' => '4', 'legend' => 'none', 'bar_size' => 0.2);
$graph->y_format['stdev2'] = [
'colour' => 'ltltorange',
'bar' => 'fill',
'shadow_offset' => '4',
'legend' => 'none',
'bar_size' => 0.2,
];
$graph->y_data['stdev3'] = $mock['stdev3'];
$graph->y_format['stdev3'] = [
'colour' => 'ltred',
Expand All @@ -146,9 +195,15 @@ public function test_graphlib($mock): void {
'answers3',
];
} else if ($mock['maxbuckets1'] > 0.0) {
$graph->y_order = array('stdev1', 'answers1');
$graph->y_order = [
'stdev1',
'answers1',
];
} else if ($mock['maxbuckets2'] > 0.0) {
$graph->y_order = array('stdev2', 'answers2');
$graph->y_order = [
'stdev2',
'answers2',
];
} else {
$graph->y_order = [
'stdev3',
Expand Down

0 comments on commit a106889

Please sign in to comment.