Skip to content
Snippets Groups Projects
Commit a695da53 authored by Andy Summers's avatar Andy Summers
Browse files

Add PHPDocs, make PHPUnit a Composer dependency

parent 68561514
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
"source": "https://git.doit.wisc.edu/adi-ia/uw-php-security"
},
"require-dev": {
"phpunit/phpunit": "^5.4"
},
"autoload": {
"psr-4": {
......
This diff is collapsed.
File added
......@@ -3,7 +3,8 @@
namespace edu\wisc\doit;
/**
*
* UserDetailsAttributeMapper defines an interface for mapping common UW user attributes to an associative array. The
* constants defined in this interface represent headers sent by UW Federated login that identify a user.
*/
interface UserDetailsAttributeMapper
{
......
......@@ -3,7 +3,8 @@
namespace edu\wisc\doit;
/**
*
* UserDetailsService is the interface that provides an instance of {@link UserDetails}, typically a {@link UWUserDetails}.
* Two concrete implementations are provided, {@link LocalUserDetailsService} and {@link PreauthUserDetailsService}.
*/
interface UserDetailsService
{
......
......@@ -8,9 +8,17 @@ namespace edu\wisc\doit;
class PreauthUserDetailsServiceTest extends PreauthTestCase
{
/** @var UserDetailsService */
private $userService;
protected function setUp()
{
parent::setUp();
$this->userService = new PreauthUserDetailsService();
}
public function testLoadUser() {
$userService = new PreauthUserDetailsService();
$user = $userService->loadUser();
$user = $this->userService->loadUser();
$this->assertNotNull($user);
$this->assertEquals("bbadger@wisc.edu", $user->getEppn());
$this->assertEquals("UW123A456", $user->getPvi());
......@@ -22,4 +30,11 @@ class PreauthUserDetailsServiceTest extends PreauthTestCase
$this->assertEquals("BADGER", $user->getLastName());
}
public function testLoadUserWithNoEPPN() {
// Clear EPPN to simulate no EPPN
$_SERVER[UserDetailsAttributeMapper::EPPN] = null;
$user = $this->userService->loadUser();
$this->assertNull($user);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment