/** * Sets the name of the shape and the type (equilateral, isosceles, or * scalene) */ public function setName() { if ($this->sides->isEquilateral()) { $this->type = self::TYPE_EQUILATERAL; } elseif ($this->sides->isScalene()) { $this->type = self::TYPE_SCALENE; } else { $this->type = self::TYPE_ISOSCELES; } $this->name = $this->type . " " . self::SHAPE_NAME; }
public function testScalene() { $triangle = new TriangleSides(7.125, 6.75, 5.3); $this->assertEquals(false, $triangle->isEquilateral()); $this->assertEquals(false, $triangle->isIsosceles()); $this->assertEquals(true, $triangle->isScalene()); }