Changeset 2986:1e5a2d6a0074 for features
- Timestamp:
- 03/31/15 20:42:36 (11 years ago)
- Branch:
- default
- Location:
- features
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
features/bootstrap/DbContext.php
r2984 r2986 46 46 } 47 47 48 /** 49 * @Given /^a blog:$/ 50 */ 51 public function aBlog(TableNode $table) { 52 foreach ($table->getHash() as $blog) { 53 $this->last_id = self::addBlog($blog); 54 } 55 } 56 48 57 /* 49 58 /* ORM methods … … 85 94 } 86 95 self::executeSqlFile($parameters['sql_cleanup_file'], $replace_user_id); 87 }96 } 88 97 89 98 private function addUser(array $params) { … … 100 109 $user->user_super = 1; 101 110 $user->insert(); 111 } 112 } 113 114 private function addBlog(array $params) { 115 self::getConnection($this->parameters); 116 if (empty($params['blog_id']) || empty($params['blog_name']) || empty($params['blog_url'])) { 117 throw new Exception('blog_id, blog_name and blog_url for blog are mandatory'."\n"); 118 } 119 120 $strReq = 'SELECT count(1) FROM '.self::$prefix.'blog'; 121 $strReq .= ' WHERE blog_id = \''.self::$con->escape($params['blog_id']).'\''; 122 if ((int) self::$con->select($strReq)->f(0)==0) { 123 $blog = self::$con->openCursor(self::$prefix . 'blog'); 124 $blog->blog_id = $params['blog_id']; 125 $blog->blog_name = $params['blog_name']; 126 $blog->blog_url = $params['blog_url']; 127 $blog->blog_creadt = date('Y-m-d H:i:s'); 128 $blog->blog_upddt = date('Y-m-d H:i:s'); 129 $blog->blog_uid = md5(uniqid()); 130 $blog->insert(); 102 131 } 103 132 } -
features/bootstrap/FeatureContext.php
r2985 r2986 62 62 $this->getMink()->assertSession()->cookieExists($session_name); 63 63 } 64 65 /** 66 * @When /^I switch to blog "([^"]*)"$/ 67 */ 68 public function iSwitchToBlog($blog_name) { 69 $this->selectOption('switchblog', $blog_name); 70 $this->pressButton('ok'); 71 } 64 72 } -
features/sql/db_cleanup.sql
r2984 r2986 1 1 DELETE FROM dc_user WHERE user_id != '__USER_ID__'; 2 DELETE FROM dc_spamrule; 3 DELETE FROM dc_blog WHERE blog_id!='default';
Note: See TracChangeset
for help on using the changeset viewer.