Skip to content

Commit

Permalink
Issue #3403634 by SV: Fix PHPStan & PHPCS checks Behat & Unit/Kernel …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
volodymyr-sydor committed Mar 26, 2024
1 parent cddd12f commit 6513c9f
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 148 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
# Also include a hardcoded version for instaclick/php-webdriver, drupal/dynamic_entity_reference and drupal/core
# as we didnt lock the version, and the patch isn't applying on the latest, so we require it
# specifically to match the version that was installed at that moment in time.
composer require goalgorilla/open_social:~$PREVIOUS_MAJOR instaclick/php-webdriver:1.4.16 drupal/dynamic_entity_reference:3.1.0 drupal/core:10.2.3
composer require goalgorilla/open_social:~$PREVIOUS_MAJOR instaclick/php-webdriver:1.4.16 drupal/dynamic_entity_reference:3.1.0 drupal/core:10.2.3 "drupal/flexible_permissions:^1.1.0"
# Installation
# This is purposefully duplicated because we may change how
Expand All @@ -123,6 +123,7 @@ jobs:
fi
drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social' > >(tee install-output.log) 2> >(tee install-error.log >&2)
drush en flexible_permissions
# Dump the database to our test-output folder so that we can locally
# debug if the update fails.
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
"Missing config schema for condition.plugin.group_type": "https://www.drupal.org/files/issues/2018-12-14/group-group_type_condition_plugin_config_schema-3020554-2.patch",
"Ability to use group tokens in node context": "https://www.drupal.org/files/issues/2023-02-17/group-2774827-93.patch",
"(Deprecated) This patch should be deleted when OS will integrate group entity query access handlers": "https://raw.githubusercontent.com/goalgorilla/open_social/a6a1c0d2932eba7efcea050aedc910c3acaec223/patches/gnode_grant_access.patch"
},
"drupal/socialbase": {
"Replace non-existing classes according to group module upgrade to 2.x": "https://git.drupalcode.org/project/socialbase/-/merge_requests/199.patch"
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions cspell.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ incredibile
indoctum
infame
informblock
inheritdoc
Inhoud
iniitalize
Initialise
Expand All @@ -673,6 +674,7 @@ inscitiae
insipientes
insipientium
instaclick
instanceof
Instellingen
instituta
institutis
Expand All @@ -693,6 +695,7 @@ ipse
ipsis
ironman
isnt
isset
ista
Istam
istarum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function testGrantsAlter() :void {
// We focus on the node types, which is what
// entity_access_by_field_node_grants_alter() attempts to influence.
$grants = [
'gnode:a' => [1, 2],
'gnode:b' => [1, 2],
'gnode:a' => [$this->group1->id(), $this->group2->id()],
'gnode:b' => [$this->group1->id(), $this->group2->id()],
];

// Verify that when a member is part of both groups, nothing will be
Expand All @@ -36,8 +36,8 @@ public function testGrantsAlter() :void {
entity_access_by_field_node_grants_alter($altered_grants_groups2, $this->account, 'view');

$expected_result_groups2 = [
'gnode:a' => [1 => 2],
'gnode:b' => [1 => 2],
'gnode:a' => [1 => $this->group2->id()],
'gnode:b' => [1 => $this->group2->id()],
];
$this->assertEquals($expected_result_groups2, $altered_grants_groups2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class EntityAccessNodeAccessTestBase extends EntityKernelTestBase {
*
* @var array
*/
protected static $modules = ['group', 'options', 'entity', 'variationcache', 'node', 'gnode', 'social_group', 'flag', 'address', 'image', 'file', 'entity_access_by_field'];
protected static $modules = ['group', 'options', 'entity', 'variationcache', 'node', 'gnode', 'social_group', 'flag', 'address', 'image', 'file', 'entity_access_by_field', 'flexible_permissions'];

/**
* The entity type manager service.
Expand Down Expand Up @@ -67,7 +67,16 @@ protected function setUp() :void {

// Create a group type.
$storage = $this->entityTypeManager->getStorage('group_type');
$values = ['label' => 'foo', 'description' => 'bar'];
$values = [
'label' => 'foo',
'description' => 'bar',
// Farther two options needed to make an author as a group member as well.
// Probably, in next "group" module versions making author as a group
// member could be possible only with Group::addMember() method.
/* @see \Drupal\group\Entity\Group::postSave() */
'creator_membership' => TRUE,
'creator_wizard' => FALSE,
];
/** @var \Drupal\group\Entity\GroupTypeInterface $groupTypeA */
$groupTypeA = $storage->create(['id' => 'a'] + $values);
$groupTypeA->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ abstract class GraphQLTestBase extends KernelTestBase {
'menu_link_content',
'link',
'typed_data',
'flexible_permissions',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CommentViewAccessTest extends EntityKernelTestBase {
'views',
'group',
'variationcache',
'flexible_permissions',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class QueryCommentTest extends SocialGraphQLTestBase {
'views',
'group',
'variationcache',
'flexible_permissions',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class QueryCommentsTest extends SocialGraphQLTestBase {
'views',
'group',
'variationcache',
'flexible_permissions',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
public static function create(ContainerInterface $container): self {
return new static(
$container->get('entity_type.manager')
);
Expand Down Expand Up @@ -141,6 +141,7 @@ protected function getGroups() {
$types = [];
/** @var \Drupal\group\Entity\GroupType $group_type */
foreach (GroupType::loadMultiple() as $group_type) {
/** @var \Drupal\group\Entity\GroupRoleInterface $outsider_role */
$outsider_role = $this->entityTypeManager
->getStorage('group_role')
->load($group_type->id() . '-outsider');
Expand Down
Loading

0 comments on commit 6513c9f

Please sign in to comment.