Skip to content

Commit a2e4207

Browse files
committed
Add tests
1 parent ad5cb72 commit a2e4207

File tree

12 files changed

+1435
-632
lines changed

12 files changed

+1435
-632
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [7.3]
11+
php: [7.2, 7.3, 7.4]
1212

1313
steps:
1414
- uses: actions/checkout@v1
@@ -22,5 +22,8 @@ jobs:
2222
- name: Install dependencies
2323
run: composer install --prefer-dist --no-progress --no-suggest
2424

25+
- name: Run test server
26+
run: composer test-server
27+
2528
- name: Run test suite
2629
run: composer test

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Opposite to seeEmail.
8888

8989
```php
9090
$I->dontSeeEmail([
91-
'inbox' => 'john@example.org'
91+
'inbox' => 'john@example.org',
9292
'since' => 'PT2M',
9393
], 30);
9494
```
@@ -103,7 +103,7 @@ Waits up to $timeout seconds for the given email to be received.
103103

104104
```php
105105
$I->grabLinksInLastEmail([
106-
'inbox' => 'john@example.org'
106+
'inbox' => 'john@example.org',
107107
'since' => 'PT2M',
108108
], 30);
109109
```
@@ -119,13 +119,14 @@ In the last email, grabs all the text corresponding to a regex.
119119
Waits up to $timeout seconds for the given email to be received.
120120

121121
```php
122-
$I->grabTextInLastEmail($regex, [
123-
'inbox' => 'john@example.org'
124-
'subject' => 'Your credentials'
122+
$I->grabTextInLastEmail('#Password: (?<password>\S+)#', [
123+
'inbox' => 'john@example.org',
124+
'subject' => 'Your credentials',
125125
'since' => 'PT2M',
126126
], 30);
127127
```
128128

129+
* `param string` $regex
129130
* `param array` $criterias
130131
* `param int` $timeoutInSeconds (optional)
131132
* `return array` matches from preg_match_all

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^7.2"
15+
"php": "^7.2",
16+
"codeception/codeception": "^4.0"
1617
},
1718
"require-dev": {
1819
"friendsofphp/php-cs-fixer": "^2.16",
20+
"codeception/util-universalframework": "^1.0",
1921
"phpunit/phpunit": "^8.0"
2022
},
2123
"autoload": {
@@ -24,6 +26,12 @@
2426
}
2527
},
2628
"scripts": {
29+
"format": [
30+
"./vendor/bin/php-cs-fixer fix ."
31+
],
32+
"test-server": [
33+
"nohup php -S localhost:8000 -t tests/test-server &> /dev/null &"
34+
],
2735
"test": [
2836
"vendor/bin/phpunit tests"
2937
]

0 commit comments

Comments
 (0)