Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
akovardin committed Feb 29, 2012
2 parents 8fd6a3e + d219a01 commit 975eafd
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 31 deletions.
19 changes: 11 additions & 8 deletions codecept.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@echo off
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "@bin_dir@\codecept" %*
@echo off
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
if exist "codecept" goto INTERNAL
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "@bin_dir@\codecept" %*
:INTERNAL
"%PHPBIN%" "codecept" %*
1 change: 1 addition & 0 deletions src/Codeception/Module/ZF1.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ protected function debugResponse()
// $this->client->getzendrequest()->getcontrollername(),
// $this->client->getzendrequest()->getactionname()
// ));
$this->debugSection('Session',json_encode($_COOKIE));
if ($this->db) {
$profiler = $this->db->getProfiler();
$queries = $profiler->getTotalNumQueries() - $this->queries;
Expand Down
5 changes: 4 additions & 1 deletion src/Codeception/Util/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ protected function getFormFor($node)
$action = $this->getFormUrl($form);

if (!isset($this->forms[$action])) {
$form->children()->addHtmlContent('<input type="submit" />'); // for forms with no submits...
$submit = new \DOMElement('input');
$submit = $form->current()->appendChild($submit);
$submit->setAttribute('type','submit'); // for forms with no submits

$form = $form->filter('input[type=submit]')->form();
$this->forms[$action] = $form;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/data/app/db
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a:1:{s:13:"4f4356d6a9057";a:0:{}}
a:0:{}
2 changes: 1 addition & 1 deletion tests/data/app/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'/' => 'index',
'/info' => 'info',
'/login' => 'login',
'/form/(field|select|checkbox|file|textarea|hidden|complex)(#)?' => 'form'
'/form/(field|select|checkbox|file|textarea|hidden|complex|button|empty)(#)?' => 'form'
);

glue::stick($urls);
Expand Down
8 changes: 8 additions & 0 deletions tests/data/app/view/form/button.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<body>
<form action="/form/button" method="POST">
<input type="hidden" name="text" value="val" />
<button type="submit">Submit</button>
</form>
</body>
</html>
7 changes: 7 additions & 0 deletions tests/data/app/view/form/empty.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html>
<body>
<form action="/form/empty" method="POST">
<input type="text" name="text" value="val">
</form>
</body>
</html>
20 changes: 0 additions & 20 deletions tests/log/codeception-2012-02-06.log

This file was deleted.

16 changes: 16 additions & 0 deletions tests/unit/Codeception/Module/FrameworksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,20 @@ public function testSubmitForm() {
$this->assertEquals('Davert', $form['name']);
$this->assertEquals('kill_all', $form['action']);
}

public function testSubmitFormWithNoSubmitButton() {
$this->module->amOnPage('/form/empty');
$this->module->submitForm('form', array('text' => 'davert'));
$form = data::get('form');
$this->assertEquals('davert', $form['text']);
}

public function testSubmitFormByButton() {
$this->module->amOnPage('/form/button');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('val', $form['text']);
}

public function testAjax() {
$this->module->sendAjaxGetRequest('/info', array('show' => 'author'));
Expand Down Expand Up @@ -213,5 +227,7 @@ public function testComplexSelectorsAndForms() {
$this->assertEquals('miles@davis.com', $post['email']);

}



}

0 comments on commit 975eafd

Please sign in to comment.