public function testOpenNewBug() { // Some cheating $_SERVER["SERVER_NAME"] = '127.0.0.1'; // Login as root $model = new LoginForm('RegularLogin'); $model->username = "******"; $model->password = "******"; $this->assertTrue($model->login()); // Create new bug $bug = new Bug('create'); $bug->summary = "Bug on Crash Report #1"; $bug->description = "Some description"; $bug->assigned_to = 2; $bug->status = Bug::STATUS_NEW; $bug->priority = Bug::PRIORITY_MEDIUM; $bug->reproducability = Bug::REPRO_ALWAYS; // Validate - should fail (crashreports or crashgroups should be set) $this->assertFalse($bug->validate()); // Assign incorrect crashreports attribute $bug->crashreports = "1 abc"; // Validate - should fail $this->assertFalse($bug->validate()); // Assign incorrect crashreports attribute - not existing ID $bug->crashreports = "10"; // Validate - should fail $this->assertFalse($bug->validate()); // Assign correct crashreport IDs $bug->crashreports = "3 4"; // Ensure the info is correct $this->assertTrue($bug->validate()); // Assign crashgroup IDs $bug->crashgroups = '3'; // Apply changes $opened = $bug->open(); //$err = $bug->getErrors(); //var_dump($err); // Should succeed $this->assertTrue($opened); }