Skip to content

Commit 00103f2

Browse files
committed
Merge branch 'master' of github.com:Codeception/codeception.github.com
2 parents 8e1750d + 346b294 commit 00103f2

32 files changed

Lines changed: 15390 additions & 0 deletions

docs1/modules/AMQP.markdown

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
layout: doc
3+
title: AMQP Module - Codeception - Documentation
4+
---
5+
6+
# AMQP Module
7+
**For additional reference, please review the [source](https://github.com/Codeception/Codeception/tree/master/src/Codeception/Module/AMQP.php)**
8+
9+
10+
This module interacts with message broker software that implements
11+
the Advanced Message Queuing Protocol (AMQP) standard. For example, RabbitMQ (tested).
12+
Use it to cleanup the queue between tests.
13+
14+
<div class="alert alert-info">
15+
To use this module with Composer you need <em>"videlalvaro/php-amqplib": "*"</em> package.
16+
</div>
17+
18+
### Status
19+
* Maintainer: **davert**, **tiger-seo**
20+
* Stability: **alpha**
21+
* Contact: codecept@davert.mail.ua
22+
* Contact: tiger.seo@gmail.com
23+
24+
*Please review the code of non-stable modules and provide patches if you have issues.*
25+
26+
### Config
27+
28+
* host: localhost - host to connect
29+
* username: guest - username to connect
30+
* password: guest - password to connect
31+
* vhost: '/' - vhost to connect
32+
* cleanup: true - defined queues will be purged before running every test.
33+
* queues: [mail, twitter] - queues to cleanup
34+
35+
#### Example
36+
37+
modules:
38+
enabled: [AMQP]
39+
config:
40+
AMQP:
41+
host: 'localhost'
42+
port: '5672'
43+
username: 'guest'
44+
password: 'guest'
45+
vhost: '/'
46+
queues: [queue1, queue2]
47+
48+
### Public Properties
49+
50+
* connection - AMQPConnection - current connection
51+
52+
* available since version 1.1.2
53+
* author tiger.seo@gmail.com
54+
* author davert
55+
56+
### Actions
57+
58+
59+
#### getName
60+
61+
__not documented__
62+
63+
64+
#### grabMessageFromQueue
65+
66+
67+
Takes last message from queue.
68+
69+
$message = $I->grabMessageFromQueue('queue.emails');
70+
71+
* param $queue
72+
* return AMQPMessage
73+
74+
75+
#### pushToExchange
76+
77+
78+
Sends message to exchange
79+
80+
{% highlight php %}
81+
82+
<?php
83+
$I->pushToExchange('exchange.emails', 'thanks');
84+
$I->pushToExchange('exchange.emails', new AMQPMessage('Thanks!'));
85+
?>
86+
87+
{% endhighlight %}
88+
89+
* param $exchange
90+
* param $message string|AMQPMessage
91+
92+
93+
#### pushToQueue
94+
95+
96+
Sends message to queue
97+
98+
{% highlight php %}
99+
100+
<?php
101+
$I->pushToQueue('queue.jobs', 'create user');
102+
$I->pushToQueue('queue.jobs', new AMQPMessage('create'));
103+
?>
104+
105+
{% endhighlight %}
106+
107+
* param $queue
108+
* param $message string|AMQPMessage
109+
110+
111+
#### seeMessageInQueueContainsText
112+
113+
114+
Checks if message containing text received.
115+
116+
**This method drops message from queue**
117+
**This method will wait for message. If none is sent the script will stuck**.
118+
119+
{% highlight php %}
120+
121+
<?php
122+
$I->pushToQueue('queue.emails', 'Hello, davert');
123+
$I->seeMessageInQueueContainsText('queue.emails','davert');
124+
?>
125+
126+
{% endhighlight %}
127+
128+
* param $queue
129+
* param $text

docs1/modules/Cli.markdown

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
layout: doc
3+
title: Cli Module - Codeception - Documentation
4+
---
5+
6+
# Cli Module
7+
**For additional reference, please review the [source](https://github.com/Codeception/Codeception/tree/master/src/Codeception/Module/Cli.php)**
8+
9+
10+
Wrapper for basic shell commands and shell output
11+
12+
### Responsibility
13+
* Maintainer: **davert**
14+
* Status: **stable**
15+
* Contact: codecept@davert.mail.ua
16+
17+
*Please review the code of non-stable modules and provide patches if you have issues.*
18+
19+
### Actions
20+
21+
22+
#### dontSeeInShellOutput
23+
24+
25+
Checks that output from latest command doesn't contain text
26+
27+
* param $text
28+
29+
30+
31+
#### getName
32+
33+
__not documented__
34+
35+
36+
#### runShellCommand
37+
38+
39+
Executes a shell command
40+
41+
* param $command
42+
43+
44+
#### seeInShellOutput
45+
46+
47+
Checks that output from last executed command contains text
48+
49+
* param $text
50+
51+
52+
#### seeShellOutputMatches
53+
54+
__not documented__

docs1/modules/Db.markdown

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
---
2+
layout: doc
3+
title: Db Module - Codeception - Documentation
4+
---
5+
6+
# Db Module
7+
**For additional reference, please review the [source](https://github.com/Codeception/Codeception/tree/master/src/Codeception/Module/Db.php)**
8+
9+
10+
Works with SQL database.
11+
12+
The most important function of this module is cleaning database before each test.
13+
That's why this module was added into global configuration file: codeception.yml.
14+
To have your database properly cleaned you should configure it to access the database.
15+
Also provides actions to perform checks in database.
16+
17+
In order to have your database populated with data you need a raw SQL dump.
18+
Just put it in {% highlight yaml %}
19+
tests/_data
20+
{% endhighlight %} dir (by default) and specify path to it in config.
21+
Next time after database is cleared all your data will be restored from dump.
22+
Don't forget to include CREATE TABLE statements into it.
23+
24+
Supported and tested databases are:
25+
26+
* MySQL
27+
* SQLite (only file)
28+
* PostgreSQL
29+
30+
Supported but not tested.
31+
32+
* MSSQL
33+
* Oracle
34+
35+
Connection is done by database Drivers, which are stored in Codeception\Util\Driver namespace.
36+
Check out drivers if you get problems loading dumps and cleaning databases.
37+
38+
### Status
39+
40+
* Maintainer: **davert**
41+
* stability:
42+
- Mysql: **stable**
43+
- SQLite: **stable**
44+
- Postgres: **beta**
45+
- MSSQL: **alpha**
46+
- Oracle: **alpha**
47+
* Contact: codecept@davert.mail.ua
48+
49+
*Please review the code of non-stable modules and provide patches if you have issues.*
50+
51+
### Config
52+
53+
* dsn *required* - PDO DSN
54+
* user *required* - user to access database
55+
* password *required* - password
56+
* dump - path to database dump.
57+
* populate: true - should the dump be loaded before test suite is started.
58+
* cleanup: true - should the dump be reloaded after each test
59+
60+
#### Example
61+
62+
modules:
63+
enabled: [Db]
64+
config:
65+
Db:
66+
dsn: 'mysql:host=localhost;dbname=testdb'
67+
user: 'root'
68+
password: ''
69+
dump: 'tests/_data/dump.sql'
70+
populate: true
71+
cleanup: false
72+
73+
### Public Properties
74+
* dbh - contains PDO connection.
75+
* driver - contains Connection Driver. See [list all available drivers](https://github.com/Codeception/Codeception/tree/master/src/Codeception/Util/Driver)
76+
77+
78+
### Actions
79+
80+
81+
#### dontSeeInDatabase
82+
83+
84+
Effect is opposite to ->seeInDatabase
85+
86+
Checks if there is no record with such column values in database.
87+
Provide table name and column values.
88+
89+
Example:
90+
91+
{% highlight php %}
92+
93+
<?php
94+
$I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
95+
96+
97+
{% endhighlight %}
98+
Will generate:
99+
100+
{% highlight yaml %}
101+
sql
102+
SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
103+
104+
{% endhighlight %}
105+
Fails if such user was found.
106+
107+
* param $table
108+
* param array $criteria
109+
110+
111+
#### getName
112+
113+
__not documented__
114+
115+
116+
#### grabFromDatabase
117+
118+
119+
Fetches a single column value from a database.
120+
Provide table name, desired column and criteria.
121+
122+
Example:
123+
124+
{% highlight php %}
125+
126+
<?php
127+
$mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
128+
129+
130+
{% endhighlight %}
131+
132+
* version 1.1
133+
* param $table
134+
* param $column
135+
* param array $criteria
136+
* return mixed
137+
138+
139+
#### haveInDatabase
140+
141+
142+
Inserts SQL record into database. This record will be erased after the test.
143+
144+
{% highlight php %}
145+
146+
<?php
147+
$I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com'));
148+
?>
149+
150+
{% endhighlight %}
151+
152+
* param $table
153+
* param array $data
154+
* return integer $id
155+
156+
157+
#### seeInDatabase
158+
159+
160+
Checks if a row with given column values exists.
161+
Provide table name and column values.
162+
163+
Example:
164+
165+
{% highlight php %}
166+
167+
<?php
168+
$I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
169+
170+
171+
{% endhighlight %}
172+
Will generate:
173+
174+
{% highlight yaml %}
175+
sql
176+
SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
177+
178+
{% endhighlight %}
179+
Fails if no such user found.
180+
181+
* param $table
182+
* param array $criteria

0 commit comments

Comments
 (0)