Skip to content

Commit d64c1aa

Browse files
committed
updated docs for guides
1 parent 16d306d commit d64c1aa

37 files changed

+2972
-3772
lines changed

_includes/extensions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extensions:
6868

6969
[See Source](https://github.com/Codeception/Codeception/blob/5.0/ext/Recorder.php)
7070

71-
Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](https://codeception.com/images/recorder.gif))
71+
Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](http://codeception.com/images/recorder.gif))
7272
Activated only for suites with WebDriver module enabled.
7373

7474
The screenshots are saved to `tests/_output/record_*` directories, open `index.html` to see them as a slideshow.

changelog.markdown

Lines changed: 313 additions & 311 deletions
Large diffs are not rendered by default.

docs/03-AcceptanceTests.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $I->click('LOGIN');
2929
$I->see('Welcome, Davert!');
3030
```
3131

32-
**This scenario can be performed either by PhpBrowser or by a "real" browser through WebDriver**.
32+
**This scenario can be performed either by PhpBrowser or by a real browser through WebDriver**.
3333

3434
| | PhpBrowser | WebDriver |
3535
| --- | --- | --- |
@@ -763,20 +763,6 @@ WebDriver module provides advanced methods for the browser session, however, the
763763

764764
Those methods can be used to create custom commands like `$I->startBrowser()` or used in [before/after](https://codeception.com/docs/06-ModulesAndHelpers#Hooks) hooks.
765765

766-
## Error Reporting
767-
768-
By default Codeception uses the `E_ALL & ~E_STRICT & ~E_DEPRECATED` error reporting level.
769-
In acceptance tests you might want to change this level depending on your framework's error policy.
770-
The error reporting level can be set in the suite configuration file:
771-
772-
```yaml
773-
actor: AcceptanceTester
774-
# ...
775-
error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED
776-
```
777-
778-
`error_level` can also be set globally in `codeception.yml` file. In order to do that, you need to specify `error_level` as a part of `settings`. For more information, see [Global Configuration](https://codeception.com/docs/reference/Configuration). Note that suite specific `error_level` value will override global value.
779-
780766
## Conclusion
781767

782768
Writing acceptance tests with Codeception and PhpBrowser is a good start.

docs/04-FunctionalTests.md

Lines changed: 45 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ to "send" requests to your app. So there's no real HTTP request made, but rather
1414
[Request object](https://github.com/symfony/browser-kit/blob/master/Request.php) with the required properties is
1515
passed to your framework's (front-)controller.
1616

17-
As a first step, you need to enable Codeception's module for your framework in `functional.suite.yml` (see below).
17+
As a first step, you need to enable Codeception's module for your framework in `Functional.suite.yml` (see below).
1818

1919
All of Codeception's framework modules share the same interface, and thus your tests are not bound to any one of them.
2020
This is a sample functional test:
2121

22-
{% highlight php %}
23-
22+
```php
2423
<?php
25-
// LoginCest.php
24+
25+
namespace Tests\Functional;
26+
27+
use \Tests\Support\FunctionalTester;
2628

2729
class LoginCest
2830
{
@@ -37,8 +39,7 @@ class LoginCest
3739
// $I->seeEmailIsSent(); // only for Symfony
3840
}
3941
}
40-
41-
{% endhighlight %}
42+
```
4243

4344
As you see, the syntax is the same for functional and acceptance tests.
4445

@@ -69,104 +70,81 @@ Keep your memory clean, avoid memory leaks and clean global and static variables
6970
## Enabling Framework Modules
7071

7172
You have a functional testing suite in the `tests/functional` directory.
72-
To start, you need to include one of the framework modules in the suite configuration file: `tests/functional.suite.yml`.
73+
To start, you need to include one of the framework modules in the suite configuration file: `tests/Functional.suite.yml`.
7374

7475
### Symfony
7576

7677
To perform Symfony integration you just need to include the Symfony module into your test suite. If you also use Doctrine2,
7778
don't forget to include it too. To make the Doctrine2 module connect using the `doctrine` service from Symfony,
7879
you should specify the Symfony module as a dependency for Doctrine2:
7980

80-
{% highlight yaml %}
81-
82-
# functional.suite.yml
81+
```yaml
82+
# Functional.suite.yml
8383

