i use PHPunit for testing my code that extends the SS core like.
i extend the core class
class TvShow extends DataObject
and I have a test case with code that writes the object to the DB and try to read it again,
but reading always fails.
The code in the uniot test case looks like this:
$show = new TvShow(); $show->ID = 12; $show->ShowTitle = "a title"; $id = $show->write(); $this->assertEquals(12, $id); // test is OK $newShow = DataObject::get_by_id("TvShow", 12); $this->assertInstanceOf("TvShow", $newShow); // FAILS
why does the get_by_id-method not get the freshly written object.
how can i get it? does anyone have the same trouble?
btw: the $show->write(); stores the data in the tmpdb used for that
test case, so the data is there.
thanks a lot,