|
@@ 360-384 (lines=25) @@
|
| 357 |
|
* |
| 358 |
|
* @author tonykova |
| 359 |
|
*/ |
| 360 |
|
public function test_process_submission_sends_correct_single_email() { |
| 361 |
|
// Fill field values. |
| 362 |
|
$this->add_field_values( |
| 363 |
|
array( |
| 364 |
|
'name' => 'John Doe', |
| 365 |
|
'dropdown' => 'First option', |
| 366 |
|
'radio' => 'Second option', |
| 367 |
|
'text' => 'Texty text', |
| 368 |
|
) |
| 369 |
|
); |
| 370 |
|
|
| 371 |
|
add_filter( 'wp_mail', array( $this, 'pre_test_process_submission_sends_correct_single_email' ) ); |
| 372 |
|
|
| 373 |
|
// Initialize a form with name, dropdown and radiobutton (first, second |
| 374 |
|
// and third option), text field. |
| 375 |
|
$form = new Grunion_Contact_Form( |
| 376 |
|
array( |
| 377 |
|
'to' => '"john" <[email protected]>', |
| 378 |
|
'subject' => 'Hello there!', |
| 379 |
|
), |
| 380 |
|
"[contact-field label='Name' type='name' required='1'/][contact-field label='Dropdown' type='select' options='First option,Second option,Third option'/][contact-field label='Radio' type='radio' options='First option,Second option,Third option'/][contact-field label='Text' type='text'/]" |
| 381 |
|
); |
| 382 |
|
$result = $form->process_submission(); |
| 383 |
|
$this->assertNotNull( $result ); |
| 384 |
|
} |
| 385 |
|
|
| 386 |
|
/** |
| 387 |
|
* This method is hooked to the wp-mail filter. |
|
@@ 413-438 (lines=26) @@
|
| 410 |
|
* |
| 411 |
|
* @author tonykova |
| 412 |
|
*/ |
| 413 |
|
public function test_process_submission_sends_correct_multiple_email() { |
| 414 |
|
// Fill field values. |
| 415 |
|
$this->add_field_values( |
| 416 |
|
array( |
| 417 |
|
'name' => 'John Doe', |
| 418 |
|
'dropdown' => 'First option', |
| 419 |
|
'radio' => 'Second option', |
| 420 |
|
'text' => 'Texty text', |
| 421 |
|
) |
| 422 |
|
); |
| 423 |
|
|
| 424 |
|
add_filter( 'wp_mail', array( $this, 'pre_test_process_submission_sends_correct_multiple_email' ) ); |
| 425 |
|
|
| 426 |
|
// Initialize a form with name, dropdown and radiobutton (first, second |
| 427 |
|
// and third option), text field. |
| 428 |
|
$form = new Grunion_Contact_Form( |
| 429 |
|
array( |
| 430 |
|
'to' => '[email protected], [email protected]', |
| 431 |
|
'subject' => 'Hello there!', |
| 432 |
|
), |
| 433 |
|
"[contact-field label='Name' type='name' required='1'/][contact-field label='Dropdown' type='select' options='First option,Second option,Third option'/][contact-field label='Radio' type='radio' options='First option,Second option,Third option'/][contact-field label='Text' type='text'/]" |
| 434 |
|
); |
| 435 |
|
|
| 436 |
|
$result = $form->process_submission(); |
| 437 |
|
$this->assertNotNull( $result ); |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
/** |
| 441 |
|
* This method is hooked to the wp-mail filter. |