Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove drupal 10 hack in unit tests #932

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,10 @@ jobs:
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require civicrm/civicrm-asset-plugin:'~1.1' civicrm/civicrm-{core,packages,drupal-8}:${{ matrix.civicrm }} -W
- name: Ensure Webform ^6.2
if: ${{ matrix.drupal == '10.0.*' }}
- name: Download Webform
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:^6.2@beta'
- name: Ensure Webform ^6.0
if: ${{ matrix.drupal != '10.0.*' }}
run: |
cd ~/drupal
#COMPOSER_MEMORY_LIMIT=-1 composer require cweagans/composer-patches
#jq '.extra.patches = {"drupal/webform": {"Regression": "https://www.drupal.org/files/issues/2021-12-13/3254028-2.patch"}}' composer.json > temp.json && mv temp.json composer.json
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:6.x-dev@dev'
COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/webform:^6.2'
- name: Install webform_civicrm
run: |
cd ~/drupal
Expand Down Expand Up @@ -152,26 +144,17 @@ jobs:
./vendor/drush/drush/drush -y -l http://civi.localhost site-install standard --db-url='mysql://root:@127.0.0.1:${{ job.services.mysql.ports[3306] }}/fakedb' --site-name=FakeCivi
chmod +w web/sites/default
/home/runner/civicrm-cv/cv core:install --cms-base-url=http://civi.localhost
- name: Download Civi extensions from git
if: ${{ matrix.drupal == '10.0.*' }}
run: |
mkdir -p ~/drupal/web/sites/default/files/civicrm/ext
cd ~/drupal/web/sites/default/files/civicrm/ext
/home/runner/civicrm-cv/cv api3 Extension.download install=0 key=com.aghstrategies.uscounties
# Let's get latest git versions of these
git clone https://lab.civicrm.org/extensions/mjwshared.git
git clone https://lab.civicrm.org/extensions/firewall.git
git clone https://lab.civicrm.org/extensions/stripe.git
git clone https://github.com/iATSPayments/com.iatspayments.civicrm.git
- name: Download Civi extensions normal
if: ${{ matrix.drupal != '10.0.*' }}
- name: Download Civi extensions
run: |
mkdir -p ~/drupal/web/sites/default/files/civicrm/ext
cd ~/drupal/web/sites/default/files/civicrm/ext
# Normally we'll just let civi decide which version to download.
# Allow "unapproved" extensions
/home/runner/civicrm-cv/cv ev '\Civi::settings()->set("ext_repo_url", "https://civicrm.org/extdir/ver={ver}|cms={uf}|ready=");'
/home/runner/civicrm-cv/cv ev '\Civi::settings()->set("http_timeout", 60);'
# Apparently we have to install it, otherwise stripe gives a dependency error even with install=0. I think that's a bug, but let's just do it. This is a fake install anyway.
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=mjwshared
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=firewall
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=mjwpaymentapi
/home/runner/civicrm-cv/cv api3 Extension.download install=1 key=com.drastikbydesign.stripe
/home/runner/civicrm-cv/cv api3 Extension.download install=0 key=com.iatspayments.civicrm
/home/runner/civicrm-cv/cv api3 Extension.download install=0 key=com.aghstrategies.uscounties
Expand Down
25 changes: 1 addition & 24 deletions tests/src/FunctionalJavascript/ExistingContactElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,7 @@ public function testTokensInEmail() {
$this->assertStringContainsString('frederick@pabst.io', $sent_email[0]['to']);

// Verify tokens are rendered correctly.
if (version_compare(\Drupal::VERSION, '10', '>=')) {
$this->assertEquals("Submitted Values Are -
$this->assertEquals("Submitted Values Are -

-------- Contact 1
-----------------------------------------------------------
Expand All @@ -376,28 +375,6 @@ public function testTokensInEmail() {

[1] mailto:frederick@pabst.io
", $sent_email[0]['body']);
}
else {
// Verify tokens are rendered correctly.
$this->assertEquals("Submitted Values Are -
-------- Contact 1
-----------------------------------------------------------

*Existing Contact*
Frederick Pabst
*First Name*
Frederick
*Last Name*
Pabst
*Email*
frederick@pabst.io [1]
Existing Contact - Frederick Pabst. Activity 1 ID - {$actID1}. Activity 2 ID - {$actID2}.
Webform CiviCRM Contacts IDs - {$this->rootUserCid}. Webform CiviCRM Contacts Links -
{$cidURL}.

[1] mailto:frederick@pabst.io
", $sent_email[0]['body']);
}
}

}
2 changes: 1 addition & 1 deletion tests/src/FunctionalJavascript/StripeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class StripeTest extends WebformCivicrmTestBase {
protected function setUp(): void {
parent::setUp();

$this->setUpExtension('mjwshared,firewall,com.drastikbydesign.stripe');
$this->setUpExtension('mjwshared,firewall,mjwpaymentapi,com.drastikbydesign.stripe');

$params = [];
$result = $this->utils->wf_civicrm_api('Stripe', 'setuptest', $params);
Expand Down
19 changes: 7 additions & 12 deletions tests/src/FunctionalJavascript/WebformCivicrmTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,18 +752,13 @@ public function fillCKEditor($locator, $value) {
}

// Fill value on the wysiwyg editor.
if (version_compare(\Drupal::VERSION, '10', '>=')) {
$this->getSession()->executeScript("
const element = document.getElementById(\"$fieldId\");
const editor = Drupal.CKEditor5Instances.get(
element.getAttribute('data-ckeditor5-id'),
);
editor.setData(\"$value\");
");
}
else {
$this->getSession()->executeScript("CKEDITOR.instances[\"$fieldId\"].setData(\"$value\");");
}
$this->getSession()->executeScript("
const element = document.getElementById(\"$fieldId\");
const editor = Drupal.CKEditor5Instances.get(
element.getAttribute('data-ckeditor5-id'),
);
editor.setData(\"$value\");
");
}

/**
Expand Down