Browse Source

Adding a couple assertions to test the new AuthComponent methods

Jose Lorenzo Rodriguez 11 years ago
parent
commit
e53f572565

+ 1 - 1
src/Controller/Component/AuthComponent.php

@@ -821,6 +821,6 @@ class AuthComponent extends Component {
  * @return \Cake\Auth\BaseAuthorize|null
  */
 	public function authorizationProvider() {
-		return $this->_authenticateProvider;
+		return $this->_authorizationProvider;
 	}
 }

+ 2 - 0
tests/TestCase/Controller/Component/AuthComponentTest.php

@@ -175,6 +175,7 @@ class AuthComponentTest extends TestCase {
 
 		$this->assertTrue((bool)$this->Auth->user());
 		$this->assertEquals($user, $this->Auth->user());
+		$this->assertSame($AuthLoginFormAuthenticate, $this->Auth->loginProvider());
 	}
 
 /**
@@ -273,6 +274,7 @@ class AuthComponentTest extends TestCase {
 			->method('authorize');
 
 		$this->assertTrue($this->Auth->isAuthorized(array('User'), $request));
+		$this->assertSame($AuthMockTwoAuthorize, $this->Auth->authorizationProvider());
 	}
 
 /**