getList() as $proj) { $proj->delete(); } } public function testCreate() { $gproj = Pluf::factory('IDF_Project')->getList(); $this->assertEqual(0, $gproj->count()); $project = new IDF_Project(); $project->name = 'Test project'; $project->shortname = 'test'; $project->description = 'This is a test project.'; $project->create(); $id = $project->id; $p2 = new IDF_Project($id); $this->assertEqual($p2->shortname, $project->shortname); } public function testMultipleCreate() { $project = new IDF_Project(); $project->name = 'Test project'; $project->shortname = 'test'; $project->description = 'This is a test project.'; $project->create(); try { $project = new IDF_Project(); $project->name = 'Test project'; $project->shortname = 'test'; $project->description = 'This is a test project.'; $project->create(); // if here it as failed $this->fail('It should not be possible to create 2 projects with same shortname'); } catch (Exception $e) { $this->pass(); } } }