Skip to content

Commit 5562241

Browse files
committed
auto updated documentation
1 parent 1c8d6ad commit 5562241

23 files changed

+1778
-79
lines changed

_includes/reference.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<li><a href="/docs/reference/Autoload">Autoload</a></li><li><a href="/docs/reference/Commands">Commands</a></li><li><a href="/docs/reference/Configuration">Configuration</a></li><li><a href="/docs/reference/Fixtures">Fixtures</a></li><li><a href="/docs/reference/Functions">Functions</a></li><li><a href="/docs/reference/Locator">Locator</a></li><li><a href="/docs/reference/Stub">Stub</a></li><li><a href="/docs/reference/XmlBuilder">XmlBuilder</a></li>
1+
<li><a href="/docs/reference/Autoload">Autoload</a></li><li><a href="/docs/reference/Commands">Commands</a></li><li><a href="/docs/reference/Configuration">Configuration</a></li><li><a href="/docs/reference/Fixtures">Fixtures</a></li><li><a href="/docs/reference/Functions">Functions</a></li><li><a href="/docs/reference/JsonType">JsonType</a></li><li><a href="/docs/reference/Locator">Locator</a></li><li><a href="/docs/reference/Stub">Stub</a></li><li><a href="/docs/reference/XmlBuilder">XmlBuilder</a></li>

changelog.markdown

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@ title: Codeception Changelog
77

88
# Changelog
99

