Skip to content

Commit bdca326

Browse files
committed
feat: add Math source file with tests
1 parent 14c5294 commit bdca326

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

src/Math.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace DataLinx\PhpPackageTemplate;
4+
5+
class Math
6+
{
7+
public static function add($a, $b)
8+
{
9+
return $a + $b;
10+
}
11+
12+
public static function subtract($a, $b)
13+
{
14+
return $a - $b;
15+
}
16+
17+
public static function multiply($a, $b)
18+
{
19+
return $a * $b;
20+
}
21+
22+
}

tests/Feature/ExampleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
test('example', function () {
4+
expect(true)->toBeTrue();
5+
});

tests/Unit/MathTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
use DataLinx\PhpPackageTemplate\Math;
4+
5+
test('it adds two numbers', function () {
6+
expect(Math::add(1, 2))->toBe(3);
7+
});
8+
9+
test('it subtracts two numbers', function () {
10+
expect(Math::subtract(2, 1))->toBe(1);
11+
});
12+
13+
test('it multiplies two numbers', function () {
14+
expect(Math::multiply(2, 2))->toBe(4);
15+
});

0 commit comments

Comments
 (0)