Verified Commit 068fac07 authored by tuutti's avatar tuutti
Browse files

Issue #3261371: Fixed failing tests, migrated from gitlab to github

parent c1ce8054
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
on: [push]
name: CI
env:
  MYSQL_ROOT_PASSWORD: drupal
  SIMPLETEST_DB: "mysql://drupal:drupal@mariadb:3306/drupal"
  SIMPLETEST_BASE_URL: "http://127.0.0.1:8080"
  DRUPAL_MODULE_NAME: "commerce_klarna_payments"
  DRUPAL_CORE_VERSION: 9.3.x
jobs:
  test-contrib:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        php-version: ['7.4', '8.0', '8.1']
    container:
      image: ghcr.io/tuutti/drupal-php-docker:${{ matrix.php-version }}

    services:
      mariadb:
        image: mariadb:10.5
        env:
          MYSQL_USER: drupal
          MYSQL_PASSWORD: drupal
          MYSQL_DATABASE: drupal
          MYSQL_ROOT_PASSWORD: drupal
        ports:
          - 3306:3306
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 1

      - name: Set variables
        run: |
          echo "$HOME/.config/composer/vendor/bin" >> $GITHUB_PATH

      - name: Setup Drupal test runner
        run: |
          composer global require tuutti/drupal-test-runner ~1.0

      - name: Setup Drupal
        run: |
          drupal-tr

      - name: Run tests
        run: TEST_RUNNER=core drupal-tr run-tests

.gitlab-ci.yml

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
variables:
  DRUPAL_MODULE_NAME: commerce_klarna_payments
  SIMPLETEST_BASE_URL: http://127.0.0.1:8080
  DRUPAL_CORE_VERSION: 8.9.x
  DRUPAL_INSTALL_PROFILE: minimal
  MYSQL_DATABASE: drupal
  MYSQL_ROOT_PASSWORD: drupal
  SIMPLETEST_DB: mysql://root:drupal@mariadb/drupal
  TEST_RUNNER: core
  SYMFONY_DEPRECATIONS_HELPER: disabled

before_script:
- export PATH=$HOME/.composer/vendor/bin:$PATH
- composer global require tuutti/drupal-test-runner ^1.0
- drupal-tr
- drupal-tr run-drush-server &

services:
- mariadb:latest

test:7.3:
  image: registry.gitlab.com/tuutti/drupal-php-docker:7.3
  script:
    - drupal-tr run-tests

test:7.4:
  image: registry.gitlab.com/tuutti/drupal-php-docker:7.4
  variables:
    DRUPAL_CORE_VERSION: 9.1.x
  script:
    - drupal-tr run-tests

test:8.0:
  image: registry.gitlab.com/tuutti/drupal-php-docker:8.0
  variables:
    DRUPAL_CORE_VERSION: 9.2.x
  script:
    - drupal-tr run-tests
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@


      handleAuthorizationResponse(response) {
        // Reset authorization attempted in case user closes the
        // Reset authorization attempted state if user closes the
        // popup.
        if (response.show_form && !response.approved) {
          this.update({ authorizationAttempted: false })
@@ -52,7 +52,7 @@
          this.state.tokenElement
            .setAttribute('value', response.authorization_token)

          // Submit form to redirect to complete page.
          // Submit form to redirect to order completion page.
          document.querySelector('.payment-redirect-form').submit();
        }
      },
+2 −2
Original line number Diff line number Diff line
@@ -177,14 +177,14 @@ class OrderTransitionSubscriber implements EventSubscriberInterface {
      return;
    }

    // Substract completed payments from total remaining balance.
    // Subtract completed payments from total remaining balance.
    foreach ($this->paymentStorage->loadMultipleByOrder($order) as $payment) {
      if ($payment->isCompleted()) {
        $remainingBalance = $remainingBalance->subtract($payment->getAmount());
      }
    }

    // Create capture with remaining balanace.
    // Create capture with remaining balance.
    if (!$remainingBalance->isZero() && $remainingBalance->isPositive()) {
      // Attempt to use local payment made in Klarna::onReturn().
      $payment = $this->getPayment($order) ?? $plugin->createPayment($order);
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ abstract class KlarnaKernelBase extends EntityKernelTestBase {
  /**
   * {@inheritdoc}
   */
  public static $modules = [
  protected static $modules = [
    'entity_reference_revisions',
    'profile',
    'path',
Loading