This is the test case I have written to test a constructor of class. Is this wrong and is there any other better way ?
/**
* Set values of an edge
*
* @param string|int $point1 starting point of an edge
* @param string|int $point2 end point of an edge
* @param int $value of an edge
*/
public function __construct($point1, $point2, $value)
{
$this->setPoint1($point1);
$this->setPoint2($point2);
$this->setValue($value);
}
/**
* Test for class constructor
*/
public function testConstructor()
{
$edgeObj = new Edge('x', 'y', 15.25);
$this->assertEquals('x', $edgeObj->getPoint1());
$this->assertEquals('y', $edgeObj->getPoint2());
$this->assertEquals(15.25, $edgeObj->getValue());
}
Aucun commentaire:
Enregistrer un commentaire