Skip to content

Commit ee08315

Browse files
committed
Added option to delay tests execution after phiremock starts
1 parent 6578351 commit ee08315

File tree

10 files changed

+16
-2934
lines changed

10 files changed

+16
-2934
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,17 @@ extensions:
3636
bin_path: ../vendor/bin # defaults to codeception_dir/../vendor/bin
3737
logs_path: /var/log/my_app/tests/logs # defaults to codeception's tests output dir
3838
debug: true # defaults to false
39+
startDelay: 1 # default to 0
3940
```
4041
42+
## Parameters
43+
44+
* **listen:** Specifies the interface and port where phiremock must listen for requests
45+
* **bin_path:** Path where Phiremock "binary" is located
46+
* **logs_path:** Path where to write the output
47+
* **debug:** Where to write debug data to log files
48+
* **startDelay:** Time to wait after Phiremock was started to start running the tests (used to give time to Phiremock to boot)
49+
4150
### Module
4251
The module allows you to connect to a Phiremock server and to interact with it in a semantic way through the codeception actor in your tests.
4352

src/Extension/Phiremock.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class Phiremock extends CodeceptionExtension
2929

3030
protected $config = [
3131
'listen' => '0.0.0.0:8086',
32-
'debug' => false
32+
'debug' => false,
33+
'startDelay' => 0
3334
];
3435

3536
/**
@@ -66,6 +67,9 @@ public function __construct(
6667
$this->config['logs_path'],
6768
$this->config['debug']
6869
);
70+
if ($this->config['startDelay']) {
71+
sleep($this->config['startDelay']);
72+
}
6973
}
7074

7175
private function initProcess($process)

src/Extension/PhiremockProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PhiremockProcess
2727
*
2828
* @var string
2929
*/
30-
const LOG_FILE_NAME = 'phiremock.out';
30+
const LOG_FILE_NAME = 'phiremock.log';
3131

3232
/**
3333
* @var resource

tests/codeception.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ extensions:
1616
config:
1717
\Codeception\Extension\Phiremock:
1818
listen: 0.0.0.0:18080
19+
startDelay: 1
1920

tests/tests/_output/.gitignore

Whitespace-only changes.

tests/tests/_output/phiremock.out

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/tests/_support/_generated/.gitignore

Whitespace-only changes.

0 commit comments

Comments
 (0)