Skip to content

Commit

Permalink
Merge pull request #57 from tiger-seo/master
Browse files Browse the repository at this point in the history
sync with upstream project
  • Loading branch information
DavertMik committed Aug 28, 2012
2 parents 638cb40 + ada06ea commit 1310ac1
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 87 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: php

php:
php:
- 5.3
- 5.4

branches:
only:
- master
- develop
except:
- gh-pages

before_script:
- export DISPLAY=:99.0
Expand Down
11 changes: 11 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,14 @@ modules:
user: ''
password: ''
dump: tests/data/dump.sql
AMQP:
host: 'localhost'
port: '5672'
username: 'guest'
password: 'guest'
vhost: '/'
routes:
- exchange: Exchange1
queue: Queue1
- exchange: Exchange1
queue: Queue2
134 changes: 67 additions & 67 deletions docs/modules/PhpBrowser.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ Link text or css selector can be passed.
### dontSee


Check if current page doesn't contain the text specified.
Specify the css selector to match only specific region.
Check if current page doesn't contain the text specified.
Specify the css selector to match only specific region.

Examples:
Examples:

```php
<?php
$I->dontSee('Login'); // I can suppose user is already logged in
$I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
```php
<?php
$I->dontSee('Login'); // I can suppose user is already logged in
$I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page

```
```

* param $text
* param null $selector
* param $text
* param null $selector


### dontSeeCheckboxIsChecked
Expand Down Expand Up @@ -180,20 +180,20 @@ Reloads current page
### see


Check if current page contains the text specified.
Specify the css selector to match only specific region.
Check if current page contains the text specified.
Specify the css selector to match only specific region.

Examples:
Examples:

``` php
<?php
$I->see('Logout'); // I can suppose user is logged in
$I->see('Sign Up','h1'); // I can suppose it's a signup page
``` php
<?php
$I->see('Logout'); // I can suppose user is logged in
$I->see('Sign Up','h1'); // I can suppose it's a signup page

```
```

* param $text
* param null $selector
* param $text
* param null $selector


### seeCheckboxIsChecked
Expand Down Expand Up @@ -247,79 +247,79 @@ Either values or text of options can be used to fetch option.
### sendAjaxGetRequest


If your page triggers an ajax request, you can perform it manually.
This action sends a GET ajax request with specified params.
If your page triggers an ajax request, you can perform it manually.
This action sends a GET ajax request with specified params.

See ->sendAjaxPostRequest for examples.
See ->sendAjaxPostRequest for examples.

* param $uri
* param $params
* param $uri
* param $params


### sendAjaxPostRequest


If your page triggers an ajax request, you can perform it manually.
This action sends a POST ajax request with specified params.
Additional params can be passed as array.
If your page triggers an ajax request, you can perform it manually.
This action sends a POST ajax request with specified params.
Additional params can be passed as array.

Example:
Example:

Imagine that by clicking checkbox you trigger ajax request which updates user settings.
We emulate that click by running this ajax request manually.
Imagine that by clicking checkbox you trigger ajax request which updates user settings.
We emulate that click by running this ajax request manually.

``` php
<?php
$I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST
$I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET
``` php
<?php
$I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST
$I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET

```
```

* param $uri
* param $params
* param $uri
* param $params


### submitForm


Submits a form located on page.
Specify the form by it's css or xpath selector.
Fill the form fields values as array.
Submits a form located on page.
Specify the form by it's css or xpath selector.
Fill the form fields values as array.

Skipped fields will be filled by their values from page.
You don't need to click the 'Submit' button afterwards.
This command itself triggers the request to form's action.
Skipped fields will be filled by their values from page.
You don't need to click the 'Submit' button afterwards.
This command itself triggers the request to form's action.

Examples:
Examples:

``` php
<?php
$I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));
``` php
<?php
$I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));

```
```

For sample Sign Up form:
For sample Sign Up form:

``` html
<form action="/sign_up">
Login: <input type="text" name="user[login]" /><br/>
Password: <input type="password" name="user[password]" /><br/>
Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/>
Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select>
<input type="submit" value="Submit" />
</form>
```
I can write this:
``` html
<form action="/sign_up">
Login: <input type="text" name="user[login]" /><br/>
Password: <input type="password" name="user[password]" /><br/>
Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/>
Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select>
<input type="submit" value="Submit" />
</form>
```
I can write this:

``` php
<?php
$I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));
``` php
<?php
$I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));

```
Note, that pricing plan will be set to Paid, as it's selected on page.
```
Note, that pricing plan will be set to Paid, as it's selected on page.

* param $selector
* param $params
* param $selector
* param $params


### uncheckOption
Expand Down
1 change: 1 addition & 0 deletions src/Codeception/Command/GenerateScenarios.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ protected function configure()
{
$this->setDefinition(array(
new \Symfony\Component\Console\Input\InputArgument('suite', InputArgument::REQUIRED, 'suite from which tests should be generated'),
new \Symfony\Component\Console\Input\InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use specified config instead of default'),
new \Symfony\Component\Console\Input\InputOption('path', 'p', InputOption::VALUE_REQUIRED, 'Use specified path as destination instead of default'),
new \Symfony\Component\Console\Input\InputOption('single-file', '', InputOption::VALUE_NONE, 'Render all scenarios to only one file'),
new \Symfony\Component\Console\Input\InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Specify output format: html or text (default)'),
Expand Down
30 changes: 15 additions & 15 deletions src/Codeception/Exception/Module.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
namespace Codeception\Exception;
class Module extends \Exception {

protected $module;
public function __construct($module, $message) {
$module = str_replace('\Codeception\Module\\','',$module);
$this->module = $module;
parent::__construct($message);
$this->message = '(Exception in '.$module.') ' . $this->message;
}

}
<?php
namespace Codeception\Exception;

class Module extends \Exception {

protected $module;

public function __construct($module, $message) {
$module = ltrim(str_replace('Codeception\Module\\', '', $module), '\\');
$this->module = $module;
parent::__construct($message);
$this->message = '(Exception in '.$module.') ' . $this->message;
}

}
1 change: 0 additions & 1 deletion src/Codeception/Module/REST.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
*
*/

class REST extends \Codeception\Module
{

Expand Down
34 changes: 34 additions & 0 deletions tests/unit/Codeception/Module/AMQPTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Codeception\Util\Stub as Stub;

class AMQPTest extends \PHPUnit_Framework_TestCase
{
protected $config = array(
'host' => 'localhost',
'username' => 'guest',
'password' => 'guest',
'vhost' => '/',
'routes' => array(
array('exchange' => 'Test', 'queue' => 'Test')
)
);

/**
* @var \Codeception\Module\AMQP
*/
protected $module = null;

public function setUp()
{
$this->module = new \Codeception\Module\AMQP;
$this->module->_setConfig($this->config);
$this->module->_initialize();
$this->module->_before(Stub::makeEmpty('\Codeception\TestCase\Cest'));
}

public function testCleanup()
{

}
}

0 comments on commit 1310ac1

Please sign in to comment.