Skip to content

Commit

Permalink
Fix some of the failing tests. (#519)
Browse files Browse the repository at this point in the history
* Fix some of the failing tests.
* The test context service returns group 1 don't enable it until (or just before) that group is actually created to be able to be returned.

---------

Co-authored-by: ekes <[email protected]>
  • Loading branch information
finnlewis and ekes authored Nov 5, 2024
1 parent 078b43f commit 19d60c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/src/Kernel/ContentTypeHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ class ContentTypeHelperTest extends GroupKernelTestBase {
protected function setUp(): void {
parent::setUp();

// Set config that group_sites needs to run tests.
$this->config('group_sites.settings')
->set('no_site_access_policy', 'group_sites.no_site_access_policy.do_nothing')
->set('site_access_policy', 'group_sites.site_access_policy.single')
->save();

// You really don't want to install localgov_page or localgov_events in a
// Kernel test!
NodeType::create([
Expand Down
6 changes: 6 additions & 0 deletions tests/src/Kernel/GroupDefaultContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ class GroupDefaultContentTest extends GroupKernelTestBase {
protected function setUp(): void {
parent::setUp();

// Set config that group_sites needs to run tests.
$this->config('group_sites.settings')
->set('no_site_access_policy', 'group_sites.no_site_access_policy.do_nothing')
->set('site_access_policy', 'group_sites.site_access_policy.single')
->save();

$this->installEntitySchema('group_content_menu');
$this->installSchema('node', 'node_access');

Expand Down
7 changes: 7 additions & 0 deletions tests/src/Kernel/UserRoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class UserRoleTest extends GroupKernelTestBase {
'group',
'group_content_menu',
'group_sites',
'group_sites_test',
'image',
'media',
'media_library',
Expand Down Expand Up @@ -60,6 +61,12 @@ protected function setUp(): void {
* Test the addition and removal of Trusted Editor role to group members.
*/
public function testTrustedEditor() {
// Set config that group_sites needs to run tests.
$this->config('group_sites.settings')
->set('context_provider', '@group_sites_test.hardcoded_group_context:group')
->set('no_site_access_policy', 'group_sites.no_site_access_policy.do_nothing')
->set('site_access_policy', 'group_sites.site_access_policy.single')
->save();

// Create some groups.
$group1 = Group::create([
Expand Down

0 comments on commit 19d60c0

Please sign in to comment.