Tests that the embedded form appears and can be submitted.
function testEmbeddedForm() {
// First verify we can submit the form from the module's page.
$this
->drupalPost('search_embedded_form', array(
'name' => 'John',
), t('Send away'));
$this
->assertText(t('Test form was submitted'), 'Form message appears');
$count = config('search_embedded_form.settings')
->get('submitted');
$this
->assertEqual($this->submit_count + 1, $count, 'Form submission count is correct');
$this->submit_count = $count;
// Now verify that we can see and submit the form from the search results.
$this
->drupalGet('search/node/' . $this->node
->label());
$this
->assertText(t('Your name'), 'Form is visible');
$this
->drupalPost('search/node/' . $this->node
->label(), array(
'name' => 'John',
), t('Send away'));
$this
->assertText(t('Test form was submitted'), 'Form message appears');
$count = config('search_embedded_form.settings')
->get('submitted');
$this
->assertEqual($this->submit_count + 1, $count, 'Form submission count is correct');
$this->submit_count = $count;
// Now verify that if we submit the search form, it doesn't count as
// our form being submitted.
$this
->drupalPost('search', array(
'keys' => 'foo',
), t('Search'));
$this
->assertNoText(t('Test form was submitted'), 'Form message does not appear');
$count = config('search_embedded_form.settings')
->get('submitted');
$this
->assertEqual($this->submit_count, $count, 'Form submission count is correct');
$this->submit_count = $count;
}