ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
FileTest.php
Go to the documentation of this file.
1<?php
2
4
6
7 function tearDown() {
8
9 if (file_exists(SABRE_TEMPDIR . '/filebackend')) unlink(SABRE_TEMPDIR . '/filebackend');
10
11 }
12
13 function testConstruct() {
14
15 $file = new File();
16 $this->assertTrue($file instanceof File);
17
18 }
19
23 function testLoadFileBroken() {
24
25 file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:hash');
26 $file = new File(SABRE_TEMPDIR . '/backend');
27
28 }
29
30 function testLoadFile() {
31
32 file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:' . md5('user:realm:password'));
33 $file = new File();
34 $file->loadFile(SABRE_TEMPDIR . '/backend');
35
36 $this->assertFalse($file->getDigestHash('realm', 'blabla'));
37 $this->assertEquals(md5('user:realm:password'), $file->getDigestHash('realm', 'user'));
38
39 }
40
41}
An exception for terminatinating execution or to throw for unit testing.
testLoadFileBroken()
@expectedException Sabre\DAV\Exception
Definition: FileTest.php:23
This is an authentication backend that uses a file to manage passwords.
Definition: File.php:16