Skip to content

Commit c5ca8ed

Browse files
authored
Merge pull request #106 from localgovdrupal/2.x
2.1.3 release
2 parents a814d8a + 9c4d73e commit c5ca8ed

3 files changed

+123
-12
lines changed

config/install/core.entity_view_display.node.localgov_subsites_overview.search_result.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@ targetEntityType: node
1616
bundle: localgov_subsites_overview
1717
mode: search_result
1818
content:
19-
localgov_subsites_summary:
20-
type: basic_string
21-
weight: 0
22-
region: content
23-
label: hidden
19+
search_api_excerpt:
2420
settings: { }
2521
third_party_settings: { }
22+
weight: 0
23+
region: content
2624
hidden:
25+
content_moderation_control: true
2726
links: true
2827
localgov_subsites_banner: true
2928
localgov_subsites_content: true
3029
localgov_subsites_hide_menu: true
3130
localgov_subsites_pages: true
31+
localgov_subsites_summary: true
3232
localgov_subsites_theme: true
33-
search_api_excerpt: true

config/install/core.entity_view_display.node.localgov_subsites_page.search_result.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ targetEntityType: node
1616
bundle: localgov_subsites_page
1717
mode: search_result
1818
content:
19-
localgov_subsites_summary:
20-
type: basic_string
21-
weight: 0
22-
region: content
23-
label: hidden
19+
search_api_excerpt:
2420
settings: { }
2521
third_party_settings: { }
22+
weight: 0
23+
region: content
2624
hidden:
25+
content_moderation_control: true
2726
links: true
2827
localgov_subsites_banner: true
2928
localgov_subsites_content: true
3029
localgov_subsites_parent: true
30+
localgov_subsites_summary: true
3131
localgov_subsites_topic: true
32-
search_api_excerpt: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
3+
namespace Drupal\Tests\localgov_subsites\Functional;
4+
5+
use Drupal\Tests\Traits\Core\CronRunTrait;
6+
use Drupal\node\NodeInterface;
7+
use Drupal\Tests\BrowserTestBase;
8+
use Drupal\Tests\node\Traits\NodeCreationTrait;
9+
use Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait;
10+
11+
/**
12+
* Tests pages working together with LocalGov: pathauto, services, search.
13+
*
14+
* @group localgov_directories
15+
*/
16+
class LocalgovIntegrationTest extends BrowserTestBase {
17+
18+
use NodeCreationTrait;
19+
use AssertBreadcrumbTrait;
20+
use CronRunTrait;
21+
22+
/**
23+
* Test breadcrumbs in the Standard profile.
24+
*
25+
* @var string
26+
*/
27+
protected $profile = 'standard';
28+
29+
/**
30+
* {@inheritdoc}
31+
*/
32+
protected $defaultTheme = 'stable';
33+
34+
/**
35+
* A user with permission to bypass content access checks.
36+
*
37+
* @var \Drupal\user\UserInterface
38+
*/
39+
protected $adminUser;
40+
41+
/**
42+
* The node storage.
43+
*
44+
* @var \Drupal\node\NodeStorageInterface
45+
*/
46+
protected $nodeStorage;
47+
48+
/**
49+
* Modules to enable.
50+
*
51+
* @var array
52+
*/
53+
protected static $modules = [
54+
'localgov_core',
55+
'localgov_services_landing',
56+
'localgov_services_sublanding',
57+
'localgov_services_navigation',
58+
'localgov_subsites',
59+
'localgov_search',
60+
'localgov_search_db',
61+
];
62+
63+
/**
64+
* {@inheritdoc}
65+
*/
66+
protected function setUp(): void {
67+
parent::setUp();
68+
$this->drupalPlaceBlock('system_breadcrumb_block');
69+
$this->adminUser = $this->drupalCreateUser([
70+
'bypass node access',
71+
'administer nodes',
72+
]);
73+
$this->nodeStorage = $this->container->get('entity_type.manager')->getStorage('node');
74+
}
75+
76+
/**
77+
* LocalGov Search integration.
78+
*/
79+
public function testLocalgovSearch() {
80+
81+
// Confirm the localgov_subsites_overview nodes work with database search.
82+
$title = 'Subsite overview 1';
83+
$overview_summary = 'Science is the search for truth, that is the effort to understand the world: it involves the rejection of bias, of dogma, of revelation, but not the rejection of morality.';
84+
$this->createNode([
85+
'title' => $title,
86+
'type' => 'localgov_subsites_overview',
87+
'status' => NodeInterface::PUBLISHED,
88+
'localgov_subsites_summary' => $overview_summary,
89+
]);
90+
$this->cronRun();
91+
$this->drupalGet('search', ['query' => ['s' => 'bias+dogma+revelation']]);
92+
$this->assertSession()->pageTextContains($title);
93+
$this->assertSession()->responseContains('<strong>bias</strong>');
94+
$this->assertSession()->responseContains('<strong>dogma</strong>');
95+
$this->assertSession()->responseContains('<strong>revelation</strong>');
96+
97+
// Confirm the localgov_subsites_page nodes work with database search.
98+
$page_summary = "Time isn't the main thing. It's the only thing.";
99+
$this->createNode([
100+
'title' => 'Subsite subsite page',
101+
'type' => 'localgov_subsites_page',
102+
'status' => NodeInterface::PUBLISHED,
103+
'localgov_subsites_summary' => $page_summary,
104+
]);
105+
$this->cronRun();
106+
$this->drupalGet('search', ['query' => ['s' => 'time+main+only']]);
107+
$this->assertSession()->pageTextContains('Subsite subsite page');
108+
$this->assertSession()->responseContains('<strong>time</strong>');
109+
$this->assertSession()->responseContains('<strong>main</strong>');
110+
$this->assertSession()->responseContains('<strong>only</strong>');
111+
}
112+
113+
}

0 commit comments

Comments
 (0)