From 1da5dd5a79bc7ca083c0c4216fc3b4b0854f623d Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 29 Sep 2022 22:00:17 +0100 Subject: [PATCH] feat: FizzBuzz at PHP South Wales --- php/tests/ExampleTest.php | 5 ----- php/tests/FizzBuzzTest.php | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) delete mode 100644 php/tests/ExampleTest.php create mode 100644 php/tests/FizzBuzzTest.php diff --git a/php/tests/ExampleTest.php b/php/tests/ExampleTest.php deleted file mode 100644 index 5d0a193..0000000 --- a/php/tests/ExampleTest.php +++ /dev/null @@ -1,5 +0,0 @@ -toBeTrue(); -}); diff --git a/php/tests/FizzBuzzTest.php b/php/tests/FizzBuzzTest.php new file mode 100644 index 0000000..62e4330 --- /dev/null +++ b/php/tests/FizzBuzzTest.php @@ -0,0 +1,40 @@ +toBe($expected); +})->with([ + [1, '1'], + [2, '2'], + [4, '4'], + [7, '7'], + [8, '8'], +]); + +test('Numbers divisible by or containing 3 should return "Fizz"', function ($input) { + expect(FizzBuzz($input))->toBe('Fizz'); +})->with([3, 6, 9, 13]); + +test('Numbers divisible by or containing 5 should return "Buzz"', function ($input) { + expect(FizzBuzz($input))->toBe('Buzz'); +})->with([5, 10, 20, 52]); + +test('Numbers divisible by or containing 5 or divisible or containing 3 should return "FizzBuzz"', function ($input) { + expect(FizzBuzz($input))->toBe('FizzBuzz'); +})->with([15, 30, 35, 53]); \ No newline at end of file