@@ -237,7 +237,8 @@ It's supposed to use the dbh connection value from the Db module. |
237 | 237 |
|
238 | 238 | <?php |
239 | 239 |
|
240 | | -function reconnectToDatabase() { |
| 240 | +function reconnectToDatabase() |
| 241 | +{ |
241 | 242 | $dbh = $this->getModule('Db')->dbh; |
242 | 243 | $dbh->close(); |
243 | 244 | $dbh->open(); |
@@ -285,7 +286,8 @@ If accessing modules doesn't provide enough flexibility, you can extend a module |
285 | 286 | <?php |
286 | 287 | namespace Helper; |
287 | 288 |
|
288 | | -class MyExtendedSelenium extends \Codeception\Module\WebDriver { |
| 289 | +class MyExtendedSelenium extends \Codeception\Module\WebDriver |
| 290 | +{ |
289 | 291 | } |
290 | 292 |
|
291 | 293 | {% endhighlight %} |
@@ -307,45 +309,45 @@ All hooks are defined in [Codeception\Module](http://codeception.com/docs/refere |
307 | 309 |
|
308 | 310 | <?php |
309 | 311 |
|
310 | | - // HOOK: used after configuration is loaded |
311 | | - public function _initialize() |
312 | | - { |
313 | | - } |
314 | | -
|
315 | | - // HOOK: before each suite |
316 | | - public function _beforeSuite($settings = array()) |
317 | | - { |
318 | | - } |
319 | | -
|
320 | | - // HOOK: after suite |
321 | | - public function _afterSuite() |
322 | | - { |
323 | | - } |
324 | | -
|
325 | | - // HOOK: before each step |
326 | | - public function _beforeStep(\Codeception\Step $step) |
327 | | - { |
328 | | - } |
329 | | -
|
330 | | - // HOOK: after each step |
331 | | - public function _afterStep(\Codeception\Step $step) |
332 | | - { |
333 | | - } |
334 | | -
|
335 | | - // HOOK: before test |
336 | | - public function _before(\Codeception\TestInterface $test) |
337 | | - { |
338 | | - } |
339 | | -
|
340 | | - // HOOK: after test |
341 | | - public function _after(\Codeception\TestInterface $test) |
342 | | - { |
343 | | - } |
344 | | -
|
345 | | - // HOOK: on fail |
346 | | - public function _failed(\Codeception\TestInterface $test, $fail) |
347 | | - { |
348 | | - } |
| 312 | +// HOOK: used after configuration is loaded |
| 313 | +public function _initialize() |
| 314 | +{ |
| 315 | +} |
| 316 | +
|
| 317 | +// HOOK: before each suite |
| 318 | +public function _beforeSuite($settings = array()) |
| 319 | +{ |
| 320 | +} |
| 321 | +
|
| 322 | +// HOOK: after suite |
| 323 | +public function _afterSuite() |
| 324 | +{ |
| 325 | +} |
| 326 | +
|
| 327 | +// HOOK: before each step |
| 328 | +public function _beforeStep(\Codeception\Step $step) |
| 329 | +{ |
| 330 | +} |
| 331 | +
|
| 332 | +// HOOK: after each step |
| 333 | +public function _afterStep(\Codeception\Step $step) |
| 334 | +{ |
| 335 | +} |
| 336 | +
|
| 337 | +// HOOK: before test |
| 338 | +public function _before(\Codeception\TestInterface $test) |
| 339 | +{ |
| 340 | +} |
| 341 | +
|
| 342 | +// HOOK: after test |
| 343 | +public function _after(\Codeception\TestInterface $test) |
| 344 | +{ |
| 345 | +} |
| 346 | +
|
| 347 | +// HOOK: on fail |
| 348 | +public function _failed(\Codeception\TestInterface $test, $fail) |
| 349 | +{ |
| 350 | +} |
349 | 351 |
|
350 | 352 | {% endhighlight %} |
351 | 353 |
|
@@ -368,9 +370,9 @@ Here is an example of how it works for PhpBrowser: |
368 | 370 | {% highlight php %} |
369 | 371 |
|
370 | 372 | <?php |
371 | | - $this->debugSection('Request', $params); |
372 | | - $this->client->request($method, $uri, $params); |
373 | | - $this->debug('Response Code: ' . $this->client->getStatusCode()); |
| 373 | +$this->debugSection('Request', $params); |
| 374 | +$this->client->request($method, $uri, $params); |
| 375 | +$this->debug('Response Code: ' . $this->client->getStatusCode()); |
374 | 376 |
|
375 | 377 | {% endhighlight %} |
376 | 378 |
|
@@ -492,19 +494,19 @@ and `SAUCE_KEY` variables from environment, and now we are passing their values |
492 | 494 |
|
493 | 495 | {% highlight yaml %} |
494 | 496 |
|
495 | | - modules: |
496 | | - enabled: |
497 | | - - WebDriver: |
498 | | - url: http://mysite.com |
499 | | - host: '%SAUCE_USER%:%SAUCE_KEY%@ondemand.saucelabs.com' |
| 497 | +modules: |
| 498 | + enabled: |
| 499 | + - WebDriver: |
| 500 | + url: http://mysite.com |
| 501 | + host: '%SAUCE_USER%:%SAUCE_KEY%@ondemand.saucelabs.com' |
500 | 502 |
|
501 | 503 | {% endhighlight %} |
502 | 504 |
|
503 | 505 | Parameters are also useful to provide connection credentials for the `Db` module (taken from Laravel's .env files): |
504 | 506 |
|
505 | 507 | {% highlight yaml %} |
506 | 508 |
|
507 | | -module: |
| 509 | +modules: |
508 | 510 | enabled: |
509 | 511 | - Db: |
510 | 512 | dsn: "mysql:host=%DB_HOST%;dbname=%DB_DATABASE%" |
@@ -588,4 +590,4 @@ Helpers also can be used to extend the functionality of the original modules. |
588 | 590 |
|
589 | 591 |
|
590 | 592 | * **Next Chapter: [ReusingTestCode >](/docs/06-ReusingTestCode)** |
591 | | -* **Previous Chapter: [< UnitTests](/docs/05-UnitTests)** |
| 593 | +* **Previous Chapter: [< UnitTests](/docs/05-UnitTests)** |