10+
#### 2.1.3
11+
12+
* <strong>[REST]</strong> **Added matching data types** by with new methods <strong>[seeResponseMatchesJsonType]</strong>(http://codeception.com/docs/modules/REST#seeResponseMatchesJsonType) and `dontSeeResponseMatchesJsonType`. See <a href="https://github.com/Codeception/Codeception/issues/2391">#2391</a>
13+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> added `_request` and `_loadPage` hidden API methods for performing arbitrary requests.
14+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> Fixed `seeInField`, `dontSeeInField` for disabled fields <a href="https://github.com/Codeception/Codeception/issues/2378">#2378</a>. See <a href="https://github.com/Codeception/Codeception/issues/2414">#2414</a>.
15+
* Environment files can now be located in subfolders of `tests/_env` by <strong><a href="https://github.com/Zifius">@Zifius</a></strong>
16+
* <strong>[Symfony2]</strong> Fixed issue when accessing profiler when no request has been performed <a href="https://github.com/Codeception/Codeception/issues/652">#652</a>.
17+
* <strong>[Symfony2]</strong> Added `amOnRoute` and `seeCurrentRouteIs` methods by <strong><a href="https://github.com/raistlin">@raistlin</a></strong>
18+
* <strong>[ZF2]</strong> Added `amOnRoute` and `seeCurrentRouteIs` methods module, by <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
19+
* Fixed issue with trailing slashes in `seeCurrentUrlEquals` and `dontSeeCurrentUrlEquals` methods <a href="https://github.com/Codeception/Codeception/issues/2324">#2324</a>. By <strong><a href="https://github.com/janhenkgerritsen">@janhenkgerritsen</a></strong>
20+
* Warning is displayed once using unconfigured environment.
21+
* Fixed loading environment configurations for Cept files by <strong><a href="https://github.com/splinter89">@splinter89</a></strong>
22+
* Fixed bootstrap with namespaces to inject namespaced actor classes properly.
23+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> added hidden `_request()` method to send requests to backend from Helper classes.
24+
* <strong>[Laravel5]</strong> Added `disableEvents()`, `enableEvents()` and `expectEvents()` methods. By <strong><a href="https://github.com/janhenkgerritsen">@janhenkgerritsen</a></strong>
25+
* <strong>[Laravel5]</strong> Added `dontSeeFormErrors()` method. By <strong><a href="https://github.com/janhenkgerritsen">@janhenkgerritsen</a></strong>
26+
* <strong>[Db]</strong> Deleted Oracle driver (it existed by mistake, the real driver is Oci). By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
27+
* <strong>[Db]</strong> Implemented getPrimaryKey method for Sqlite, Mysql, Postgresql, Oracle and MsSql. By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
28+
* <strong>[Db]</strong> Implemented support for composite primary keys and tables without primary keys. By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
29+
* Fixed the scalarizeArray to be aware of NULL fields <a href="https://github.com/Codeception/Codeception/issues/2264">#2264</a>. By <strong><a href="https://github.com/fbidu">@fbidu</a></strong>
30+
* <strong>[Soap]</strong> Fixed SOAP module <a href="https://github.com/Codeception/Codeception/issues/2296">#2296</a>. By <strong><a href="https://github.com/relaxart">@relaxart</a></strong>
31+
* Fixed a bug where blank lines in a groups file would run every test in the project <a href="https://github.com/Codeception/Codeception/issues/2297">#2297</a>. By <strong><a href="https://github.com/imjoehaines">@imjoehaines</a></strong>
32+
* <strong>[WebDriver]</strong> seeNumberOfElements should only count visible elements <a href="https://github.com/Codeception/Codeception/issues/2303">#2303</a>. By <strong><a href="https://github.com/sascha">@sascha</a></strong>-egerer
33+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> Verbose output for all HTTP requests. By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
34+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> Throw `Codeception\Exception\ExternalUrlException` when framework module tries to open an external URL <a href="https://github.com/Codeception/Codeception/issues/2328">#2328</a>. By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
35+
* <strong>[PhpBrowser]</strong><strong>[Frameworks]</strong> Added `switchToIframe` method. By <strong><a href="https://github.com/Naktibalda">@Naktibalda</a></strong>
36+
* <strong>[Dbh]</strong> module deprecated
37+
1038
#### 2.1.2
1139

1240
* **Updated to PHPUnit 4.8**

docs/02-GettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Each suite has its own bootstrap file. It's located in the suite directory and i
155155

156156
## Cept, Cest and Test Formats
157157

158-
Codeception supports three test formats. Beside the previously described scenario-based Cept format, Codeception can also execute [PHPUnit test files for unit testing](http://codeception.com/docs/06-UnitTests), and Cest format.
158+
Codeception supports three test formats. Beside the previously described scenario-based Cept format, Codeception can also execute [PHPUnit test files for unit testing](http://codeception.com/docs/05-UnitTests), and Cest format.
159159

160160
Cest combines scenario-driven test approach with OOP design. In case you want to group a few testing scenarios into one you should consider using Cest format. In the example below we are testing CRUD actions within a single file but with a several test (one per each operation):
161161

docs/06-ReusingTestCode.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class Login
288288
*/
289289
protected $tester;
290290
291-
public function __construct(AcceptanceTester $I)
291+
public function __construct(\AcceptanceTester $I)
292292
{
293293
$this->tester = $I;
294294
}
@@ -343,7 +343,7 @@ class UserCest
343343

344344
{% endhighlight %}
345345

346-
The dependency nijection container can construct any object that require any known class type. For instance, `Page\Login` required `AcceptanceTester`, and so it was injected into `Page\Login` constructor, and PageObject was created and passed into method arguments. You should specify explicitly the types of requried objects for Codeception to know what objects should be created for a test. Dependency Injection will be described in the next chapter.
346+
The dependency injection container can construct any object that require any known class type. For instance, `Page\Login` required `AcceptanceTester`, and so it was injected into `Page\Login` constructor, and PageObject was created and passed into method arguments. You should specify explicitly the types of requried objects for Codeception to know what objects should be created for a test. Dependency Injection will be described in the next chapter.
347347

348348
## Modules and Helpers
349349

@@ -481,7 +481,7 @@ function seeNumResults($num)
481481
/**@var $table \Facebook\WebDriver\WebDriverElement */
482482
$table = $this->getModule('WebDriver')->_findElements('#result');
483483
$this->assertEquals('table', $table->getTagName());
484-
$results = $el->findElements('tr');
484+
$results = $table->findElements('tr');
485485

486486
// asserting that table contains exactly $num rows
487487
$this->assertEquals($num, count($results));
@@ -713,5 +713,6 @@ There are lots of ways to create reusable and readable tests. Group common actio
713713

714714

715715

716+
716717
* **Next Chapter: [AdvancedUsage >](/docs/07-AdvancedUsage)**
717718
* **Previous Chapter: [< UnitTests](/docs/05-UnitTests)**

docs/07-AdvancedUsage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class ModeratorCest {
221221

222222
{% endhighlight %}
223223

224-
You can also use `@before` and `@after` for included functions. But you can't have multiple annotations of the same kind for single method - one method can have only one `@before` and only one `@after` annotation.
224+
You can also use `@before` and `@after` for included functions. But you can't have multiple annotations of the same kind for single method - one method can have only one `@before` and only one `@after` annotation of the same kind.
225225

226226
## Environments
227227

docs/10-WebServices.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ title: Testing WebServices - Codeception - Documentation
55

66
# Testing WebServices
77

8-
The same way we tested a web site, Codeception allows you to test web services. They are very hard to test manually, so it's really good idea to automate web service testing. As a standards we have SOAP and REST, which are represented in corresponding modules. We will cover them in this chapter.
8+
The same way we tested a web site, Codeception allows you to test web services. They are very hard to test manually, so it's a really good idea to automate web service testing. We have SOAP and REST as standards, which are represented in corresponding modules, which we will cover in this chapter.
99

10-
You should start with creating a new test suite, which was not provided by the `bootstrap` command. We recommend to call it **api** and use the `ApiTester` class for it.
10+
You should start by creating a new test suite, (which was not provided by the `bootstrap` command). We recommend calling it **api** and using the `ApiTester` class for it.
1111

1212
{% highlight bash %}
1313

@@ -19,7 +19,7 @@ We will put all the api tests there.
1919

2020
## REST
2121

22-
The REST web service is accessed via HTTP with standard methods: `GET`, `POST`, `PUT`, `DELETE`. They allow to receive and manipulate entities from the service. Accessing WebService requires HTTP client, so for using it you need the module `PhpBrowser` or one of framework modules set up. For example, we can use the `Symfony2` module for Symfony2 applications in order to ignore web server and test web service internally.
22+
The REST web service is accessed via HTTP with standard methods: `GET`, `POST`, `PUT`, `DELETE`. They allow users to receive and manipulate entities from the service. Accessing a WebService requires an HTTP client, so for using it you need the module `PhpBrowser` or one of framework modules set up. For example, we can use the `Symfony2` module for Symfony2 applications in order to ignore web server and test web service internally.
2323

2424
Configure modules in `api.suite.yml`:
2525

@@ -34,7 +34,7 @@ modules:
3434

3535
{% endhighlight %}
3636

37-
The REST module will connect to `PhpBrowser` according to this configuration. Depending on web service we may deal with XML or JSON responses. Codeception handles both data formats well, however If you don't need one of them, you can explicitly specify that the JSON or XML parts of the module will be used:
37+
The REST module will connect to `PhpBrowser` according to this configuration. Depending on the web service we may deal with XML or JSON responses. Codeception handles both data formats well, however If you don't need one of them, you can explicitly specify that the JSON or XML parts of the module will be used:
3838

3939
{% highlight yaml %}
4040

@@ -62,15 +62,15 @@ modules:
6262

6363
{% endhighlight %}
6464

65-
Once we configured new testing suite, we can create the first sample test:
65+
Once we have configured our new testing suite, we can create the first sample test:
6666

6767
{% highlight bash %}
6868

6969
$ php codecept.phar generate:cept api CreateUser
7070

7171
{% endhighlight %}
7272

73-
It will be called `CreateUserCept.php`. We can use it to test creation of a user via the REST API.
73+
It will be called `CreateUserCept.php`. We can use it to test the creation of a user via the REST API.
7474

7575
{% highlight php %}
7676

@@ -89,7 +89,7 @@ $I->seeResponseContains('{"result":"ok"}');
8989

9090
### Testing JSON Responses
9191

92-
The latest line checked that the response contained the provided string. However we shouldn't rely on it, as depending on content formatting we can receive different results with the same data. What we actually need is to check that the response can be parsed and it contains some of the values we expect. In the case of JSON we can use `seeResponseContainsJson` method
92+
The last line of the previous example verified that the response contained the provided string. However we shouldn't rely on it, as depending on content formatting we can receive different results with the same data. What we actually need is to check that the response can be parsed and it contains some of the values we expect. In the case of JSON we can use the `seeResponseContainsJson` method
9393

9494
{% highlight php %}
9595

@@ -108,7 +108,7 @@ $I->seeResponseContainsJson([
108108

109109
{% endhighlight %}
110110

111-
You may want to perform even more complex assertions on a response. This can be done by writing your own methods in [Helper](http://codeception.com/docs/03-ModulesAndHelpers#Helpers) classes. To access the latest JSON response you will need to get the `response` property of the `REST` module. Let's demonstrate it with `seeResponseIsHtml` method:
111+
You may want to perform even more complex assertions on a response. This can be done by writing your own methods in the [Helper](http://codeception.com/docs/03-ModulesAndHelpers#Helpers) classes. To access the latest JSON response you will need to get the `response` property of the `REST` module. Let's demonstrate it with the `seeResponseIsHtml` method:
112112

113113
{% highlight php %}
114114

docs/modules/Db.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ $I->seeNumRecords(1, 'users', ['name' => 'davert'])
205205

206206
{% endhighlight %}
207207

208-
* `param int` $num Expected number
208+
* `param int` $expectedNumber Expected number
209209
* `param string` $table Table name
210210
* `param array` $criteria Search criteria [Optional]
211211

docs/modules/Laravel4.md

Lines changed: 110 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: doc
3-
title: Codeception - Documentation
3+
title: switch to iframe - Codeception - Documentation
44
---
55

66

@@ -81,6 +81,66 @@ PhpBrowser and Framework modules return `Symfony\Component\DomCrawler\Crawler` i
8181
* `return` array of interactive elements
8282

8383

84+
#### _loadPage
85+
86+
*hidden API method, expected to be used from Helper classes*
87+
88+
Opens a page with arbitrary request parameters.
89+
Useful for testing multi-step forms on a specific step.
90+
91+
{% highlight php %}
92+
93+
<?php
94+
// in Helper class
95+
public function openCheckoutFormStep2($orderId) {
96+
$this->getModule('Laravel4')->_loadPage('POST', '/checkout/step2', ['order' => $orderId]);
97+
}
98+
?>
99+
100+
{% endhighlight %}
101+
102+
* `param` $method
103+
* `param` $uri
104+
* `param array` $parameters
105+
* `param array` $files
106+
* `param array` $server
107+
* `param null` $content
108+
109+
110+
#### _request
111+
112+
*hidden API method, expected to be used from Helper classes*
113+
114+
Send custom request to a backend using method, uri, parameters, etc.
115+
Use it in Helpers to create special request actions, like accessing API
116+
Returns a string with response body.
117+
118+
{% highlight php %}
119+
120+
<?php
121+
// in Helper class
122+
public function createUserByApi($name) {
123+
$userData = $this->getModule('Laravel4')->_request('POST', '/api/v1/users', ['name' => $name]);
124+
$user = json_decode($userData);
125+
return $user->id;
126+
}
127+
?>
128+
129+
{% endhighlight %}
130+
Does not load the response into the module so you can't interact with response page (click, fill forms).
131+
To load arbitrary page for interaction, use `_loadPage` method.
132+
133+
* `param` $method
134+
* `param` $uri
135+
* `param array` $parameters
136+
* `param array` $files
137+
* `param array` $server
138+
* `param null` $content
139+
@return mixed|Crawler
140+
@throws ExternalUrlException
141+
@see `_loadPage`
142+
143+
84144
#### _savePageSource
85145

86146
*hidden API method, expected to be used from Helper classes*
@@ -571,7 +631,33 @@ $uri = $I->grabFromCurrentUrl();
571631

572632

573633
#### grabMultiple
574-
__not documented__
634+
635+
Grabs either the text content, or attribute values, of nodes
636+
matched by $cssOrXpath and returns them as an array.
637+
638+
{% highlight html %}
639+
640+
<a href="#first">First</a>
641+
<a href="#second">Second</a>
642+
<a href="#third">Third</a>
643+
644+
{% endhighlight %}
645+
646+
{% highlight php %}
647+
648+
<?php
649+
// would return ['First', 'Second', 'Third']
650+
$aLinkText = $I->grabMultiple('a');
651+
652+
// would return ['#first', '#second', '#third']
653+
$aLinks = $I->grabMultiple('a', 'href');
654+
?>
655+
656+
{% endhighlight %}
657+
658+
* `param` $cssOrXpath
659+
* `param` $attribute
660+
* `return` string[]
575661

576662

577663
#### grabRecord
@@ -1459,6 +1545,28 @@ $I->submitForm('#my-form', [
14591545
* `param` $button
14601546

14611547

1548+
#### switchToIframe
1549+
1550+
Switch to iframe or frame on the page.
1551+
1552+
Example:
1553+
{% highlight html %}
1554+
1555+
<iframe name="another_frame" src="http://example.com">
1556+
1557+
{% endhighlight %}
1558+
1559+
{% highlight php %}
1560+
1561+
<?php
1562+
# switch to iframe
1563+
$I->switchToIframe("another_frame");
1564+
1565+
{% endhighlight %}
1566+
1567+
* `param string` $name
1568+
1569+
14621570
#### uncheckOption
14631571
14641572
Unticks a checkbox.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy