Skip to content

Test all the things!

Andrew Hoffmann requested to merge ahoffmann/uw-php-security:preauth-test into master

This merge request improves the code coverage of the project's unit tests.

I broke up this rather large set of changes into separate commits. See the individual commit messages for details.

  • 75773b6d - Use PHPUnit provided by Composer instead of downloading a PHAR
  • 737771f2 - Convert dashes to underscores when converting to HTTP headers
  • 08aaa966 - Group conditional logic for clarity
  • 1477621c - Create missing tests for PreauthUserDetailsProvider, introduce an EnvironmentHelper
  • b74fd618 - Federated preauth tests made consistent with new preauth tests, improved coverage, moved test data from JSON to source code
  • 09d36d36 - LocalUserDetailsProvider throws Exception if JSON is invalid, returns null if JSON is missing
  • d021fd72 - Verify missing attributes are set as false
  • e29430a9 - Docblock and PSR-2 formatting improvements

PHP Trait

In 1477621c, I introduced a lesser-known feature of PHP called a trait. It allows one to "inject" common methods into any class without requiring inheritance.

@andrew-summers @weizhong-wang @KJOYNER

Merge request reports