]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/DAV/Auth/Backend/FileTest.php
9b5f1cdc4b555c6b84cd9c506bc545678cb73efe
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / DAV / Auth / Backend / FileTest.php
1 <?php
2
3 class Sabre_DAV_Auth_Backend_FileTest extends PHPUnit_Framework_TestCase {
4
5     function tearDown() {
6
7         if (file_exists(SABRE_TEMPDIR . '/filebackend')) unlink(SABRE_TEMPDIR .'/filebackend');
8
9     }
10
11     function testConstruct() {
12
13         $file = new Sabre_DAV_Auth_Backend_File();
14         $this->assertTrue($file instanceof Sabre_DAV_Auth_Backend_File);
15
16     }
17
18     /**
19      * @expectedException Sabre_DAV_Exception
20      */
21     function testLoadFileBroken() {
22
23         file_put_contents(SABRE_TEMPDIR . '/backend','user:realm:hash');
24         $file = new Sabre_DAV_Auth_Backend_File();
25         $file->loadFile(SABRE_TEMPDIR .'/backend');
26
27     }
28
29     function testLoadFile() {
30
31         file_put_contents(SABRE_TEMPDIR . '/backend','user:realm:' . md5('user:realm:password'));
32         $file = new Sabre_DAV_Auth_Backend_File();
33         $file->loadFile(SABRE_TEMPDIR . '/backend');
34
35         $this->assertFalse($file->getDigestHash('realm','blabla'));
36         $this->assertEquals(md5('user:realm:password'), $file->getDigesthash('realm','user'));
37
38     }
39
40 }