本文整理汇总了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());
}
示例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', '/'));
}
示例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());
}