@@ -12,7 +12,7 @@ public function setUp()
1212 $ this ->base_dir = __DIR__ . '/../demo/fit_files/ ' ;
1313 }
1414
15- /*
15+ /**
1616 * Original road-cycling.fit before fix_data() contains:
1717 *
1818 * record message | count()
@@ -37,7 +37,7 @@ public function testFixData_before()
3737 $ this ->assertEquals (4316 , count ($ pFFA ->data_mesgs ['record ' ]['heart_rate ' ]));
3838 }
3939
40- /*
40+ /**
4141 * $pFFA->data_mesgs['record']['heart_rate']
4242 * [805987191 => 118],
4343 * [805987192 => missing],
@@ -62,7 +62,7 @@ public function testFixData_after()
6262 $ this ->assertEquals (4317 , count ($ pFFA ->data_mesgs ['record ' ]['heart_rate ' ]));
6363 }
6464
65- /*
65+ /**
6666 * $pFFA->data_mesgs['record']['heart_rate']
6767 * [805987191 => 118],
6868 * [805987192 => 117.5],
@@ -74,5 +74,22 @@ public function testFixData_hr_missing_key_fixed()
7474
7575 $ this ->assertEquals (117.5 , $ pFFA ->data_mesgs ['record ' ]['heart_rate ' ][805987192 ]);
7676 }
77+
78+ public function testFixData_validate_options_pass ()
79+ {
80+ // Positive testing
81+ $ valid_options = ['all ' , 'cadence ' , 'distance ' , 'heart_rate ' , 'lat_lon ' , 'speed ' , 'power ' ];
82+ foreach ($ valid_options as $ valid_option ) {
83+ $ pFFA = new phpFITFileAnalysis ($ this ->base_dir . $ this ->filename , ['fix_data ' => [$ valid_option ]]);
84+ }
85+ }
86+
87+ /**
88+ * @expectedException Exception
89+ */
90+ public function testFixData_validate_options_fail ()
91+ {
92+ $ pFFA = new phpFITFileAnalysis ($ this ->base_dir . $ this ->filename , ['fix_data ' => ['INVALID ' ]]);
93+ }
7794}
7895?>
0 commit comments