Hi,
I want to test the creation of a group in my application. So I copied the AR-Test of the tutorial and modified it to my needs. I added a fixture and if I call …::model()->findAll() I get the groups of the fixture.
In my test I want to create a new group und verify, that the group was inserted. $this->assertTrue($group->save()) passes but var_dump($group->id) is NULL.
Here my test:
public function testCreateGroup(){
// Insert new group
$group= RightGroup::model();
$group->title = 'Create Test';
$this->assertTrue($group->save());
// Verify created and updated date
$group = RightGroup::model()->findByPk($group->id);
$this->assertTrue($group instanceof RightGroup);
}
Where is my bug?