コード例 #1
0
ファイル: ModelTest.php プロジェクト: gotcms/gotcms
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content'));
     $this->view->save();
     $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content'));
     $this->layout->save();
     $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1));
     $this->user->setPassword('test');
     $this->user->save();
     $this->object = Model::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId()));
     $this->object->save();
     $this->documentTypeChildren = Model::fromArray(array('name' => 'Document Type children Name', 'description' => 'Document Type children description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId()));
     $this->documentTypeChildren->save();
     $insert = new Insert();
     $insert->into('document_type_dependency')->values(array('parent_id' => $this->object->getId(), 'children_id' => $this->documentTypeChildren->getId()));
     $this->object->execute($insert);
     $insert = new Insert();
     $insert->into('document_type_view')->values(array('view_id' => $this->view->getId(), 'document_type_id' => $this->object->getId()));
     $this->object->execute($insert);
 }