summaryrefslogtreecommitdiffstats
path: root/src/Tests/WidgetIntegrationTest.php
diff options
context:
space:
mode:
authorborisson_2016-05-04 07:47:39 (GMT)
committerJoris Vercammen2016-05-04 07:47:39 (GMT)
commitba4f21ec0d103f2aa59b7a2e94deb88e5d68ae78 (patch)
tree208bd0965d179dba627f26577cccc85ba32197f1 /src/Tests/WidgetIntegrationTest.php
parente75d01a1fd972c50dad267dc50e8107c363d1ba6 (diff)
Issue #2717903 by borisson_: Cleanup for tests
Diffstat (limited to 'src/Tests/WidgetIntegrationTest.php')
-rw-r--r--src/Tests/WidgetIntegrationTest.php97
1 files changed, 8 insertions, 89 deletions
diff --git a/src/Tests/WidgetIntegrationTest.php b/src/Tests/WidgetIntegrationTest.php
index 960a66a..5a49f1a 100644
--- a/src/Tests/WidgetIntegrationTest.php
+++ b/src/Tests/WidgetIntegrationTest.php
@@ -39,35 +39,15 @@ class WidgetIntegrationTest extends WebTestBase {
}
/**
- * Tests various url integration things.
+ * Tests checkbox widget.
*/
public function testCheckboxWidget() {
$id = 't';
$name = 'Facet & checkbox~';
- $facet_add_page = 'admin/config/search/facets/add-facet';
-
- $this->drupalGet($facet_add_page);
-
- $form_values = [
- 'id' => $id,
- 'status' => 1,
- 'name' => $name,
- 'facet_source_id' => 'search_api_views:search_api_test_view:page_1',
- 'facet_source_configs[search_api_views:search_api_test_view:page_1][field_identifier]' => 'type',
- ];
- $this->drupalPostForm(NULL, ['facet_source_id' => 'search_api_views:search_api_test_view:page_1'], $this->t('Configure facet source'));
- $this->drupalPostForm(NULL, $form_values, $this->t('Save'));
+ $this->createFacet($name, $id);
+ $this->drupalGet('admin/config/search/facets/' . $id . '/edit');
$this->drupalPostForm(NULL, ['widget' => 'checkbox'], $this->t('Save'));
- $block_values = [
- 'plugin_id' => 'facet_block:' . $id,
- 'settings' => [
- 'region' => 'footer',
- 'id' => str_replace('_', '-', $id),
- ],
- ];
- $this->drupalPlaceBlock($block_values['plugin_id'], $block_values['settings']);
-
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
@@ -79,30 +59,10 @@ class WidgetIntegrationTest extends WebTestBase {
public function testLinksWidget() {
$id = 'links_widget';
$name = '>.Facet &* Links';
- $facet_add_page = 'admin/config/search/facets/add-facet';
-
- $this->drupalGet($facet_add_page);
-
- $form_values = [
- 'id' => $id,
- 'status' => 1,
- 'name' => $name,
- 'facet_source_id' => 'search_api_views:search_api_test_view:page_1',
- 'facet_source_configs[search_api_views:search_api_test_view:page_1][field_identifier]' => 'type',
- ];
- $this->drupalPostForm(NULL, ['facet_source_id' => 'search_api_views:search_api_test_view:page_1'], $this->t('Configure facet source'));
- $this->drupalPostForm(NULL, $form_values, $this->t('Save'));
+ $this->createFacet($name, $id);
+ $this->drupalGet('admin/config/search/facets/' . $id . '/edit');
$this->drupalPostForm(NULL, ['widget' => 'links'], $this->t('Save'));
- $block_values = [
- 'plugin_id' => 'facet_block:' . $id,
- 'settings' => [
- 'region' => 'footer',
- 'id' => str_replace('_', '-', $id),
- ],
- ];
- $this->drupalPlaceBlock($block_values['plugin_id'], $block_values['settings']);
-
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
@@ -117,30 +77,10 @@ class WidgetIntegrationTest extends WebTestBase {
public function testSelectWidget() {
$id = 'select_widget';
$name = 'Select';
- $facet_add_page = 'admin/config/search/facets/add-facet';
-
- $this->drupalGet($facet_add_page);
-
- $form_values = [
- 'id' => $id,
- 'status' => 1,
- 'name' => $name,
- 'facet_source_id' => 'search_api_views:search_api_test_view:page_1',
- 'facet_source_configs[search_api_views:search_api_test_view:page_1][field_identifier]' => 'type',
- ];
- $this->drupalPostForm(NULL, ['facet_source_id' => 'search_api_views:search_api_test_view:page_1'], $this->t('Configure facet source'));
- $this->drupalPostForm(NULL, $form_values, $this->t('Save'));
+ $this->createFacet($name, $id);
+ $this->drupalGet('admin/config/search/facets/' . $id . '/edit');
$this->drupalPostForm(NULL, ['widget' => 'select'], $this->t('Save'));
- $block_values = [
- 'plugin_id' => 'facet_block:' . $id,
- 'settings' => [
- 'region' => 'footer',
- 'id' => str_replace('_', '-', $id),
- ],
- ];
- $this->drupalPlaceBlock($block_values['plugin_id'], $block_values['settings']);
-
$this->drupalGet('search-api-test-fulltext');
$this->assertField('edit-type', 'Dropdown is visible.');
$this->assertText('Displaying 5 search results');
@@ -159,30 +99,9 @@ class WidgetIntegrationTest extends WebTestBase {
public function testLinksShowHideCount() {
$id = 'links_widget';
$name = '>.Facet &* Links';
- $facet_add_page = 'admin/config/search/facets/add-facet';
$facet_edit_page = 'admin/config/search/facets/' . $id . '/edit';
- $this->drupalGet($facet_add_page);
-
- $form_values = [
- 'id' => $id,
- 'status' => 1,
- 'name' => $name,
- 'facet_source_id' => 'search_api_views:search_api_test_view:page_1',
- 'facet_source_configs[search_api_views:search_api_test_view:page_1][field_identifier]' => 'type',
- ];
- $this->drupalPostForm(NULL, ['facet_source_id' => 'search_api_views:search_api_test_view:page_1'], $this->t('Configure facet source'));
- $this->drupalPostForm(NULL, $form_values, $this->t('Save'));
- $this->drupalPostForm(NULL, ['widget' => 'links'], $this->t('Save'));
-
- $block_values = [
- 'plugin_id' => 'facet_block:' . $id,
- 'settings' => [
- 'region' => 'footer',
- 'id' => str_replace('_', '-', $id),
- ],
- ];
- $this->drupalPlaceBlock($block_values['plugin_id'], $block_values['settings']);
+ $this->createFacet($name, $id);
// Go to the view and check that the facet links are shown with their
// default settings.