I want to unit test all my Catalog Entity methods and have a problem with testing getter getId(). When I create the Catalog (new Catalog()) there is no Id set and no setId() method!
My first stupid step was to write the mok:
public function testGetId()
{
$category = $this->getMock('\Dimas\CatalogBundle\Entity\Category');
$category->expects($this->any())
->method('getId')
->will($this->returnValue(352));
$this->assertEquals(352, $category->getId());
}
But this dummy-test did not tested my entity!
What is the right way to test getId() method?
Aucun commentaire:
Enregistrer un commentaire