当前位置: 首页>>代码示例>>PHP>>正文


PHP Sabre_DAV_Server::broadCastEvent方法代码示例

本文整理汇总了PHP中Sabre_DAV_Server::broadCastEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_Server::broadCastEvent方法的具体用法?PHP Sabre_DAV_Server::broadCastEvent怎么用?PHP Sabre_DAV_Server::broadCastEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre_DAV_Server的用法示例。


在下文中一共展示了Sabre_DAV_Server::broadCastEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCurrentUserPrincipal

 function testCurrentUserPrincipal()
 {
     $fakeServer = new Sabre_DAV_Server();
     $plugin = new Sabre_DAV_Auth_Plugin(new Sabre_DAV_Auth_MockBackend(), 'realm');
     $fakeServer->addPlugin($plugin);
     $plugin = new Sabre_DAVACL_Plugin();
     $fakeServer->addPlugin($plugin);
     $requestedProperties = array('{DAV:}current-user-principal');
     $returnedProperties = array(200 => array(), 404 => array());
     $this->assertNull($plugin->beforeGetProperties('', new Sabre_DAV_SimpleCollection('root'), $requestedProperties, $returnedProperties));
     $this->assertEquals(1, count($returnedProperties[200]));
     $this->assertArrayHasKey('{DAV:}current-user-principal', $returnedProperties[200]);
     $this->assertInstanceOf('Sabre_DAVACL_Property_Principal', $returnedProperties[200]['{DAV:}current-user-principal']);
     $this->assertEquals(Sabre_DAVACL_Property_Principal::UNAUTHENTICATED, $returnedProperties[200]['{DAV:}current-user-principal']->getType());
     // This will force the login
     $fakeServer->broadCastEvent('beforeMethod', array('GET', ''));
     $requestedProperties = array('{DAV:}current-user-principal');
     $returnedProperties = array(200 => array(), 404 => array());
     $this->assertNull($plugin->beforeGetProperties('', new Sabre_DAV_SimpleCollection('root'), $requestedProperties, $returnedProperties));
     $this->assertEquals(1, count($returnedProperties[200]));
     $this->assertArrayHasKey('{DAV:}current-user-principal', $returnedProperties[200]);
     $this->assertInstanceOf('Sabre_DAVACL_Property_Principal', $returnedProperties[200]['{DAV:}current-user-principal']);
     $this->assertEquals(Sabre_DAVACL_Property_Principal::HREF, $returnedProperties[200]['{DAV:}current-user-principal']->getType());
     $this->assertEquals('principals/admin/', $returnedProperties[200]['{DAV:}current-user-principal']->getHref());
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:25,代码来源:PluginPropertiesTest.php

示例2: testAuthenticateFail

 /**
  * @depends testInit
  * @expectedException Sabre_DAV_Exception_NotAuthenticated
  */
 function testAuthenticateFail()
 {
     $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleDirectory('bla')));
     $plugin = new Sabre_DAV_Auth_Plugin(new Sabre_DAV_Auth_MockBackend(), 'failme');
     $fakeServer->addPlugin($plugin);
     $fakeServer->broadCastEvent('beforeMethod', array('GET', '/'));
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:11,代码来源:PluginTest.php

示例3: testGetCurrentUserPrincipal

 /**
  * @depends testInit
  */
 function testGetCurrentUserPrincipal()
 {
     $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleDirectory('bla')));
     $plugin = new Sabre_DAV_Auth_Plugin(new Sabre_DAV_Auth_MockBackend(), 'realm');
     $fakeServer->addPlugin($plugin);
     $fakeServer->broadCastEvent('beforeMethod', array('GET', '/'));
     $this->assertEquals('admin', $plugin->getCurrentUser());
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:11,代码来源:PluginTest.php


注:本文中的Sabre_DAV_Server::broadCastEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。