Skip to content

Commit

Permalink
Fix #120 (#168)
Browse files Browse the repository at this point in the history
* use proper unit of measurement

* update test to consider new measurement

closes #120
  • Loading branch information
jordanbrauer authored Mar 26, 2021
1 parent 133abc7 commit 9b03e3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/Measure.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class Measure

const FREQUENCY = 'frequency';

const FUEL_ECONOMY = 'fuel_economy';

const LENGTH = "length";

const MASS = "mass";
Expand Down Expand Up @@ -190,9 +192,6 @@ class Measure
Litre::class,
Millilitre::class,
Pint::class,
KilometrePerLitre::class,
LitrePer100Kilometres::class,
MilesPerGallon::class,
],
self::MASS => [
Gram::class,
Expand Down Expand Up @@ -279,6 +278,11 @@ class Measure
Gigabyte::class,
Terabyte::class,
],
self::FUEL_ECONOMY => [
KilometrePerLitre::class,
LitrePer100Kilometres::class,
MilesPerGallon::class,
],
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Unit/FuelEconomy/FuelEconomyUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ abstract class FuelEconomyUnit extends AbstractUnit
{
protected $base = KilometrePerLitre::class;

protected $unitOf = Measure::VOLUME;
protected $unitOf = Measure::FUEL_ECONOMY;
}
1 change: 1 addition & 0 deletions tests/unit/Registry/UnitRegistry.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function assertListMeasurementsMethodReturnsArray()
"energy",
"frequency",
"digital_storage",
"fuel_economy",
];

$this->assertEquals($expected, $actual);
Expand Down

0 comments on commit 9b03e3d

Please sign in to comment.