Esempio n. 1
0
 public function testItCanCalculateVolume()
 {
     $square = new Cube(0);
     $this->assertEquals(0, $square->volume());
     $square = new Cube(2);
     $this->assertEquals(8, $square->volume());
     $square = new Cube(3.14);
     $this->assertEquals(30.959144, $square->volume());
 }
Esempio n. 2
0
 /**
  * Input a value that serves as the length of 1 side
  * of a cube and returns the volume.
  *
  * @covers Cube::volume
  */
 public function testCubeVolumeComputationIsCorrect()
 {
     //Set a mock value for the cube's length of side.
     //and compute the volume based on the
     //volume math formula for a cube.
     $length_of_side = 20;
     $volume = pow($length_of_side, 3);
     $this->assertEquals($this->cube->volume(), $volume);
 }