/** * Check create a project * * @return Project */ public function testCreateProject() { $model = new Project(); $this->assertFalse($model->validate(), 'Check error validation'); // check title validation $this->assertArrayHasKey('title', $model->getErrors(), 'Check title error validation'); $model->title = str_repeat('ttt', Project::MAX_TITLE_LENGTH); $this->assertFalse($model->validate()); $this->assertArrayHasKey('title', $model->getErrors(), 'Check title error validation'); $model->title = 'Test repo'; $this->assertFalse($model->validate()); $this->assertArrayNotHasKey('title', $model->getErrors()); $this->checkRepoPath($model, Project::REPO_HG); $this->checkRepoPath($model, Project::REPO_GIT); $this->assertTrue($model->save()); return $model; }