class ViewsPluginDisplayEmbedTestCase extends ViewsSqlTest {
protected $profile = 'minimal';
protected $admin_user;
protected $test_content = array();
protected function setUp(array $modules = array()) {
parent::setUp($modules);
$this->backdropCreateContentType(array('type' => 'post', 'name' => 'Post'));
for ($n = 0; $n < 5; $n++) {
$this->test_content[] = $this->backdropCreateNode(array('type' => 'post'));
}
$this->admin_user = $this->backdropCreateUser(array(
'administer views',
'access administration pages',
'access content',
'view any unpublished content',
'bypass node access',
'administer nodes',
));
$this->backdropLogin($this->admin_user);
}
public function testEmbedExposedForm() {
$this->backdropGet('test_embed_exposed_form');
$this->assertNoFieldByName('title', '', 'The exposed title filter is not present when exposed_block is TRUE.');
$node = $this->test_content[0];
$edit = array(
'title' => $node->title,
);
$this->backdropGet('test_embed_exposed_form', array('query' => $edit));
$this->assertText($node->title, 'The filtered node title is present.');
for ($i = 1; $i < 5; $i++) {
$this->assertNoText($this->test_content[$i]->title, 'Other node titles are not present.');
}
$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.');
}
}