ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilWACPathTest.php
Go to the documentation of this file.
1 <?php
2 // declare(strict_types=1);
3 
4 require_once('./libs/composer/vendor/autoload.php');
5 
7 
21 class ilWACPathTest extends MockeryTestCase
22 {
23 
27  protected function setUp()
28  {
29  require_once('./Services/WebAccessChecker/classes/class.ilWACPath.php');
30  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
31 
32  //setup container for HttpServiceAware classes
33  /*
34  $container = new \ILIAS\DI\Container();
35  $container['http'] = function ($c) {
36  return Mockery::mock(GlobalHttpState::class);
37  };
38 
39 
40  $GLOBALS["DIC"] = $container; */
41 
42  parent::setUp();
43  }
44 
45 
46  public function testMobs()
47  {
48  $ilWacPath = new ilWACPath('http://trunk.local/data/trunk/mobs/mm_270/Koeniz_Komturei1.jpg');
49  $this->assertEquals('mobs', $ilWacPath->getModuleType());
50  $this->assertEquals('mm_270', $ilWacPath->getModuleIdentifier());
51  $this->assertEquals('Koeniz_Komturei1.jpg', $ilWacPath->getAppendix());
52  $this->assertEquals('trunk', $ilWacPath->getClient());
53  $this->assertFalse($ilWacPath->isInSecFolder());
54  $this->assertFalse($ilWacPath->isStreamable());
55  $this->assertFalse($ilWacPath->isVideo());
56  $this->assertFalse($ilWacPath->isAudio());
57  }
58 
59 
60  public function testUserImage()
61  {
62  $ilWacPath = new ilWACPath('http://trunk.local/data/trunk/usr_images/usr_6_small.jpg?t=63944');
63  $this->assertEquals('usr_images', $ilWacPath->getModuleType());
64  $this->assertEquals('./data/trunk/usr_images/', $ilWacPath->getModulePath());
65  $this->assertEquals(null, $ilWacPath->getModuleIdentifier());
66  $this->assertEquals('usr_6_small.jpg', $ilWacPath->getAppendix());
67  $this->assertEquals('trunk', $ilWacPath->getClient());
68  $this->assertFalse($ilWacPath->isInSecFolder());
69  $this->assertFalse($ilWacPath->isStreamable());
70  $this->assertFalse($ilWacPath->isVideo());
71  $this->assertFalse($ilWacPath->isAudio());
72  }
73 
74 
75  public function testBlogInSec()
76  {
77  $ilWacPath = new ilWACPath('http://trunk.local/data/trunk/sec/ilBlog/blog_123/Header.mp4');
78  $this->assertEquals('ilBlog', $ilWacPath->getModuleType());
79  $this->assertEquals('./data/trunk/sec/ilBlog/', $ilWacPath->getModulePath());
80  $this->assertEquals('blog_123', $ilWacPath->getModuleIdentifier());
81  $this->assertEquals('Header.mp4', $ilWacPath->getAppendix());
82  $this->assertEquals('trunk', $ilWacPath->getClient());
83  $this->assertTrue($ilWacPath->isInSecFolder());
84  $this->assertTrue($ilWacPath->isStreamable());
85  $this->assertTrue($ilWacPath->isVideo());
86  $this->assertFalse($ilWacPath->isAudio());
87  }
88 
89 
90  public function testSubfolders()
91  {
92  $ilWacPathBase = new ilWACPath('http://trunk.local/data/trunk/lm_data/lm_123456/start.html');
93  $ilWacPathSub = new ilWACPath('http://trunk.local/data/trunk/lm_data/lm_123456/subfolder/image.png');
94  $this->assertEquals($ilWacPathBase->getModulePath(), $ilWacPathSub->getModulePath());
95  }
96 }
setUp()
Setup.
TestCase for the ilWACCheckingInstanceTest.
Class ilWACPath.