8484
actor: FunctionalTester
8585
modules:
8686
enabled:
8787
- Symfony
8888
- Doctrine2:
8989
depends: Symfony # connect to Symfony
90-
91-
{% endhighlight %}
90+
```
9291
9392
By default this module will search for AppKernel in the `app` directory.
9493

9594
The module uses the Symfony Profiler to provide additional information and assertions.
9695

9796
[See the full reference](https://codeception.com/docs/modules/Symfony)
9897

99-
### Laravel5
100-
101-
The [Laravel5](https://codeception.com/docs/modules/Laravel5) module is included and requires no configuration:
98+
### Laravel
10299

103-
{% highlight yaml %}
100+
The [Laravel](https://codeception.com/docs/modules/Laravel) module is included and requires no configuration:
104101

105-
# functional.suite.yml
102+
```yaml
103+
# Functional.suite.yml
106104
107105
actor: FunctionalTester
108106
modules:
109107
enabled:
110-
- Laravel5
111-
112-
{% endhighlight %}
108+
- Laravel
109+
```
113110

114111
### Yii2
115112

116113
Yii2 tests are included in [Basic](https://github.com/yiisoft/yii2-app-basic)
117114
and [Advanced](https://github.com/yiisoft/yii2-app-advanced) application templates. Follow the Yii2 guides to start.
118115

119-
### Zend Framework 2
116+
### Laminas
120117

121-
Use [the ZF2 module](https://codeception.com/docs/modules/ZF2) to run functional tests inside Zend Framework 2:
118+
[Laminas](https://codeception.com/docs/modules/Laminas) tests can be executed with enabling a corresponding module.
122119

123-
{% highlight yaml %}
124-
125-
# functional.suite.yml
120+
```yaml
121+
# Functional.suite.yml
126122
127123
actor: FunctionalTester
128124
modules:
129125
enabled:
130-
- ZF2
131-
132-
{% endhighlight %}
133-
134-
### Zend Expressive
135-
136-
[Zend Expressive](https://codeception.com/docs/modules/ZendExpressive) tests can be executed with enabling a corresponding module.
137-
138-
{% highlight yaml %}
139-
140-
# functional.suite.yml
141-
142-
actor: FunctionalTester
143-
modules:
144-
enabled:
145-
- ZendExpressive
146-
147-
{% endhighlight %}
126+
- Laminas
127+
```
148128

149129
> See module reference to more configuration options
150130

151-
### Phalcon 4
131+
### Phalcon 5
152132

153-
The `Phalcon4` module requires creating a bootstrap file which returns an instance of `\Phalcon\Mvc\Application`.
154-
To start writing functional tests with Phalcon support you should enable the `Phalcon4` module
133+
The `Phalcon5` module requires creating a bootstrap file which returns an instance of `\Phalcon\Mvc\Application`.
134+
To start writing functional tests with Phalcon support you should enable the `Phalcon5` module
155135
and provide the path to this bootstrap file:
156136

157-
{% highlight yaml %}
158-
159-
# functional.suite.yml
137+
```yaml
138+
# Functional.suite.yml
160139
161140
actor: FunctionalTester
162141
modules:
163142
enabled:
164-
- Phalcon4:
143+
- Phalcon5:
165144
bootstrap: 'app/config/bootstrap.php'
166145
cleanup: true
167146
savepoints: true
168-
169-
{% endhighlight %}
147+
```
170148

171149
[See the full reference](https://codeception.com/docs/modules/Phalcon4)
172150

@@ -178,53 +156,41 @@ and the same engine.
178156

179157
Therefore we can open a web page with `amOnPage` method:
180158

181-
{% highlight php %}
182-
183-
<?php
159+
```php
184160
$I->amOnPage('/login');
185-
186-
{% endhighlight %}
161+
```
187162

188163
We can click links to open web pages:
189164

190-
{% highlight php %}
191-
192-
<?php
165+
```php
193166
$I->click('Logout');
194167
// click link inside .nav element
195168
$I->click('Logout', '.nav');
196169
// click by CSS
197170
$I->click('a.logout');
198171
// click with strict locator
199172
$I->click(['class' => 'logout']);
200-
201-
{% endhighlight %}
173+
```
202174

203175
We can submit forms as well:
204176

205-
{% highlight php %}
206-
207-
<?php
177+
```php
208178
$I->submitForm('form#login', ['name' => 'john', 'password' => '123456']);
209179
// alternatively
210180
$I->fillField('#login input[name=name]', 'john');
211181
$I->fillField('#login input[name=password]', '123456');
212182
$I->click('Submit', '#login');
213-
214-
{% endhighlight %}
183+
```
215184

216185
And do assertions:
217186

218-
{% highlight php %}
219-
220-
<?php
187+
```php
221188
$I->see('Welcome, john');
222189
$I->see('Logged in successfully', '.notice');
223190
$I->seeCurrentUrlEquals('/profile/john');
191+
```
224192

225-
{% endhighlight %}
226-
227-
Framework modules also contain additional methods to access framework internals. For instance, Laravel5, Phalcon,
193+
Framework modules also contain additional methods to access framework internals. For instance, Laravel, Phalcon,
228194
and Yii2 modules have a `seeRecord` method which uses the ActiveRecord layer to check that a record exists in the database.
229195

230196
Take a look at the complete reference for the module you are using. Most of its methods are common to all modules
@@ -233,10 +199,10 @@ but some of them are unique.
233199
You can also access framework globals inside a test or access the dependency injection container
234200
inside the `Helper\Functional` class:
235201

236-
{% highlight php %}
237-
202+
```php
238203
<?php
239-
namespace Helper;
204+
205+
namespace Tests\Support\Helper;
240206
241207
class Functional extends \Codeception\Module
242208
{
@@ -246,8 +212,7 @@ class Functional extends \Codeception\Module
246212
$service->doSomething();
247213
}
248214
}
249-
250-
{% endhighlight %}
215+
```
251216

252217
Also check all available *Public Properties* of the used modules to get full access to their data.
253218

@@ -257,13 +222,11 @@ By default Codeception uses the `E_ALL & ~E_STRICT & ~E_DEPRECATED` error report
257222
In functional tests you might want to change this level depending on your framework's error policy.
258223
The error reporting level can be set in the suite configuration file:
259224

260-
{% highlight yaml %}
261-
225+
```yaml
262226
actor: FunctionalTester
263227
...
264228
error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED
265-
266-
{% endhighlight %}
229+
```
267230

268231
`error_level` can also be set globally in `codeception.yml` file. In order to do that, you need to specify `error_level` as a part of `settings`. For more information, see [Global Configuration](https://codeception.com/docs/reference/Configuration). Note that suite specific `error_level` value will override global value.
269232

0 commit comments

Comments
 (0)