TestCase for the ilWACTokenTest.  
 More...
TestCase for the ilWACTokenTest. 
- Author
 - Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch 
 
- Version
 - 1.0.0
 
disabled  disabled  disabled 
Definition at line 42 of file ilWACTokenTestTBD.php.
 
◆ getModifiedSignedPath()
  
  
      
        
          | ilWACTokenTest::getModifiedSignedPath  | 
          ( | 
          int  | 
          $add_ttl = 0,  | 
         
        
           | 
           | 
          int  | 
          $add_timestamp = 0,  | 
         
        
           | 
           | 
            | 
          $override_token = null  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protected   | 
  
 
- Parameters
 - 
  
  
 
Definition at line 351 of file ilWACTokenTestTBD.php.
References $parts, $path, $token, ILIAS\Repository\int(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().
Referenced by testModifiedTimestampAddTime(), testModifiedTimestampNoMod(), testModifiedTimestampSubTime(), testModifiedToken(), testModifiedTTL(), and testModifiedTTLAndTimestamp().
  356         $parts = parse_url($signed_path);
   357         $path = $parts[
'path'];
   358         $query = $parts[
'query'];
   359         parse_str($query, $query_array);
   360         $token = $override_token ? $override_token : $query_array[
'il_wac_token'];
   361         $ttl = (
int) $query_array[
'il_wac_ttl'];
   362         $ts = (
int) $query_array[
'il_wac_ts'];
   363         $path_with_token = 
$path . 
'?il_wac_token=' . 
$token;
   365         $modified_ttl = $ttl + $add_ttl;
   366         $modified_ts = $ts + $add_timestamp;
   368         return $path_with_token . 
'&il_wac_ttl=' . $modified_ttl . 
'&il_wac_ts=' . $modified_ts;
 if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
 
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
 
static signFile(string $path_to_file)
 
 
 
 
◆ setUp()
  
  
      
        
          | ilWACTokenTest::setUp  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Setup. 
Definition at line 93 of file ilWACTokenTestTBD.php.
References $c, $container, $GLOBALS, ILIAS\FileDelivery\http(), and ilWACToken\setSALT().
   97         $this->root = vfs\vfsStream::setup(
'ilias.de');
    98         $this->file_one = vfs\vfsStream::newFile(
'data/client_name/mobs/mm_123/dummy.jpg')
    99                                        ->at($this->root)->setContent(
'dummy');
   100         $this->file_one_subfolder = vfs\vfsStream::newFile(
'data/client_name/mobs/mm_123/mobile/dummy.jpg')
   101                                                  ->at($this->root)->setContent(
'dummy');
   102         $this->file_one_subfolder_two = vfs\vfsStream::newFile(
'data/client_name/mobs/mm_123/mobile/device/dummy.jpg')
   103                                                      ->at($this->root)->setContent(
'dummy');
   104         $this->file_two = vfs\vfsStream::newFile(
'data/client_name/mobs/mm_123/dummy2.jpg')
   105                                        ->at($this->root)->setContent(
'dummy2');
   106         $this->file_three = vfs\vfsStream::newFile(
'data/client_name/mobs/mm_124/dummy.jpg')
   107                                          ->at($this->root)->setContent(
'dummy');
   108         $this->file_four = vfs\vfsStream::newFile(
'data/client_name/sec/ilBlog/mm_124/dummy.jpg')
   109                                         ->at($this->root)->setContent(
'dummy');
   113         $container[
'http'] = fn(
$c) => Mockery::mock(GlobalHttpState::class);
   120         $this->cookieFactory = Mockery::mock(CookieFactoryImpl::class);
   123         $this->cookieFactory->shouldDeferMissing();
 static setSALT(string $salt)
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testCookieGeneration()
      
        
          | ilWACTokenTest::testCookieGeneration  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 197 of file ilWACTokenTestTBD.php.
References $response, ILIAS\FileDelivery\http(), and ilWACSignedPath\signFolderOfStartFile().
  199         $this->markTestSkipped(
'unable to use http cookies at this point');
   201         $cookieJar = Mockery::mock(CookieJar::class);
   203         $response = Mockery::mock(ResponseInterface::class);
   206             ->shouldReceive(
'response')
   213             ->shouldReceive(
'with')
   219             ->shouldReceive(
'with')
   225             ->shouldReceive(
'with')
   231         $this->
http->shouldReceive(
'cookieJar')
   233             ->andReturn($cookieJar);
 
static http()
Fetches the global http state from ILIAS. 
 
static signFolderOfStartFile(string $start_file_path)
 
 
 
 
◆ testFileToken()
      
        
          | ilWACTokenTest::testFileToken  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 245 of file ilWACTokenTestTBD.php.
References CLIENT_NAME, ilWACSignedPath\getTokenMaxLifetimeInSeconds(), ILIAS\FileDelivery\http(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().
  247         $this->markTestSkipped(
"Failed for some unknown reason.");
   255         $this->assertTrue($ilWACSignedPath->isSignedPath());
   256         $this->assertTrue($ilWACSignedPath->isSignedPathValid());
   257         $this->assertEquals($ilWACSignedPath->getPathObject()->getClient(), 
self::CLIENT_NAME);
   258         $this->assertFalse($ilWACSignedPath->getPathObject()->isInSecFolder());
   259         $this->assertTrue($ilWACSignedPath->getPathObject()->isImage());
   260         $this->assertFalse($ilWACSignedPath->getPathObject()->isAudio());
   261         $this->assertFalse($ilWACSignedPath->getPathObject()->isVideo());
   262         $this->assertTrue($ilWACSignedPath->getPathObject()->hasTimestamp());
   263         $this->assertTrue($ilWACSignedPath->getPathObject()->hasToken());
   267         sleep($lifetime + self::ADDITIONAL_TIME);
   269         $this->assertTrue($ilWACSignedPath->isSignedPath());
   270         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
 
static http()
Fetches the global http state from ILIAS. 
 
static signFile(string $path_to_file)
 
static getTokenMaxLifetimeInSeconds()
 
 
 
 
◆ testModifiedTimestampAddTime()
      
        
          | ilWACTokenTest::testModifiedTimestampAddTime  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 292 of file ilWACTokenTestTBD.php.
References getModifiedSignedPath(), and ILIAS\FileDelivery\http().
  294         $this->markTestSkipped(
"Failed for some unknown reason.");
   298         $this->assertTrue($ilWACSignedPath->isSignedPath());
   299         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
 
getModifiedSignedPath(int $add_ttl=0, int $add_timestamp=0, $override_token=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testModifiedTimestampNoMod()
      
        
          | ilWACTokenTest::testModifiedTimestampNoMod  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 278 of file ilWACTokenTestTBD.php.
References getModifiedSignedPath(), and ILIAS\FileDelivery\http().
  280         $this->markTestSkipped(
"Failed for some unknown reason.");
   284         $this->assertTrue($ilWACSignedPath->isSignedPath());
   285         $this->assertTrue($ilWACSignedPath->isSignedPathValid());
 
getModifiedSignedPath(int $add_ttl=0, int $add_timestamp=0, $override_token=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testModifiedTimestampSubTime()
      
        
          | ilWACTokenTest::testModifiedTimestampSubTime  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 303 of file ilWACTokenTestTBD.php.
References getModifiedSignedPath(), and ILIAS\FileDelivery\http().
  305         $this->markTestSkipped(
"Failed for some unknown reason.");
   309                                                                                           * -1, 0)), $this->
http, $this->cookieFactory);
   310         $this->assertTrue($ilWACSignedPath->isSignedPath());
   311         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
 
getModifiedSignedPath(int $add_ttl=0, int $add_timestamp=0, $override_token=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testModifiedToken()
      
        
          | ilWACTokenTest::testModifiedToken  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 337 of file ilWACTokenTestTBD.php.
References getModifiedSignedPath(), and ILIAS\FileDelivery\http().
  339         $this->markTestSkipped(
"Failed for some unknown reason.");
   343         $this->assertTrue($ilWACSignedPath->isSignedPath());
   344         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
 
getModifiedSignedPath(int $add_ttl=0, int $add_timestamp=0, $override_token=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testModifiedTTL()
      
        
          | ilWACTokenTest::testModifiedTTL  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 315 of file ilWACTokenTestTBD.php.
References getModifiedSignedPath(), and ILIAS\FileDelivery\http().
  317         $this->markTestSkipped(
"Failed for some unknown reason.");
   321         $this->assertTrue($ilWACSignedPath->isSignedPath());
   322         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
 
getModifiedSignedPath(int $add_ttl=0, int $add_timestamp=0, $override_token=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testModifiedTTLAndTimestamp()
      
        
          | ilWACTokenTest::testModifiedTTLAndTimestamp  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 326 of file ilWACTokenTestTBD.php.
References getModifiedSignedPath(), and ILIAS\FileDelivery\http().
  328         $this->markTestSkipped(
"Failed for some unknown reason.");
   332         $this->assertTrue($ilWACSignedPath->isSignedPath());
   333         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
 
getModifiedSignedPath(int $add_ttl=0, int $add_timestamp=0, $override_token=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testSomeBasics()
      
        
          | ilWACTokenTest::testSomeBasics  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 163 of file ilWACTokenTestTBD.php.
References CLIENT_NAME, and ILIAS\FileDelivery\http().
  165         $this->markTestSkipped(
"Failed for some unknown reason.");
   166         $query = 
'myparam=1234';
   168                                                              . $query), $this->
http, $this->cookieFactory);
   170         $this->assertEquals(
'dummy.jpg', $ilWACSignedPath->getPathObject()->getFileName());
   171         $this->assertEquals($query, $ilWACSignedPath->getPathObject()->getQuery());
   173                             . 
'/sec/ilBlog/mm_124/', $ilWACSignedPath->getPathObject()
   175         $this->assertEquals(
'ilBlog', $ilWACSignedPath->getPathObject()->getSecurePathId());
   176         $this->assertFalse($ilWACSignedPath->getPathObject()->isStreamable());
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ testTokenGeneration()
      
        
          | ilWACTokenTest::testTokenGeneration  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 180 of file ilWACTokenTestTBD.php.
References CLIENT_NAME, ilWACToken\generateToken(), and ilWACToken\getSALT().
  182         $this->markTestSkipped(
"Failed for some unknown reason.");
   184         $ilWacPath = 
new ilWacPath($this->file_four->url());
   187         $this->assertEquals(
'SALT-client_name-123456-20', $ilWACToken->getRawToken());
   188         $this->assertEquals(
'./data/client_name/sec/ilBlog/mm_124/dummy.jpg', $ilWACToken->getId());
   192         $this->assertEquals(
'b541e2bae42ee222f9be959b7ad2ab8844cbb05b', $ilWACToken->getToken());
   193         $this->assertEquals(
'e45b98f267dc891c8206c844f7df29ea', $ilWACToken->getHashedId());
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
 
 
 
◆ testWithoutSigning()
      
        
          | ilWACTokenTest::testWithoutSigning  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 129 of file ilWACTokenTestTBD.php.
References ILIAS\FileDelivery\http().
  131         $this->markTestSkipped(
"Failed for some unknown reason.");
   135         $cookieJar = Mockery::mock(CookieJar::class);
   138             ->shouldReceive(
'getAll')
   143         $this->
http->shouldReceive(
'cookieJar')
   146             ->andReturn($cookieJar);
   148         $request = Mockery::mock(Psr\Http\Message\RequestInterface::class);
   149         $request->shouldReceive(
'getCookieParams')
   152         $this->
http->shouldReceive(
'request')
   154             ->andReturn($request);
   156         $this->assertFalse($ilWACSignedPath->isSignedPath());
   157         $this->assertFalse($ilWACSignedPath->isSignedPathValid());
   158         $this->assertFalse($ilWACSignedPath->isFolderSigned());
   159         $this->assertFalse($ilWACSignedPath->isFolderTokenValid());
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static http()
Fetches the global http state from ILIAS. 
 
 
 
 
◆ $backupGlobals
  
  
      
        
          | ilWACTokenTest::$backupGlobals = false | 
         
       
   | 
  
protected   | 
  
 
 
◆ $cookieFactory
◆ $file_four
  
  
      
        
          | ilWACTokenTest::$file_four | 
         
       
   | 
  
protected   | 
  
 
 
◆ $file_one
  
  
      
        
          | ilWACTokenTest::$file_one | 
         
       
   | 
  
protected   | 
  
 
 
◆ $file_one_subfolder
  
  
      
        
          | ilWACTokenTest::$file_one_subfolder | 
         
       
   | 
  
protected   | 
  
 
 
◆ $file_one_subfolder_two
  
  
      
        
          | ilWACTokenTest::$file_one_subfolder_two | 
         
       
   | 
  
protected   | 
  
 
 
◆ $file_three
  
  
      
        
          | ilWACTokenTest::$file_three | 
         
       
   | 
  
protected   | 
  
 
 
◆ $file_two
  
  
      
        
          | ilWACTokenTest::$file_two | 
         
       
   | 
  
protected   | 
  
 
 
◆ $http
◆ $root
◆ ADDITIONAL_TIME
      
        
          | const ilWACTokenTest::ADDITIONAL_TIME = 1 | 
        
      
 
 
◆ CLIENT_NAME
      
        
          | const ilWACTokenTest::CLIENT_NAME = 'client_name' | 
        
      
 
 
◆ LIFETIME
      
        
          | const ilWACTokenTest::LIFETIME = 2 | 
        
      
 
 
◆ SALT
      
        
          | const ilWACTokenTest::SALT = 'SALT' | 
        
      
 
 
The documentation for this class was generated from the following file: