| 1 views_plugin_display_embed.test | public ViewsPluginDisplayEmbedTestCase::testEmbedExposedForm() |
Tests the embed display with an exposed form.
File
- core/
modules/ views/ tests/ plugins/ views_plugin_display_embed.test, line 44 - Definition of ViewsPluginDisplayEmbedTestCase.
Class
- ViewsPluginDisplayEmbedTestCase
- Tests the embed display plugin.
Code
public function testEmbedExposedForm() {
$this->backdropGet('test_embed_exposed_form');
// Check if the exposed form is NOT present (exposed_block is TRUE).
$this->assertNoFieldByName('title', '', 'The exposed title filter is not present when exposed_block is TRUE.');
// Filter by title via URL parameters.
$node = $this->test_content[0];
$edit = array(
'title' => $node->title,
);
$this->backdropGet('test_embed_exposed_form', array('query' => $edit));
// Verify the filtered result.
$this->assertText($node->title, 'The filtered node title is present.');
// Verify that other nodes are not present.
for ($i = 1; $i < 5; $i++) {
$this->assertNoText($this->test_content[$i]->title, 'Other node titles are not present.');
}
// Now disable exposed_block and check if the form appears.
$view = views_get_view('test_embed_exposed_form');
$view->set_display('embed_1');
$view->display_handler->set_option('exposed_block', FALSE);
$view->save();
views_invalidate_cache();
$this->backdropGet('test_embed_exposed_form');
$this->assertFieldByName('title', '', 'The exposed title filter is present when exposed_block is FALSE.');
$this->assertFieldById('edit-submit-test-embed-exposed-form', t('Apply'), 'The exposed form submit button is present.');
}