guard-codeception 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -4
  3. data/README.md +19 -9
  4. data/Rakefile +5 -0
  5. data/guard-codeception.gemspec +1 -1
  6. data/lib/guard/codeception.rb +10 -22
  7. data/lib/guard/codeception/runner.rb +44 -0
  8. data/lib/guard/codeception/version.rb +1 -1
  9. data/spec/fixtures/codeception/codeception.yml +18 -0
  10. data/spec/fixtures/codeception/composer.json +18 -0
  11. data/spec/fixtures/codeception/composer.lock +1545 -0
  12. data/spec/fixtures/codeception/index.php +1 -0
  13. data/spec/fixtures/codeception/tests/_bootstrap.php +2 -0
  14. data/spec/fixtures/codeception/tests/_data/dump.sql +1 -0
  15. data/spec/fixtures/codeception/tests/_helpers/CodeHelper.php +8 -0
  16. data/spec/fixtures/codeception/tests/_helpers/TestHelper.php +8 -0
  17. data/spec/fixtures/codeception/tests/_helpers/WebHelper.php +8 -0
  18. data/spec/fixtures/codeception/tests/_log/acceptance-2013-12-28 +19 -0
  19. data/spec/fixtures/codeception/tests/_log/indexCept.php.page.fail.html +1 -0
  20. data/spec/fixtures/codeception/tests/acceptance.suite.yml +18 -0
  21. data/spec/fixtures/codeception/tests/acceptance/WebGuy.php +2061 -0
  22. data/spec/fixtures/codeception/tests/acceptance/_bootstrap.php +2 -0
  23. data/spec/fixtures/codeception/tests/acceptance/indexCept.php +5 -0
  24. data/spec/fixtures/codeception/tests/functional.suite.yml +11 -0
  25. data/spec/fixtures/codeception/tests/functional/TestGuy.php +460 -0
  26. data/spec/fixtures/codeception/tests/functional/_bootstrap.php +2 -0
  27. data/spec/fixtures/codeception/tests/unit.suite.yml +8 -0
  28. data/spec/fixtures/codeception/tests/unit/CodeGuy.php +47 -0
  29. data/spec/fixtures/codeception/tests/unit/_bootstrap.php +2 -0
  30. data/spec/fixtures/results/codeception_failure +29 -0
  31. data/spec/fixtures/results/codeception_success +17 -0
  32. data/spec/guard/codeception/runner_spec.rb +59 -0
  33. data/spec/guard/codeception_spec.rb +32 -14
  34. metadata +66 -17
