/** * Input a value that serves as the radius * of a sphere and returns the volume. * * @covers Sphere::volume */ public function testSphereVolumeComputationIsCorrect() { //Set a mock value for the sphere's radius. //and compute the volume based on the //volume math formula for a sphere. $radius = 20; $volume = 4 / 3 * pi() * pow($radius, 3); $this->assertEquals($this->sphere->volume(), $volume); }
public function testItCanCalculateVolume() { $circle = new Sphere(0); $this->assertEquals(0, $circle->volume()); $circle = new Sphere(2); $value = 4 / 3 * pi() * pow(2, 3); $this->assertEquals($value, $circle->volume()); $circle = new Sphere(3.14); $value = 4 / 3 * pi() * pow(3.14, 3); $this->assertEquals($value, $circle->volume()); }