Skip to content

Commit

Permalink
Merge pull request #9 from brewerwall/feature/boil
Browse files Browse the repository at this point in the history
Boil Rate
  • Loading branch information
griffithben authored Oct 3, 2023
2 parents 51bc7b2 + 5e254cc commit d1f221f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pattern of `$rate->get{Unit}Per{Unit}` for the respective units. Example using F

### Flow

This class represent the amount of Volume over a period of Time.
This class represent the amount of Volume flowed over a period of Time.

```php
$flow = new Flow(new Volume(gallon: 5), new Time(hour: 1));
Expand All @@ -165,6 +165,20 @@ $flow->getGallonPerMinute(); // 0.083333333333333

___

### Boil

This class represent the amount of Volume boiled over a period of Time.

```php
$boil = new Boil(new Volume(gallon: 5), new Time(hour: 1));

$boil->getGallonPerHour(); // 5

$boil->getGallonPerMinute(); // 0.083333333333333
```

___

## Calculate

A library of calculations that can be used with various Unitz classes.
Expand Down
8 changes: 8 additions & 0 deletions src/Rate/Boil.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Unitz\Rate;

class Boil extends Flow
{
// Boil Rate is the same as Flow Rate in the sense that it is a Volume per Time in evaporation.
}
17 changes: 17 additions & 0 deletions tests/Rate/BoilRate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Tests\Rate;

use PHPUnit\Framework\TestCase;
use Unitz\Rate\Boil;
use Unitz\Time;
use Unitz\Volume;

class BoilRate extends TestCase
{
public function testFlowReturnsCorrectValue(): void
{
$boil = new Boil(new Volume(gallon: 3), new Time(minute: 1));
$this->assertEquals(new Volume(gallon: 3), $boil->getGallonsPerMinute());
}
}
4 changes: 2 additions & 2 deletions tests/Rate/FlowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public function testVolumeWithInvalidNumeratorUnitTypeThrowsRuntimeException():
public function testVolumeWithInvalidDenominatorUnitTypeThrowsRuntimeException(): void
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Method getBannana does not exist on Unitz\Time');
$this->expectExceptionMessage('Method getBanana does not exist on Unitz\Time');

$flow = new Flow(new Volume(gallon: 3), new Time(minute: 1));
$flow->getGallonsPerBannanas();
$flow->getGallonsPerBananas();
}

public function testFlowReturnsCorrectValue(): void
Expand Down

0 comments on commit d1f221f

Please sign in to comment.