ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Test\ImportHandler\File\ilHandlerTest Class Reference
+ Inheritance diagram for Test\ImportHandler\File\ilHandlerTest:
+ Collaboration diagram for Test\ImportHandler\File\ilHandlerTest:

Public Member Functions

 testFileHandler ()
 

Detailed Description

Definition at line 29 of file ilHandlerTest.php.

Member Function Documentation

◆ testFileHandler()

Test\ImportHandler\File\ilHandlerTest::testFileHandler ( )

Definition at line 31 of file ilHandlerTest.php.

References $namespace.

31  : void
32  {
33  $file_name = 'TestFile.test';
34  $file_dir = 'A' . DIRECTORY_SEPARATOR
35  . 'B' . DIRECTORY_SEPARATOR
36  . 'C';
37  $file_path = $file_dir . DIRECTORY_SEPARATOR . $file_name;
38  $namespaces = $this->createMock(ilFileNamespaceCollection::class);
39 
40  $namespace = $this->createMock(ilFileNamespaceFactory::class);
41  $namespace->expects($this->any())->method('collection')->willReturn($namespaces);
42 
43  $file_info = $this->createMock(SplFileInfo::class);
44  $file_info->expects($this->any())->method('getFilename')->willReturn($file_name);
45  $file_info->expects($this->any())->method('getRealPath')->willReturn(false);
46  $file_info->expects($this->any())->method('getPath')->willReturn($file_dir);
47 
48  $file_handler = new ilFileHandler($namespace);
49  $file_handler = $file_handler->withFileInfo($file_info);
50 
51  $this->assertEquals($file_path, $file_handler->getFilePath());
52  $this->assertFalse($file_handler->fileExists());
53  $this->assertEquals($file_name, $file_handler->getFileName());
54  $this->assertEquals($namespaces, $file_handler->getNamespaces());
55  $this->assertTrue($file_handler->pathContainsFolderName('A'));
56  $this->assertTrue($file_handler->pathContainsFolderName('B'));
57  $this->assertTrue($file_handler->pathContainsFolderName('C'));
58  $this->assertFalse($file_handler->pathContainsFolderName('D'));
59  $this->assertFalse($file_handler->pathContainsFolderName('E'));
60  $this->assertEquals('B/C/TestFile.test', $file_handler->getSubPathToDirBeginningAtPathEnd('B')->getFilePath());
61  $this->assertEquals('A/B', $file_handler->getSubPathToDirBeginningAtPathStart('B')->getFilePath());
62  $this->assertEquals($file_dir, $file_handler->getPathToFileLocation());
63  $this->assertEquals('C', $file_handler->getPathPart("/C/"));
64  }
if($err=$client->getError()) $namespace

The documentation for this class was generated from the following file: