Completed
Pull Request — master (#292)
by René
17:18
created
tests/Unit/Factories/TextFactory.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,5 +27,5 @@
 block discarded – undo
27 27
  * General factory for the text model.
28 28
  */
29 29
 $fm->define('OCA\Polls\Db\Text')->setDefinitions([
30
-	'text' => Faker::text(255)
30
+    'text' => Faker::text(255)
31 31
 ]);
Please login to merge, or discard this patch.
tests/Unit/Factories/ParticipationTextFactory.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
  * General factory for the participation text model.
28 28
  */
29 29
 $fm->define('OCA\Polls\Db\ParticipationText')->setDefinitions([
30
-	'text' => Faker::text(255),
31
-	'userId' => Faker::firstNameMale(),
32
-	'type' => 0
30
+    'text' => Faker::text(255),
31
+    'userId' => Faker::firstNameMale(),
32
+    'type' => 0
33 33
 ]);
Please login to merge, or discard this patch.
tests/Unit/Factories/CommentFactory.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
  * General factory for the comment model.
28 28
  */
29 29
 $fm->define('OCA\Polls\Db\Comment')->setDefinitions([
30
-	'userId' => Faker::firstNameMale(),
31
-	'dt' => function () {
32
-		$date = new DateTime('today');
33
-		return $date->format('Y-m-d H:i:s');
34
-	},
35
-	'comment' => Faker::text(255)
30
+    'userId' => Faker::firstNameMale(),
31
+    'dt' => function () {
32
+        $date = new DateTime('today');
33
+        return $date->format('Y-m-d H:i:s');
34
+    },
35
+    'comment' => Faker::text(255)
36 36
 ]);
Please login to merge, or discard this patch.
tests/Unit/Factories/EventFactory.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,20 +27,20 @@
 block discarded – undo
27 27
  * General factory for the event model.
28 28
  */
29 29
 $fm->define('OCA\Polls\Db\Event')->setDefinitions([
30
-	'type' => 0,
31
-	'title' => Faker::sentence(10),
32
-	'description' => Faker::text(255),
33
-	'owner' => Faker::firstNameMale(),
34
-	'created' => function () {
35
-		$date = new DateTime('today');
36
-		return $date->format('Y-m-d H:i:s');
37
-	},
38
-	'access' => 'registered',
39
-	'expire' => function () {
40
-		$date = new DateTime('tomorrow');
41
-		return $date->format('Y-m-d H:i:s');
42
-	},
43
-	'hash' => Faker::regexify('[A-Za-z0-9]{16}'),
44
-	'isAnonymous' => 0,
45
-	'fullAnonymous' => 0
30
+    'type' => 0,
31
+    'title' => Faker::sentence(10),
32
+    'description' => Faker::text(255),
33
+    'owner' => Faker::firstNameMale(),
34
+    'created' => function () {
35
+        $date = new DateTime('today');
36
+        return $date->format('Y-m-d H:i:s');
37
+    },
38
+    'access' => 'registered',
39
+    'expire' => function () {
40
+        $date = new DateTime('tomorrow');
41
+        return $date->format('Y-m-d H:i:s');
42
+    },
43
+    'hash' => Faker::regexify('[A-Za-z0-9]{16}'),
44
+    'isAnonymous' => 0,
45
+    'fullAnonymous' => 0
46 46
 ]);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
31 31
 	'title' => Faker::sentence(10),
32 32
 	'description' => Faker::text(255),
33 33
 	'owner' => Faker::firstNameMale(),
34
-	'created' => function () {
34
+	'created' => function() {
35 35
 		$date = new DateTime('today');
36 36
 		return $date->format('Y-m-d H:i:s');
37 37
 	},
38 38
 	'access' => 'registered',
39
-	'expire' => function () {
39
+	'expire' => function() {
40 40
 		$date = new DateTime('tomorrow');
41 41
 		return $date->format('Y-m-d H:i:s');
42 42
 	},
Please login to merge, or discard this patch.
lib/Migration/Version009000Date20171202105141.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -33,207 +33,207 @@
 block discarded – undo
33 33
  */
34 34
 class Version009000Date20171202105141 extends SimpleMigrationStep {
35 35
 
36
-	/**
37
-	 * @param IOutput $output
38
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
-	 * @param array $options
40
-	 * @return null|ISchemaWrapper
41
-	 * @since 13.0.0
42
-	 */
43
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
44
-		/** @var ISchemaWrapper $schema */
45
-		$schema = $schemaClosure();
36
+    /**
37
+     * @param IOutput $output
38
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
+     * @param array $options
40
+     * @return null|ISchemaWrapper
41
+     * @since 13.0.0
42
+     */
43
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
44
+        /** @var ISchemaWrapper $schema */
45
+        $schema = $schemaClosure();
46 46
 
47
-		if (!$schema->hasTable('polls_events')) {
48
-			$table = $schema->createTable('polls_events');
49
-			$table->addColumn('id', Type::INTEGER, [
50
-				'autoincrement' => true,
51
-				'notnull' => true,
52
-			]);
53
-			$table->addColumn('hash', Type::STRING, [
54
-				'notnull' => false,
55
-				'length' => 64,
56
-			]);
57
-			$table->addColumn('type', Type::BIGINT, [
58
-				'notnull' => false,
59
-				'length' => 16,
60
-			]);
61
-			$table->addColumn('title', Type::STRING, [
62
-				'notnull' => true,
63
-				'length' => 128,
64
-			]);
65
-			$table->addColumn('description', Type::STRING, [
66
-				'notnull' => true,
67
-				'length' => 1024,
68
-			]);
69
-			$table->addColumn('owner', Type::STRING, [
70
-				'notnull' => true,
71
-				'length' => 64,
72
-			]);
73
-			$table->addColumn('created', Type::DATETIME, [
74
-				'notnull' => false,
75
-			]);
76
-			$table->addColumn('access', Type::STRING, [
77
-				'notnull' => false,
78
-				'length' => 1024,
79
-			]);
80
-			$table->addColumn('expire', Type::DATETIME, [
81
-				'notnull' => false,
82
-			]);
83
-			$table->addColumn('is_anonymous', Type::INTEGER, [
84
-				'notnull' => false,
85
-				'default' => 0,
86
-			]);
87
-			$table->addColumn('full_anonymous', Type::INTEGER, [
88
-				'notnull' => false,
89
-				'default' => 0,
90
-			]);
91
-			$table->setPrimaryKey(['id']);
92
-		}
47
+        if (!$schema->hasTable('polls_events')) {
48
+            $table = $schema->createTable('polls_events');
49
+            $table->addColumn('id', Type::INTEGER, [
50
+                'autoincrement' => true,
51
+                'notnull' => true,
52
+            ]);
53
+            $table->addColumn('hash', Type::STRING, [
54
+                'notnull' => false,
55
+                'length' => 64,
56
+            ]);
57
+            $table->addColumn('type', Type::BIGINT, [
58
+                'notnull' => false,
59
+                'length' => 16,
60
+            ]);
61
+            $table->addColumn('title', Type::STRING, [
62
+                'notnull' => true,
63
+                'length' => 128,
64
+            ]);
65
+            $table->addColumn('description', Type::STRING, [
66
+                'notnull' => true,
67
+                'length' => 1024,
68
+            ]);
69
+            $table->addColumn('owner', Type::STRING, [
70
+                'notnull' => true,
71
+                'length' => 64,
72
+            ]);
73
+            $table->addColumn('created', Type::DATETIME, [
74
+                'notnull' => false,
75
+            ]);
76
+            $table->addColumn('access', Type::STRING, [
77
+                'notnull' => false,
78
+                'length' => 1024,
79
+            ]);
80
+            $table->addColumn('expire', Type::DATETIME, [
81
+                'notnull' => false,
82
+            ]);
83
+            $table->addColumn('is_anonymous', Type::INTEGER, [
84
+                'notnull' => false,
85
+                'default' => 0,
86
+            ]);
87
+            $table->addColumn('full_anonymous', Type::INTEGER, [
88
+                'notnull' => false,
89
+                'default' => 0,
90
+            ]);
91
+            $table->setPrimaryKey(['id']);
92
+        }
93 93
 
94
-		if (!$schema->hasTable('polls_options')) {
95
-			$table = $schema->createTable('polls_options');
96
-			$table->addColumn('id', Type::INTEGER, [
97
-				'autoincrement' => true,
98
-				'notnull' => true,
99
-			]);
100
-			$table->addColumn('poll_id', Type::INTEGER, [
101
-				'notnull' => false,
102
-			]);
103
-			$table->addColumn('poll_date', Type::DATETIME, [
104
-				'notnull' => false,
105
-				'length' => 32,
106
-			]);
107
-			$table->addColumn('poll_text', Type::STRING, [
108
-				'notnull' => false,
109
-				'length' => 256,
110
-			]);
111
-			$table->setPrimaryKey(['id']);
112
-		}
94
+        if (!$schema->hasTable('polls_options')) {
95
+            $table = $schema->createTable('polls_options');
96
+            $table->addColumn('id', Type::INTEGER, [
97
+                'autoincrement' => true,
98
+                'notnull' => true,
99
+            ]);
100
+            $table->addColumn('poll_id', Type::INTEGER, [
101
+                'notnull' => false,
102
+            ]);
103
+            $table->addColumn('poll_date', Type::DATETIME, [
104
+                'notnull' => false,
105
+                'length' => 32,
106
+            ]);
107
+            $table->addColumn('poll_text', Type::STRING, [
108
+                'notnull' => false,
109
+                'length' => 256,
110
+            ]);
111
+            $table->setPrimaryKey(['id']);
112
+        }
113 113
 		
114
-		if (!$schema->hasTable('polls_dts')) {
115
-			// Todo: move contents to polls_options
116
-			// Todo: drop table polls_dts
117
-			// do this in postSchemaChange?
118
-			$table = $schema->createTable('polls_dts');
119
-			$table->addColumn('id', Type::INTEGER, [
120
-				'autoincrement' => true,
121
-				'notnull' => true,
122
-			]);
123
-			$table->addColumn('poll_id', Type::INTEGER, [
124
-				'notnull' => false,
125
-			]);
126
-			$table->addColumn('dt', Type::DATETIME, [
127
-				'notnull' => false,
128
-				'length' => 32,
129
-			]);
130
-			$table->setPrimaryKey(['id']);
131
-		}
114
+        if (!$schema->hasTable('polls_dts')) {
115
+            // Todo: move contents to polls_options
116
+            // Todo: drop table polls_dts
117
+            // do this in postSchemaChange?
118
+            $table = $schema->createTable('polls_dts');
119
+            $table->addColumn('id', Type::INTEGER, [
120
+                'autoincrement' => true,
121
+                'notnull' => true,
122
+            ]);
123
+            $table->addColumn('poll_id', Type::INTEGER, [
124
+                'notnull' => false,
125
+            ]);
126
+            $table->addColumn('dt', Type::DATETIME, [
127
+                'notnull' => false,
128
+                'length' => 32,
129
+            ]);
130
+            $table->setPrimaryKey(['id']);
131
+        }
132 132
 
133
-		if (!$schema->hasTable('polls_txts')) {
134
-			// Todo: move contents to polls_options
135
-			// Todo: drop table polls_txts
136
-			// do this in postSchemaChange?
137
-			$table = $schema->createTable('polls_txts');
138
-			$table->addColumn('id', Type::INTEGER, [
139
-				'autoincrement' => true,
140
-				'notnull' => true,
141
-			]);
142
-			$table->addColumn('poll_id', Type::INTEGER, [
143
-				'notnull' => false,
144
-			]);
145
-			$table->addColumn('text', Type::STRING, [
146
-				'notnull' => false,
147
-				'length' => 256,
148
-			]);
149
-			$table->setPrimaryKey(['id']);
150
-		}
133
+        if (!$schema->hasTable('polls_txts')) {
134
+            // Todo: move contents to polls_options
135
+            // Todo: drop table polls_txts
136
+            // do this in postSchemaChange?
137
+            $table = $schema->createTable('polls_txts');
138
+            $table->addColumn('id', Type::INTEGER, [
139
+                'autoincrement' => true,
140
+                'notnull' => true,
141
+            ]);
142
+            $table->addColumn('poll_id', Type::INTEGER, [
143
+                'notnull' => false,
144
+            ]);
145
+            $table->addColumn('text', Type::STRING, [
146
+                'notnull' => false,
147
+                'length' => 256,
148
+            ]);
149
+            $table->setPrimaryKey(['id']);
150
+        }
151 151
 		
152
-		if (!$schema->hasTable('polls_particip')) {
153
-			$table = $schema->createTable('polls_particip');
154
-			$table->addColumn('id', Type::INTEGER, [
155
-				'autoincrement' => true,
156
-				'notnull' => true,
157
-			]);
158
-			$table->addColumn('poll_id', Type::INTEGER, [
159
-				'notnull' => false,
160
-			]);
161
-			$table->addColumn('dt', Type::DATETIME, [
162
-				'notnull' => false,
163
-			]);
164
-			$table->addColumn('type', Type::INTEGER, [
165
-				'notnull' => false,
166
-			]);
167
-			$table->addColumn('user_id', Type::STRING, [
168
-				'notnull' => true,
169
-				'length' => 64,
170
-			]);
171
-			$table->setPrimaryKey(['id']);
172
-		}
152
+        if (!$schema->hasTable('polls_particip')) {
153
+            $table = $schema->createTable('polls_particip');
154
+            $table->addColumn('id', Type::INTEGER, [
155
+                'autoincrement' => true,
156
+                'notnull' => true,
157
+            ]);
158
+            $table->addColumn('poll_id', Type::INTEGER, [
159
+                'notnull' => false,
160
+            ]);
161
+            $table->addColumn('dt', Type::DATETIME, [
162
+                'notnull' => false,
163
+            ]);
164
+            $table->addColumn('type', Type::INTEGER, [
165
+                'notnull' => false,
166
+            ]);
167
+            $table->addColumn('user_id', Type::STRING, [
168
+                'notnull' => true,
169
+                'length' => 64,
170
+            ]);
171
+            $table->setPrimaryKey(['id']);
172
+        }
173 173
 
174
-		if (!$schema->hasTable('polls_particip_text')) {
175
-			$table = $schema->createTable('polls_particip_text');
176
-			$table->addColumn('id', Type::INTEGER, [
177
-				'autoincrement' => true,
178
-				'notnull' => true,
179
-			]);
180
-			$table->addColumn('poll_id', Type::INTEGER, [
181
-				'notnull' => false,
182
-			]);
183
-			$table->addColumn('text', Type::STRING, [
184
-				'notnull' => false,
185
-				'length' => 256,
186
-			]);
187
-			$table->addColumn('user_id', Type::STRING, [
188
-				'notnull' => true,
189
-				'length' => 64,
190
-			]);
191
-			$table->addColumn('type', Type::INTEGER, [
192
-				'notnull' => false,
193
-			]);
194
-			$table->setPrimaryKey(['id']);
195
-		}
174
+        if (!$schema->hasTable('polls_particip_text')) {
175
+            $table = $schema->createTable('polls_particip_text');
176
+            $table->addColumn('id', Type::INTEGER, [
177
+                'autoincrement' => true,
178
+                'notnull' => true,
179
+            ]);
180
+            $table->addColumn('poll_id', Type::INTEGER, [
181
+                'notnull' => false,
182
+            ]);
183
+            $table->addColumn('text', Type::STRING, [
184
+                'notnull' => false,
185
+                'length' => 256,
186
+            ]);
187
+            $table->addColumn('user_id', Type::STRING, [
188
+                'notnull' => true,
189
+                'length' => 64,
190
+            ]);
191
+            $table->addColumn('type', Type::INTEGER, [
192
+                'notnull' => false,
193
+            ]);
194
+            $table->setPrimaryKey(['id']);
195
+        }
196 196
 
197
-		if (!$schema->hasTable('polls_comments')) {
198
-			$table = $schema->createTable('polls_comments');
199
-			$table->addColumn('id', Type::INTEGER, [
200
-				'autoincrement' => true,
201
-				'notnull' => true,
202
-			]);
203
-			$table->addColumn('poll_id', Type::INTEGER, [
204
-				'notnull' => false,
205
-			]);
206
-			$table->addColumn('user_id', Type::STRING, [
207
-				'notnull' => true,
208
-				'length' => 64,
209
-			]);
210
-			$table->addColumn('dt', Type::STRING, [
211
-				'notnull' => true,
212
-				'length' => 32,
213
-			]);
214
-			$table->addColumn('comment', Type::STRING, [
215
-				'notnull' => false,
216
-				'length' => 1024,
217
-			]);
218
-			$table->setPrimaryKey(['id']);
219
-		}
197
+        if (!$schema->hasTable('polls_comments')) {
198
+            $table = $schema->createTable('polls_comments');
199
+            $table->addColumn('id', Type::INTEGER, [
200
+                'autoincrement' => true,
201
+                'notnull' => true,
202
+            ]);
203
+            $table->addColumn('poll_id', Type::INTEGER, [
204
+                'notnull' => false,
205
+            ]);
206
+            $table->addColumn('user_id', Type::STRING, [
207
+                'notnull' => true,
208
+                'length' => 64,
209
+            ]);
210
+            $table->addColumn('dt', Type::STRING, [
211
+                'notnull' => true,
212
+                'length' => 32,
213
+            ]);
214
+            $table->addColumn('comment', Type::STRING, [
215
+                'notnull' => false,
216
+                'length' => 1024,
217
+            ]);
218
+            $table->setPrimaryKey(['id']);
219
+        }
220 220
 
221
-		if (!$schema->hasTable('polls_notif')) {
222
-			$table = $schema->createTable('polls_notif');
223
-			$table->addColumn('id', Type::INTEGER, [
224
-				'autoincrement' => true,
225
-				'notnull' => true,
226
-			]);
227
-			$table->addColumn('poll_id', Type::INTEGER, [
228
-				'notnull' => false,
229
-			]);
230
-			$table->addColumn('user_id', Type::STRING, [
231
-				'notnull' => true,
232
-				'length' => 64,
233
-			]);
234
-			$table->setPrimaryKey(['id']);
235
-		}
236
-		return $schema;
237
-	}
221
+        if (!$schema->hasTable('polls_notif')) {
222
+            $table = $schema->createTable('polls_notif');
223
+            $table->addColumn('id', Type::INTEGER, [
224
+                'autoincrement' => true,
225
+                'notnull' => true,
226
+            ]);
227
+            $table->addColumn('poll_id', Type::INTEGER, [
228
+                'notnull' => false,
229
+            ]);
230
+            $table->addColumn('user_id', Type::STRING, [
231
+                'notnull' => true,
232
+                'length' => 64,
233
+            ]);
234
+            $table->setPrimaryKey(['id']);
235
+        }
236
+        return $schema;
237
+    }
238 238
 
239 239
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 				'notnull' => false,
89 89
 				'default' => 0,
90 90
 			]);
