simplesamlphp / simplesamlphp/simplesamlphp-test-framework

test module with redirectTrustedURL

Open
#3 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I am trying to write some unit tests to https://github.com/simplesamlphp/simplesamlphp-module-expirycheck/

is it possible to test Auth\ProcessingFilter in a module which uses a $httpUtils->redirectTrustedURL?

$filter->process($request);

https://github.com/simplesamlphp/simplesamlphp-module-expirycheck/blob/211ed0f229df807e3def38d55d1a42c89e406a04/src/Auth/Process/ExpiryDate.php#L191

throws this exception

InvalidArgumentException: Unable to parse base url: http://localhost

/xxx/simplesamlphp-module-expirycheck/vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php:1011
/xxx/simplesamlphp-module-expirycheck/vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php:886
/xxx/simplesamlphp-module-expirycheck/vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Utils/HTTP.php:954
/xxx/simplesamlphp-module-expirycheck/src/Auth/Process/ExpiryDate.php:191
/xxx/simplesamlphp-module-expirycheck/tests/src/Auth/Process/ExpiryDateTest.php:170

ERRORS!
Tests: 17, Assertions: 40, Errors: 1, Warnings: 1.

any help is welcome

Regards

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure in tests/src/Auth/Process/ExpiryDateTest.php, then trace the call from src/Auth/Process/ExpiryDate.php:191 into SimpleSAML/Utils/HTTP.php:1011. Check the test framework setup around redirectTrustedURL and define done as the unit test completing without the InvalidArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.