Skip to content

Commit

Permalink
Add the unitConversion and test the github actions with php 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedFathiM committed Apr 29, 2024
1 parent 8da2884 commit 094f7fb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/SkeletonClass.php

This file was deleted.

23 changes: 23 additions & 0 deletions src/UnitConversionsClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace WeightConversion\UnitConversions;

class UnitConversionsClass
{
public static $grams;

public static function convert($grams)
{
return (new static($grams))->toKilograms();
}

public function __construct($grams)
{
self::$grams = $grams;
}

public function toKilograms()
{
return self::$grams / 1000;
}
}
7 changes: 7 additions & 0 deletions tests/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

use WeightConversion\UnitConversions\UnitConversionsClass;

it('can test', function () {
expect(true)->toBeTrue();
});


it('1000 grams is equal to 1 kilogram', function () {
expect(UnitConversionsClass::convert(1000))->toEqual(1);
});

0 comments on commit 094f7fb

Please sign in to comment.