91
-			$table->setPrimaryKey(['id']);
91
+			$table->setPrimaryKey([ 'id' ]);
92 92
 		}
93 93
 
94 94
 		if (!$schema->hasTable('polls_options')) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'notnull' => false,
109 109
 				'length' => 256,
110 110
 			]);
111
-			$table->setPrimaryKey(['id']);
111
+			$table->setPrimaryKey([ 'id' ]);
112 112
 		}
113 113
 		
114 114
 		if (!$schema->hasTable('polls_dts')) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 				'notnull' => false,
128 128
 				'length' => 32,
129 129
 			]);
130
-			$table->setPrimaryKey(['id']);
130
+			$table->setPrimaryKey([ 'id' ]);
131 131
 		}
132 132
 
133 133
 		if (!$schema->hasTable('polls_txts')) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 				'notnull' => false,
147 147
 				'length' => 256,
148 148
 			]);
149
-			$table->setPrimaryKey(['id']);
149
+			$table->setPrimaryKey([ 'id' ]);
150 150
 		}
151 151
 		
152 152
 		if (!$schema->hasTable('polls_particip')) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 				'notnull' => true,
169 169
 				'length' => 64,
170 170
 			]);
171
-			$table->setPrimaryKey(['id']);
171
+			$table->setPrimaryKey([ 'id' ]);
172 172
 		}
173 173
 
174 174
 		if (!$schema->hasTable('polls_particip_text')) {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			$table->addColumn('type', Type::INTEGER, [
192 192
 				'notnull' => false,
193 193
 			]);
194
-			$table->setPrimaryKey(['id']);
194
+			$table->setPrimaryKey([ 'id' ]);
195 195
 		}
196 196
 
197 197
 		if (!$schema->hasTable('polls_comments')) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				'notnull' => false,
216 216
 				'length' => 1024,
217 217
 			]);
218
-			$table->setPrimaryKey(['id']);
218
+			$table->setPrimaryKey([ 'id' ]);
219 219
 		}
220 220
 
221 221
 		if (!$schema->hasTable('polls_notif')) {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				'notnull' => true,
232 232
 				'length' => 64,
233 233
 			]);
234
-			$table->setPrimaryKey(['id']);
234
+			$table->setPrimaryKey([ 'id' ]);
235 235
 		}
236 236
 		return $schema;
237 237
 	}
Please login to merge, or discard this patch.