My attempts at exercism.org
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 72 lines 1.9 kB view raw
1<?php 2 3use PHPUnit\Framework\TestCase; 4use PHPUnit\Framework\Attributes\TestDox; 5 6class PizzaPiTest extends TestCase 7{ 8 public static function setUpBeforeClass(): void 9 { 10 require_once 'PizzaPi.php'; 11 } 12 13 /** 14 * @task_id 1 15 */ 16 #[TestDox('determine how much dough is required')] 17 public function testCalculateDoughRequirement() 18 { 19 $pizza_pi = new PizzaPi(); 20 $actual = $pizza_pi->calculateDoughRequirement(5, 7); 21 $expected = 1700; 22 $this->assertEquals($expected, $actual); 23 } 24 25 /** 26 * @task_id 2 27 */ 28 #[TestDox('determine how many cans of sauce are required')] 29 public function testCalculateSauceRequirement() 30 { 31 $pizza_pi = new PizzaPi(); 32 $actual = $pizza_pi->calculateSauceRequirement(8, 250); 33 $expected = 4; 34 $this->assertEquals($expected, $actual); 35 } 36 37 /** 38 * @task_id 3 39 */ 40 #[TestDox('determine how many pizzas a cube of cheese can cover')] 41 public function testCalculateCheeseCoverage() 42 { 43 $pizza_pi = new PizzaPi(); 44 $actual = $pizza_pi->calculateCheeseCubeCoverage(25, 0.5, 30); 45 $expected = 331; 46 $this->assertEquals($expected, $actual); 47 } 48 49 /** 50 * @task_id 4 51 */ 52 #[TestDox('determine number of pieces remaining when evenly dividing')] 53 public function testCalculateLeftOverSlicesWithoutLeftOver() 54 { 55 $pizza_pi = new PizzaPi(); 56 $actual = $pizza_pi->calculateLeftOverSlices(2, 4); 57 $expected = 0; 58 $this->assertEquals($expected, $actual); 59 } 60 61 /** 62 * @task_id 4 63 */ 64 #[TestDox('determine number of pieces remaining when not evenly dividing')] 65 public function testCalculateLeftOverSlicesWithLeftOver() 66 { 67 $pizza_pi = new PizzaPi(); 68 $actual = $pizza_pi->calculateLeftOverSlices(4, 3); 69 $expected = 2; 70 $this->assertEquals($expected, $actual); 71 } 72}