Skip to content
Open
20 changes: 11 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Integration Tests
on:
workflow_dispatch:
push:
branches: [ 8.x-3.x ]
pull_request:
types: [assigned, opened, synchronize, reopened]
branches:
Expand All @@ -14,12 +15,12 @@ jobs:
fail-fast: false
matrix:
include:
- drupal: '8.9.*'
civicrm: '5.35.*'
- drupal: '8.9.*'
civicrm: '5.39.*'
- drupal: '9.3.*'
civicrm: '5.45.x-dev'
# - drupal: '8.9.*'
# civicrm: '5.35.*'
# - drupal: '8.9.*'
# civicrm: '5.39.*'
# - drupal: '9.3.*'
# civicrm: '5.45.x-dev'
- drupal: '9.3.*'
civicrm: 'dev-master'
name: Drupal ${{ matrix.drupal }} | CiviCRM ${{ matrix.civicrm }}
Expand Down Expand Up @@ -65,8 +66,8 @@ jobs:
composer config minimum-stability dev
composer config prefer-stable true
composer config preferred-install dist
composer config repositories.0 path $GITHUB_WORKSPACE
composer config repositories.1 composer https://packages.drupal.org/8
composer config repositories.0 composer https://packages.drupal.org/8
composer config repositories.1 path $GITHUB_WORKSPACE
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev-pinned:${{ matrix.drupal }} --no-suggest
- name: Deal with https://lab.civicrm.org/dev/drupal/-/issues/164
# This is temporary until no longer testing anything less than 5.41. A more sophisticated way would be to make this conditional on civi version so that for 5.41+ it doesn't do this, giving a closer approximation to real installs for 5.41+, but as far as I know this is only used by compile-lib to make some bootstrap css files.
Expand Down Expand Up @@ -94,7 +95,8 @@ jobs:
run: |
mkdir $BROWSERTEST_OUTPUT_DIRECTORY
cd ~/drupal/web
../vendor/bin/phpunit -c core modules/contrib/civicrm_entity
../vendor/bin/phpunit -c core --debug --filter=testEnableNewEntityTypes modules/contrib/civicrm_entity/tests/src/FunctionalJavascript/CivicrmEntitySettingsFormTest.php
../vendor/bin/phpunit -c core --debug modules/contrib/civicrm_entity/tests/src/Kernel
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
SIMPLETEST_DB: mysql://root:@127.0.0.1:${{ job.services.mysql.ports[3306] }}/db
Expand Down
13 changes: 12 additions & 1 deletion src/SupportedEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,18 @@ public static function getInfo() {
];

static::alterEntityInfo($civicrm_entity_info);

// Check if API finds each entity type.
// Necessary for tests/civi upgrade after CiviGrant moved to extension in 5.47.
$civicrm_api = \Drupal::service('civicrm_entity.api');
$api_entity_types = $civicrm_api->get('entity', ['sequential' => FALSE]);
array_walk($api_entity_types, function(&$value) {
$value = static::getEntityNameFromCamel($value);
});
foreach ($civicrm_entity_info as $entity_type => $entity_info) {
if (!in_array($entity_info['civicrm entity name'], $api_entity_types)) {
unset($civicrm_entity_info[$entity_type]);
}
}
return $civicrm_entity_info;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/src/Kernel/CivicrmEntityTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ protected function mockCiviCrmApi(ContainerBuilder $container) {
'Conference' => 'Conference',
]);

$civicrm_api_mock->get('entity', Argument::type('array'))->willReturn([
'Event',
'Activity',
'Contact',
'Address',
]);

$container->set('civicrm_entity.api', $civicrm_api_mock->reveal());
}

Expand Down