コード例 #1
0
ファイル: AuthTest.php プロジェクト: fproject/phpamf
 public function testLogout()
 {
     \fproject\amf\session\Session::$_unitTestEnabled = true;
     $this->_server->setAuth(new RightPassword("testuser", "testrole"));
     $this->_acl->addRole(new \fproject\amf\acl\Role("testrole"));
     $this->_acl->allow("testrole", null, null);
     $this->_server->setAcl($this->_acl);
     $resp = $this->_callServiceAuth("testuser", "");
     $this->assertTrue($resp[0]->getData() instanceof AcknowledgeMessage);
     $this->assertContains("hello", $resp[1]->getData());
     // After logout same request should not be allowed
     $this->setUp();
     $this->_server->setAuth(new RightPassword("testuser", "testrole"));
     $this->_server->setAcl($this->_acl);
     $request = new Request();
     $request->setObjectEncoding(0x3);
     $this->_addLogout($request);
     $this->_addServiceCall($request);
     $this->_server->handle($request);
     $resp = $this->_server->getResponse()->getAmfBodies();
     $this->assertTrue($resp[0]->getData() instanceof AcknowledgeMessage);
     $data = $resp[1]->getData();
     $this->assertTrue($data instanceof ErrorMessage);
     $this->assertContains("not allowed", $data->faultString);
 }
コード例 #2
0
ファイル: ServerTest.php プロジェクト: fproject/phpamf
 /** @group ZF-11529 */
 public function testSettingAuthAdapterWithAclWhenServerAclAlreadyPopulatedWillNotChangeServerAcl()
 {
     $acl = new \fproject\amf\acl\Acl();
     $this->_server->setAcl($acl);
     $aclFile = dirname(__FILE__) . '/_files/acl.xml';
     $authAdapter = new XmlAuth($aclFile);
     $this->_server->setAuth($authAdapter);
     $this->assertNotSame($authAdapter->getAcl(), $this->_server->getAcl());
     $this->assertSame($acl, $this->_server->getAcl());
 }