Skip to content

cirrusidentity/simplesamlphp-module-cirrusexample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

simplesamlphp-module-cirrusexample

Examples of doing things in an SSP module

Mocking/Stubs/Doubles

One challenge of unit testing SSP related code is that there can be a lot of static calls, some of which exit the program. Other components may use a class instance but don't support dependency injection so you can't isolate the class under test from other components. Aspect Mock allows you to stub/mock the behavior of static methods and of calls to a class instance.

The most important configuration steps are in bootstrap.php. We must define the AspectMock kernel and tell it which classes are eligible for mocking/stubbing (the includePaths section). AspectMock seems to have trouble with SSP's custom naming scheme for module classes (sspmod_MODULENAME_etc) and you may need to add those classes explicitly via loadFile

Autoloading + Enable file

During tests the SSP autoloader needs to know about your module. It must be in vendor/simplesamlphp/simplesamlphp/modules/MODULE_NAME so the tests/bootstrap.php symlinks the project into the modules directory.

There must also be an enable file in the root of the project for the SSP autoloader to load the classes. touch enable

About

Examples of doing things in an SSP module

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages