/** * Test successful login. * * @return void */ public function testLogin() { $response = ['cat_username' => 'testuser', 'cat_password' => 'testpass', 'email' => '*****@*****.**']; $this->driver->expects($this->once())->method('patronLogin')->with($this->equalTo('testuser'), $this->equalTo('testpass'))->will($this->returnValue($response)); $user = $this->auth->authenticate($this->getLoginRequest()); $this->assertEquals('testuser', $user->username); $this->assertEquals('*****@*****.**', $user->email); }
/** * Set the ILS connection for this object. * * @param \VuFind\ILS\Connection $connection ILS connection to set * * @return void */ public function setCatalog(\VuFind\ILS\Connection $connection) { // Right now, MultiILS authentication only works with the MultiBackend // driver; if other ILS drivers eventually support this option, we // should define an interface containing getLoginDrivers() and // getDefaultLoginDriver(). if (!$connection->getDriver() instanceof MultiBackend) { throw new \Exception('MultiILS authentication requires MultiBackend ILS driver.'); } return parent::setCatalog($connection); }