Fix tests and enable GitLabCI

Created on 9 November 2023, about 1 year ago
Updated 10 February 2024, 10 months ago

Problem/Motivation

Tests have been non-functional for a while. Tests do exist but most of them were in the wrong directory and wrong namespace to be included in automated testing, plus Drupal CI was not enabled for the module. There are 38 tests at present, their failures are listed below.

Steps to reproduce

Run tests on 2.0.x-dev HEAD.

Proposed resolution

Fix any existing tests and determine if more are needed.

Remaining tasks

  • Fix tests:
    • ✅ Functional/BakingTest OK (1 test, 12 assertions) (New, upstream)
    • ✅ Functional/ProxyControllerTest OK (6 tests, 48 assertions)
    • ✅ Functional/TicketValidationTest OK (9 tests, 106 assertions)
    • ✅ Functional/UserActionControllerTest OK (8 tests, 52 assertions)
    • ✅ Functional/UserLoginFormTest OK (6 tests, 46 assertions)
    • ✅ Kernel/ConfigHelperTest OK (3 tests, 15 assertions)
    • ✅ Unit/Controller/TicketValidationControllerTest OK (7 tests, 15 assertions)
    • Total: OK (40 tests, 294 assertions)
  • ✅ Review code to determine if more tests are needed as more features are added.
  • ✅ Enable Gitlab-CI testing pipelines

User interface changes

  • n/a

API changes

  • Cookies now handled by CASResponseCookies (see upstream branch)

Data model changes

  • n/a
📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇦🇺Australia elc

Live updates comments and jobs are added and updated live.
  • testing

    Used for Documentation issues related to testing and test development

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @elc
  • Merge request !9Issue #3400526 by ELC: Fix tests → (Merged) created by elc
  • Status changed to Needs work 10 months ago
  • 🇦🇺Australia elc

    Pushed CASResponseCookies event subscriber to 2.0.x branch prior to this to get tests working without cookie errors.

    @see https://git.drupalcode.org/project/cas_server/-/commits/2.0.x?ref_type=h...

    GitLabCI is showing errors. Did not encounter errors running offline. Here are the errors.

    There were 3 failures:
    1) Drupal\Tests\cas_server\Functional\UserActionControllerTest::testLogout
    Failed asserting that a NULL is not empty.
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
    /builds/project/cas_server/tests/src/Functional/UserActionControllerTest.php:123
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    2) Drupal\Tests\cas_server\Functional\UserLoginFormTest::testCorrectNoServiceWithTicketGrantingCookie
    Failed asserting that a NULL is not empty.
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
    /builds/project/cas_server/tests/src/Functional/UserLoginFormTest.php:158
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    3) Drupal\Tests\cas_server\Functional\UserLoginFormTest::testCorrectWithService
    Failed asserting that a NULL is not empty.
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
    /builds/project/cas_server/tests/src/Functional/UserLoginFormTest.php:208
    /builds/project/cas_server/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    FAILURES!
    Tests: 40, Assertions: 283, Failures: 3.

  • Status changed to Fixed 10 months ago
  • 🇦🇺Australia elc

    Bug discovered from unit testing: cas server site could not be in a sub-directory as the cookie path did not include the base path. Fix by setting cookie path using Url::fromUri('internal:/cas')->toString().

    Have forked off 2.1.x branch which supports only D10 and D11, using PHP8.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024