@@ -0,0 +1,2 @@
1
+ <?php
2
+ // Here you can initialize variables that will for your tests
@@ -0,0 +1,5 @@
1
+ <?php
2
+ $scenario->group('group1');
3
+ $I = new WebGuy($scenario);
4
+ $I->amOnPage('/');
5
+ $I->see('Foo Bar', 'h2');
@@ -0,0 +1,11 @@
1
+ # Codeception Test Suite Configuration
2
+
3
+ # suite for functional (integration) tests.
4
+ # emulate web requests and make application process them.
5
+ # (tip: better to use with frameworks).
6
+
7
+ # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
8
+
9
+ class_name: TestGuy
10
+ modules:
11
+ enabled: [Filesystem, TestHelper]
@@ -0,0 +1,460 @@
1
+ <?php
2
+ // This class was automatically generated by build task
3
+ // You should not change it manually as it will be overwritten on next build
4
+ // @codingStandardsIgnoreFile
5
+
6
+
7
+ use \Codeception\Maybe;
8
+ use Codeception\Module\Filesystem;
9
+ use Codeception\Module\TestHelper;
10
+
11
+ /**
12
+ * Inherited methods
13
+ * @method void execute($callable)
14
+ * @method void wantToTest($text)
15
+ * @method void wantTo($text)
16
+ * @method void expectTo($prediction)
17
+ * @method void expect($prediction)
18
+ * @method void amGoingTo($argumentation)
19
+ * @method void am($role)
20
+ * @method void lookForwardTo($achieveValue)
21
+ * @method void offsetGet($offset)
22
+ * @method void offsetSet($offset, $value)
23
+ * @method void offsetExists($offset)
24
+ * @method void offsetUnset($offset)
25
+ */
26
+
27
+ class TestGuy extends \Codeception\AbstractGuy
28
+ {
29
+
30
+ /**
31
+ * This method is generated.
32
+ * Documentation taken from corresponding module.
33
+ * ----------------------------------------------
34
+ *
35
+ * Enters a directory In local filesystem.
36
+ * Project root directory is used by default
37
+ *
38
+ * @param $path
39
+ * @see Codeception\Module\Filesystem::amInPath()
40
+ * @return \Codeception\Maybe
41
+ */
42
+ public function amInPath($path) {
43
+ $this->scenario->addStep(new \Codeception\Step\Condition('amInPath', func_get_args()));
44
+ if ($this->scenario->running()) {
45
+ $result = $this->scenario->runStep();
46
+ return new Maybe($result);
47
+ }
48
+ return new Maybe();
49
+ }
50
+
51
+
52
+ /**
53
+ * This method is generated.
54
+ * Documentation taken from corresponding module.
55
+ * ----------------------------------------------
56
+ *
57
+ * Opens a file and stores it's content.
58
+ *
59
+ * Usage:
60
+ *
61
+ * ``` php
62
+ * <?php
63
+ * $I->openFile('composer.json');
64
+ * $I->seeInThisFile('codeception/codeception');
65
+ * ?>
66
+ * ```
67
+ *
68
+ * @param $filename
69
+ * @see Codeception\Module\Filesystem::openFile()
70
+ * @return \Codeception\Maybe
71
+ */
72
+ public function openFile($filename) {
73
+ $this->scenario->addStep(new \Codeception\Step\Action('openFile', func_get_args()));
74
+ if ($this->scenario->running()) {
75
+ $result = $this->scenario->runStep();
76
+ return new Maybe($result);
77
+ }
78
+ return new Maybe();
79
+ }
80
+
81
+
82
+ /**
83
+ * This method is generated.
84
+ * Documentation taken from corresponding module.
85
+ * ----------------------------------------------
86
+ *
87
+ * Deletes a file
88
+ *
89
+ * ``` php
90
+ * <?php
91
+ * $I->deleteFile('composer.lock');
92
+ * ?>
93
+ * ```
94
+ *
95
+ * @param $filename
96
+ * @see Codeception\Module\Filesystem::deleteFile()
97
+ * @return \Codeception\Maybe
98
+ */
99
+ public function deleteFile($filename) {
100
+ $this->scenario->addStep(new \Codeception\Step\Action('deleteFile', func_get_args()));
101
+ if ($this->scenario->running()) {
102
+ $result = $this->scenario->runStep();
103
+ return new Maybe($result);
104
+ }
105
+ return new Maybe();
106
+ }
107
+
108
+
109
+ /**
110
+ * This method is generated.
111
+ * Documentation taken from corresponding module.
112
+ * ----------------------------------------------
113
+ *
114
+ * Deletes directory with all subdirectories
115
+ *
116
+ * ``` php
117
+ * <?php
118
+ * $I->deleteDir('vendor');
119
+ * ?>
120
+ * ```
121
+ *
122
+ * @param $dirname
123
+ * @see Codeception\Module\Filesystem::deleteDir()
124
+ * @return \Codeception\Maybe
125
+ */
126
+ public function deleteDir($dirname) {
127
+ $this->scenario->addStep(new \Codeception\Step\Action('deleteDir', func_get_args()));
128
+ if ($this->scenario->running()) {
129
+ $result = $this->scenario->runStep();
130
+ return new Maybe($result);
131
+ }
132
+ return new Maybe();
133
+ }
134
+
135
+
136
+ /**
137
+ * This method is generated.
138
+ * Documentation taken from corresponding module.
139
+ * ----------------------------------------------
140
+ *
141
+ * Copies directory with all contents
142
+ *
143
+ * ``` php
144
+ * <?php
145
+ * $I->copyDir('vendor','old_vendor');
146
+ * ?>
147
+ * ```
148
+ *
149
+ * @param $src
150
+ * @param $dst
151
+ * @see Codeception\Module\Filesystem::copyDir()
152
+ * @return \Codeception\Maybe
153
+ */
154
+ public function copyDir($src, $dst) {
155
+ $this->scenario->addStep(new \Codeception\Step\Action('copyDir', func_get_args()));
156
+ if ($this->scenario->running()) {
157
+ $result = $this->scenario->runStep();
158
+ return new Maybe($result);
159
+ }
160
+ return new Maybe();
161
+ }
162
+
163
+
164
+ /**
165
+ * This method is generated.
166
+ * Documentation taken from corresponding module.
167
+ * ----------------------------------------------
168
+ *
169
+ * Checks If opened file has `text` in it.
170
+ *
171
+ * Usage:
172
+ *
173
+ * ``` php
174
+ * <?php
175
+ * $I->openFile('composer.json');
176
+ * $I->seeInThisFile('codeception/codeception');
177
+ * ?>
178
+ * ```
179
+ *
180
+ * @param $text
181
+ * Conditional Assertion: Test won't be stopped on fail
182
+ * @see Codeception\Module\Filesystem::seeInThisFile()
183
+ * @return \Codeception\Maybe
184
+ */
185
+ public function canSeeInThisFile($text) {
186
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args()));
187
+ if ($this->scenario->running()) {
188
+ $result = $this->scenario->runStep();
189
+ return new Maybe($result);
190
+ }
191
+ return new Maybe();
192
+ }
193
+ /**
194
+ * This method is generated.
195
+ * Documentation taken from corresponding module.
196
+ * ----------------------------------------------
197
+ *
198
+ * Checks If opened file has `text` in it.
199
+ *
200
+ * Usage:
201
+ *
202
+ * ``` php
203
+ * <?php
204
+ * $I->openFile('composer.json');
205
+ * $I->seeInThisFile('codeception/codeception');
206
+ * ?>
207
+ * ```
208
+ *
209
+ * @param $text
210
+ * @see Codeception\Module\Filesystem::seeInThisFile()
211
+ * @return \Codeception\Maybe
212
+ */
213
+ public function seeInThisFile($text) {
214
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args()));
215
+ if ($this->scenario->running()) {
216
+ $result = $this->scenario->runStep();
217
+ return new Maybe($result);
218
+ }
219
+ return new Maybe();
220
+ }
221
+
222
+
223
+ /**
224
+ * This method is generated.
225
+ * Documentation taken from corresponding module.
226
+ * ----------------------------------------------
227
+ *
228
+ * Checks the strict matching of file contents.
229
+ * Unlike `seeInThisFile` will fail if file has something more then expected lines.
230
+ * Better to use with HEREDOC strings.
231
+ * Matching is done after removing "\r" chars from file content.
232
+ *
233
+ * ``` php
234
+ * <?php
235
+ * $I->openFile('process.pid');
236
+ * $I->seeFileContentsEqual('3192');
237
+ * ?>
238
+ * ```
239
+ *
240
+ * @param $text
241
+ * Conditional Assertion: Test won't be stopped on fail
242
+ * @see Codeception\Module\Filesystem::seeFileContentsEqual()
243
+ * @return \Codeception\Maybe
244
+ */
245
+ public function canSeeFileContentsEqual($text) {
246
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args()));
247
+ if ($this->scenario->running()) {
248
+ $result = $this->scenario->runStep();
249
+ return new Maybe($result);
250
+ }
251
+ return new Maybe();
252
+ }
253
+ /**
254
+ * This method is generated.
255
+ * Documentation taken from corresponding module.
256
+ * ----------------------------------------------
257
+ *
258
+ * Checks the strict matching of file contents.
259
+ * Unlike `seeInThisFile` will fail if file has something more then expected lines.
260
+ * Better to use with HEREDOC strings.
261
+ * Matching is done after removing "\r" chars from file content.
262
+ *
263
+ * ``` php
264
+ * <?php
265
+ * $I->openFile('process.pid');
266
+ * $I->seeFileContentsEqual('3192');
267
+ * ?>
268
+ * ```
269
+ *
270
+ * @param $text
271
+ * @see Codeception\Module\Filesystem::seeFileContentsEqual()
272
+ * @return \Codeception\Maybe
273
+ */
274
+ public function seeFileContentsEqual($text) {
275
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args()));
276
+ if ($this->scenario->running()) {
277
+ $result = $this->scenario->runStep();
278
+ return new Maybe($result);
279
+ }
280
+ return new Maybe();
281
+ }
282
+
283
+
284
+ /**
285
+ * This method is generated.
286
+ * Documentation taken from corresponding module.
287
+ * ----------------------------------------------
288
+ *
289
+ * Checks If opened file doesn't contain `text` in it
290
+ *
291
+ * ``` php
292
+ * <?php
293
+ * $I->openFile('composer.json');
294
+ * $I->dontSeeInThisFile('codeception/codeception');
295
+ * ?>
296
+ * ```
297
+ *
298
+ * @param $text
299
+ * Conditional Assertion: Test won't be stopped on fail
300
+ * @see Codeception\Module\Filesystem::dontSeeInThisFile()
301
+ * @return \Codeception\Maybe
302
+ */
303
+ public function cantSeeInThisFile($text) {
304
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args()));
305
+ if ($this->scenario->running()) {
306
+ $result = $this->scenario->runStep();
307
+ return new Maybe($result);
308
+ }
309
+ return new Maybe();
310
+ }
311
+ /**
312
+ * This method is generated.
313
+ * Documentation taken from corresponding module.
314
+ * ----------------------------------------------
315
+ *
316
+ * Checks If opened file doesn't contain `text` in it
317
+ *
318
+ * ``` php
319
+ * <?php
320
+ * $I->openFile('composer.json');
321
+ * $I->dontSeeInThisFile('codeception/codeception');
322
+ * ?>
323
+ * ```
324
+ *
325
+ * @param $text
326
+ * @see Codeception\Module\Filesystem::dontSeeInThisFile()
327
+ * @return \Codeception\Maybe
328
+ */
329
+ public function dontSeeInThisFile($text) {
330
+ $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args()));
331
+ if ($this->scenario->running()) {
332
+ $result = $this->scenario->runStep();
333
+ return new Maybe($result);
334
+ }
335
+ return new Maybe();
336
+ }
337
+
338
+
339
+ /**
340
+ * This method is generated.
341
+ * Documentation taken from corresponding module.
342
+ * ----------------------------------------------
343
+ *
344
+ * Deletes a file
345
+ * @see Codeception\Module\Filesystem::deleteThisFile()
346
+ * @return \Codeception\Maybe
347
+ */
348
+ public function deleteThisFile() {
349
+ $this->scenario->addStep(new \Codeception\Step\Action('deleteThisFile', func_get_args()));
350
+ if ($this->scenario->running()) {
351
+ $result = $this->scenario->runStep();
352
+ return new Maybe($result);
353
+ }
354
+ return new Maybe();
355
+ }
356
+
357
+
358
+ /**
359
+ * This method is generated.
360
+ * Documentation taken from corresponding module.
361
+ * ----------------------------------------------
362
+ *
363
+ * Checks if file exists in path.
364
+ * Opens a file when it's exists
365
+ *
366
+ * ``` php
367
+ * <?php
368
+ * $I->seeFileFound('UserModel.php','app/models');
369
+ * ?>
370
+ * ```
371
+ *
372
+ * @param $filename
373
+ * @param string $path
374
+ * Conditional Assertion: Test won't be stopped on fail
375
+ * @see Codeception\Module\Filesystem::seeFileFound()
376
+ * @return \Codeception\Maybe
377
+ */
378
+ public function canSeeFileFound($filename, $path = null) {
379
+ $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args()));
380
+ if ($this->scenario->running()) {
381
+ $result = $this->scenario->runStep();
382
+ return new Maybe($result);
383
+ }
384
+ return new Maybe();
385
+ }
386
+ /**
387
+ * This method is generated.
388
+ * Documentation taken from corresponding module.
389
+ * ----------------------------------------------
390
+ *
391
+ * Checks if file exists in path.
392
+ * Opens a file when it's exists
393
+ *
394
+ * ``` php
395
+ * <?php
396
+ * $I->seeFileFound('UserModel.php','app/models');
397
+ * ?>
398
+ * ```
399
+ *
400
+ * @param $filename
401
+ * @param string $path
402
+ * @see Codeception\Module\Filesystem::seeFileFound()
403
+ * @return \Codeception\Maybe
404
+ */
405
+ public function seeFileFound($filename, $path = null) {
406
+ $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args()));
407
+ if ($this->scenario->running()) {
408
+ $result = $this->scenario->runStep();
409
+ return new Maybe($result);
410
+ }
411
+ return new Maybe();
412
+ }
413
+
414
+
415
+ /**
416
+ * This method is generated.
417
+ * Documentation taken from corresponding module.
418
+ * ----------------------------------------------
419
+ *
420
+ * Erases directory contents
421
+ *
422
+ * ``` php
423
+ * <?php
424
+ * $I->cleanDir('logs');
425
+ * ?>
426
+ * ```
427
+ *
428
+ * @param $dirname
429
+ * @see Codeception\Module\Filesystem::cleanDir()
430
+ * @return \Codeception\Maybe
431
+ */
432
+ public function cleanDir($dirname) {
433
+ $this->scenario->addStep(new \Codeception\Step\Action('cleanDir', func_get_args()));
434
+ if ($this->scenario->running()) {
435
+ $result = $this->scenario->runStep();
436
+ return new Maybe($result);
437
+ }
438
+ return new Maybe();
439
+ }
440
+
441
+
442
+ /**
443
+ * This method is generated.
444
+ * Documentation taken from corresponding module.
445
+ * ----------------------------------------------
446
+ *
447
+ *
448
+ * @see Codeception\Module::getName()
449
+ * @return \Codeception\Maybe
450
+ */
451
+ public function getName() {
452
+ $this->scenario->addStep(new \Codeception\Step\Action('getName', func_get_args()));
453
+ if ($this->scenario->running()) {
454
+ $result = $this->scenario->runStep();
455
+ return new Maybe($result);
456
+ }
457
+ return new Maybe();
458
+ }
459
+ }
460
+