File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -273,4 +273,20 @@ public static function getUnitDefinitions()
273
273
274
274
return static ::$ unitDefinitions ;
275
275
}
276
+
277
+ /**
278
+ * @return float
279
+ */
280
+ public function getOriginalValue ()
281
+ {
282
+ return $ this ->originalValue ;
283
+ }
284
+
285
+ /**
286
+ * @return string
287
+ */
288
+ public function getOriginalUnit ()
289
+ {
290
+ return $ this ->originalUnit ;
291
+ }
276
292
}
Original file line number Diff line number Diff line change @@ -71,7 +71,17 @@ public function subtract(PhysicalQuantityInterface $quantity);
71
71
* @return boolean True if the quantities are the same, false if not.
72
72
*/
73
73
public function isEquivalentQuantity (PhysicalQuantityInterface $ testQuantity );
74
-
74
+
75
+ /**
76
+ * @return float
77
+ */
78
+ public function getOriginalValue ();
79
+
80
+ /**
81
+ * @return string
82
+ */
83
+ public function getOriginalUnit ();
84
+
75
85
/**
76
86
* Verify if the given value respond to an already defined unit of meaure of the current
77
87
* phisical quantity.
@@ -81,7 +91,7 @@ public function isEquivalentQuantity(PhysicalQuantityInterface $testQuantity);
81
91
* @return boolean True if $name has been defined into the current physical quantity, false if not.
82
92
*/
83
93
public static function isUnitDefined ($ name );
84
-
94
+
85
95
/**
86
96
* Return a list of all the unit of measure defined in the current physical quantity
87
97
*
Original file line number Diff line number Diff line change @@ -253,6 +253,15 @@ public function testListAllUnits(): void
253
253
$ this ->assertEquals ($ allUnits , $ expected );
254
254
}
255
255
256
+ public function testGetOriginalValue ()
257
+ {
258
+ $ value = 2 ;
259
+ $ unit = 'u ' ;
260
+ $ physicalQuantity = new Wonkicity ($ value , $ unit );
261
+ $ this ->assertEquals ($ value , $ physicalQuantity ->getOriginalValue ());
262
+ $ this ->assertEquals ($ unit , $ physicalQuantity ->getOriginalUnit ());
263
+ }
264
+
256
265
/**
257
266
* Attempting to register these units should throw a DuplicateUnitNameOrAlias.
258
267
* 1) The name of the new unit to test
You can’t perform that action at this time.
0 commit comments