Skip to content

Commit d219a01

Browse files
committed
1 parent e4b70c0 commit d219a01

File tree

9 files changed

+49
-31
lines changed

9 files changed

+49
-31
lines changed

codecept.bat

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
@echo off
2-
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
3-
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
4-
GOTO RUN
5-
:USE_PEAR_PATH
6-
set PHPBIN=%PHP_PEAR_PHP_BIN%
7-
:RUN
8-
"%PHPBIN%" "@bin_dir@\codecept" %*
1+
@echo off
2+
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
3+
if exist "codecept" goto INTERNAL
4+
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
5+
GOTO RUN
6+
:USE_PEAR_PATH
7+
set PHPBIN=%PHP_PEAR_PHP_BIN%
8+
:RUN
9+
"%PHPBIN%" "@bin_dir@\codecept" %*
10+
:INTERNAL
11+
"%PHPBIN%" "codecept" %*

src/Codeception/Module/ZF1.php

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ protected function debugResponse()
119119
// $this->client->getzendrequest()->getcontrollername(),
120120
// $this->client->getzendrequest()->getactionname()
121121
// ));
122+
$this->debugSection('Session',json_encode($_COOKIE));
122123
if ($this->db) {
123124
$profiler = $this->db->getProfiler();
124125
$queries = $profiler->getTotalNumQueries() - $this->queries;

src/Codeception/Util/Framework.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ protected function getFormFor($node)
194194
$action = $this->getFormUrl($form);
195195

196196
if (!isset($this->forms[$action])) {
197-
$form->children()->addHtmlContent('<input type="submit" />'); // for forms with no submits...
197+
$submit = new \DOMElement('input');
198+
$submit = $form->current()->appendChild($submit);
199+
$submit->setAttribute('type','submit'); // for forms with no submits
200+
198201
$form = $form->filter('input[type=submit]')->form();
199202
$this->forms[$action] = $form;
200203
}

tests/data/app/db

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a:1:{s:13:"4f4356d6a9057";a:0:{}}
1+
a:0:{}

tests/data/app/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'/' => 'index',
1111
'/info' => 'info',
1212
'/login' => 'login',
13-
'/form/(field|select|checkbox|file|textarea|hidden|complex)(#)?' => 'form'
13+
'/form/(field|select|checkbox|file|textarea|hidden|complex|button|empty)(#)?' => 'form'
1414
);
1515

1616
glue::stick($urls);

tests/data/app/view/form/button.php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<body>
3+
<form action="/form/button" method="POST">
4+
<input type="hidden" name="text" value="val" />
5+
<button type="submit">Submit</button>
6+
</form>
7+
</body>
8+
</html>

tests/data/app/view/form/empty.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<html>
2+
<body>
3+
<form action="/form/empty" method="POST">
4+
<input type="text" name="text" value="val">
5+
</form>
6+
</body>
7+
</html>

tests/log/codeception-2012-02-06.log

-20
This file was deleted.

tests/unit/Codeception/Module/FrameworksTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@ public function testSubmitForm() {
169169
$this->assertEquals('Davert', $form['name']);
170170
$this->assertEquals('kill_all', $form['action']);
171171
}
172+
173+
public function testSubmitFormWithNoSubmitButton() {
174+
$this->module->amOnPage('/form/empty');
175+
$this->module->submitForm('form', array('text' => 'davert'));
176+
$form = data::get('form');
177+
$this->assertEquals('davert', $form['text']);
178+
}
179+
180+
public function testSubmitFormByButton() {
181+
$this->module->amOnPage('/form/button');
182+
$this->module->click('Submit');
183+
$form = data::get('form');
184+
$this->assertEquals('val', $form['text']);
185+
}
172186

173187
public function testAjax() {
174188
$this->module->sendAjaxGetRequest('/info', array('show' => 'author'));
@@ -213,5 +227,7 @@ public function testComplexSelectorsAndForms() {
213227
$this->assertEquals('[email protected]', $post['email']);
214228

215229
}
230+
231+
216232

217233
}

0 commit comments

Comments
 (0)