Added System of Measure (English) unit tests;

Fixed a bug in pace formatting
This commit is contained in:
Justin Foell
2019-03-01 11:41:41 -06:00
parent cf1af2a0b2
commit c5fdb24244
6 changed files with 104 additions and 31 deletions
+12 -2
View File
@@ -29,10 +29,20 @@ abstract class WPStrava_SOM {
abstract public function pace( $mps );
abstract public function get_pace_label();
/**
* Create a time string of hours:minutes:seconds from just seconds.
*
* @return string Time formatted as 'H:i:s'.
*/
public function time( $seconds ) {
return date( 'H:i:s', mktime( 0, 0, $seconds ) );
}
/**
* Label for hours.
*
* @return string 'hours'
*/
public function get_time_label() {
return __( 'hours', 'wp-strava' );
}
@@ -49,8 +59,8 @@ abstract class WPStrava_SOM {
/**
* Change meters per second to Minutes Per 100 Meters. Same for English/metric.
*
* @param float $mps Meters per second.
* @return float Minutes Per 100 Meters.
* @param float|string $mps Meters per second.
* @return string Minutes Per 100 Meters.
*/
public function swimpace( $mps ) {