ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilWACTokenTest Class Reference

TestCase for the ilWACTokenTest. More...

+ Inheritance diagram for ilWACTokenTest:
+ Collaboration diagram for ilWACTokenTest:

Public Member Functions

 testWithoutSigning ()
 
 testSomeBasics ()
 
 testTokenGeneration ()
 
 testCookieGeneration ()
 
 testFileToken ()
 
 testFolderToken ()
 
 testFolderTokenWithSecondFile ()
 
 testModifiedTimestampNoMod ()
 
 testModifiedTimestampAddTime ()
 
 testModifiedTimestampSubTime ()
 
 testModifiedTTL ()
 
 testModifiedTTLAndTimestamp ()
 
 testModifiedToken ()
 

Data Fields

const ADDITIONAL_TIME = 1
 
const LIFETIME = 2
 
const SALT = 'SALT'
 
const CLIENT_NAME = 'client_name'
 

Protected Member Functions

 setUp ()
 Setup. More...
 
 getModifiedSignedPath ($add_ttl=0, $add_timestamp=0, $override_token=null)
 

Protected Attributes

 $backupGlobals = false
 
 $file_one
 
 $file_one_subfolder
 
 $file_one_subfolder_two
 
 $file_two
 
 $file_three
 
 $file_four
 
 $root
 

Private Attributes

 $http
 
 $cookieFactory
 

Detailed Description

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 52 of file ilWACTokenTest.php.

Member Function Documentation

◆ getModifiedSignedPath()

ilWACTokenTest::getModifiedSignedPath (   $add_ttl = 0,
  $add_timestamp = 0,
  $override_token = null 
)
protected
Parameters
int$add_ttl
int$add_timestamp
null$override_token
Returns
string

Definition at line 500 of file ilWACTokenTest.php.

References $path, $query, ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().

Referenced by testModifiedTimestampAddTime(), testModifiedTimestampNoMod(), testModifiedTimestampSubTime(), testModifiedToken(), testModifiedTTL(), and testModifiedTTLAndTimestamp().

501  {
503  $signed_path = ilWACSignedPath::signFile($this->file_one->url());
504 
505  $parts = parse_url($signed_path);
506  $path = $parts['path'];
507  $query = $parts['query'];
508  parse_str($query, $query_array);
509  $token = $override_token ? $override_token : $query_array['il_wac_token'];
510  $ttl = (int) $query_array['il_wac_ttl'];
511  $ts = (int) $query_array['il_wac_ts'];
512  $path_with_token = $path . '?il_wac_token=' . $token;
513 
514  $modified_ttl = $ttl + $add_ttl;
515  $modified_ts = $ts + $add_timestamp;
516 
517  return $path_with_token . '&il_wac_ttl=' . $modified_ttl . '&il_wac_ts=' . $modified_ts;
518  }
$query
static signFile($path_to_file)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ilWACTokenTest::setUp ( )
protected

Setup.

Definition at line 103 of file ilWACTokenTest.php.

References $container, $GLOBALS, ILIAS\FileDelivery\http(), and ilWACToken\setSALT().

104  {
105  parent::setUp();
106 
107  $this->root = vfs\vfsStream::setup('ilias.de');
108  $this->file_one = vfs\vfsStream::newFile('data/client_name/mobs/mm_123/dummy.jpg')
109  ->at($this->root)->setContent('dummy');
110  $this->file_one_subfolder = vfs\vfsStream::newFile('data/client_name/mobs/mm_123/mobile/dummy.jpg')
111  ->at($this->root)->setContent('dummy');
112  $this->file_one_subfolder_two = vfs\vfsStream::newFile('data/client_name/mobs/mm_123/mobile/device/dummy.jpg')
113  ->at($this->root)->setContent('dummy');
114  $this->file_two = vfs\vfsStream::newFile('data/client_name/mobs/mm_123/dummy2.jpg')
115  ->at($this->root)->setContent('dummy2');
116  $this->file_three = vfs\vfsStream::newFile('data/client_name/mobs/mm_124/dummy.jpg')
117  ->at($this->root)->setContent('dummy');
118  $this->file_four = vfs\vfsStream::newFile('data/client_name/sec/ilBlog/mm_124/dummy.jpg')
119  ->at($this->root)->setContent('dummy');
120 
121  //setup container for HttpServiceAware classes
122  $container = new \ILIAS\DI\Container();
123  $container['http'] = function ($c) {
124  return Mockery::mock(GlobalHttpState::class);
125  };
126 
127  $this->http = $container['http'];
128 
129 
130  $GLOBALS["DIC"] = $container;
131 
132  $this->cookieFactory = Mockery::mock(CookieFactoryImpl::class);
133 
134  //because the cookie have no logic except cloning it self therefore it should be no problem to defer the function calls
135  $this->cookieFactory->shouldDeferMissing();
136 
137  ilWACToken::setSALT(self::SALT);
138  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$container
Definition: wac.php:13
static http()
Fetches the global http state from ILIAS.
static setSALT($salt)
+ Here is the call graph for this function:

◆ testCookieGeneration()

ilWACTokenTest::testCookieGeneration ( )

Definition at line 196 of file ilWACTokenTest.php.

References $response, ILIAS\HTTP\Cookies\Cookie\getName(), ILIAS\FileDelivery\http(), and ilWACSignedPath\signFolderOfStartFile().

197  {
198  $expected_cookies = [
199  '19ab58dae37d8d8cf931727c35514642',
200  '19ab58dae37d8d8cf931727c35514642ts',
201  '19ab58dae37d8d8cf931727c35514642ttl',
202  ];
203 
204  $cookieJar = Mockery::mock(CookieJar::class);
205 
206  $response = Mockery::mock(ResponseInterface::class);
207 
208  $this->http
209  ->shouldReceive('response')
210  ->times(3)
211  ->withNoArgs()
212  ->andReturn($response)
213  ->getMock()
214 
215  ->shouldReceive('saveResponse')
216  ->times(3)
217  ->with($response);
218 
219  $cookieJar
220  ->shouldReceive('with')
221  ->times(3)
222  ->with(Mockery::on(function (Cookie $cookie) use ($expected_cookies) {
223  return strcmp($cookie->getName(), $expected_cookies[0]) === 0;
224  }))
225  ->andReturnSelf()
226  ->getMock()
227 
228  ->shouldReceive('with')
229  ->times(3)
230  ->with(Mockery::on(function (Cookie $cookie) use ($expected_cookies) {
231  return strcmp($cookie->getName(), $expected_cookies[1]) === 0;
232  }))
233  ->andReturnSelf()
234  ->getMock()
235 
236  ->shouldReceive('with')
237  ->times(3)
238  ->with(Mockery::on(function (Cookie $cookie) use ($expected_cookies) {
239  return strcmp($cookie->getName(), $expected_cookies[2]) === 0;
240  }))
241  ->andReturnSelf()
242  ->getMock()
243 
244  ->shouldReceive('renderIntoResponseHeader')
245  ->times(3)
246  ->withAnyArgs()
247  ->andReturn($response);
248 
249  $this->http->shouldReceive('cookieJar')
250  ->times(3)
251  ->withNoArgs()
252  ->andReturn($cookieJar);
253 
254  ilWACSignedPath::signFolderOfStartFile($this->file_one->url());
255 
256  // in subfolder
257  ilWACSignedPath::signFolderOfStartFile($this->file_one_subfolder->url());
258 
259  // in sub-subfolder
260  ilWACSignedPath::signFolderOfStartFile($this->file_one_subfolder->url());
261  }
static signFolderOfStartFile($start_file_path)
static http()
Fetches the global http state from ILIAS.
getName()
Cookie name.
$response
+ Here is the call graph for this function:

◆ testFileToken()

ilWACTokenTest::testFileToken ( )

Definition at line 264 of file ilWACTokenTest.php.

References ilWACSignedPath\getTokenMaxLifetimeInSeconds(), ILIAS\FileDelivery\http(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().

265  {
268 
269  // Request within lifetime
270  $signed_path = ilWACSignedPath::signFile($this->file_one->url());
271  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($signed_path), $this->http, $this->cookieFactory);
272 
273  $this->assertTrue($ilWACSignedPath->isSignedPath());
274  $this->assertTrue($ilWACSignedPath->isSignedPathValid());
275  $this->assertEquals($ilWACSignedPath->getPathObject()->getClient(), self::CLIENT_NAME);
276  $this->assertFalse($ilWACSignedPath->getPathObject()->isInSecFolder());
277  $this->assertTrue($ilWACSignedPath->getPathObject()->isImage());
278  $this->assertFalse($ilWACSignedPath->getPathObject()->isAudio());
279  $this->assertFalse($ilWACSignedPath->getPathObject()->isVideo());
280  $this->assertTrue($ilWACSignedPath->getPathObject()->hasTimestamp());
281  $this->assertTrue($ilWACSignedPath->getPathObject()->hasToken());
282 
283  // Request after lifetime
284  $signed_path = ilWACSignedPath::signFile($this->file_four->url());
285  sleep($lifetime + self::ADDITIONAL_TIME);
286  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($signed_path), $this->http, $this->cookieFactory);
287  $this->assertTrue($ilWACSignedPath->isSignedPath());
288  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
289  }
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
static signFile($path_to_file)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
static getTokenMaxLifetimeInSeconds()
+ Here is the call graph for this function:

◆ testFolderToken()

ilWACTokenTest::testFolderToken ( )

Definition at line 295 of file ilWACTokenTest.php.

References $response, $timestamp, ilWACSignedPath\getCookieMaxLifetimeInSeconds(), ILIAS\FileDelivery\http(), ilWACSignedPath\setCookieMaxLifetimeInSeconds(), and ilWACSignedPath\signFolderOfStartFile().

296  {
297  $response = Mockery::mock(ResponseInterface::class);
298  $cookieJar = Mockery::mock(CookieJar::class);
299 
300  $this->http
301  ->shouldReceive('response')
302  ->once()
303  ->withNoArgs()
304  ->andReturn($response)
305  ->getMock()
306 
307  ->shouldReceive('cookieJar')
308  ->once()
309  ->withNoArgs()
310  ->andReturn($cookieJar)
311  ->getMock()
312 
313  ->shouldReceive('saveResponse')
314  ->once()
315  ->with($response);
316 
317  $timestamp = 2 ** 31 - 31;
318  $ttl = 30;
319  $tokenId = '19ab58dae37d8d8cf931727c35514642';
320 
321  $tokenCookie = $this->cookieFactory->create($tokenId, '344d7676240285cc714366038beb44d81bda1d4b');
322  $timestampCookie = $this->cookieFactory->create("{$tokenId}ts", "$timestamp");
323  $ttlCookie = $this->cookieFactory->create("{$tokenId}ttl", "$ttl");
324 
325  $cookieJar
326  ->shouldReceive('with')
327  ->times(3)
328  ->with(Mockery::type(Cookie::class))
329  ->andReturnSelf()
330  ->getMock()
331 
332  ->shouldReceive('renderIntoResponseHeader')
333  ->once()
334  ->withAnyArgs()
335  ->andReturn($response)
336  ->getMock()
337 
338  ->shouldReceive('get')
339  ->times(3)
340  ->withAnyArgs()
341  ->andReturnValues([$tokenCookie, $timestampCookie, $ttlCookie])
342  ->getMock()
343 
344  ->shouldReceive('get')
345  ->times(3)
346  ->withAnyArgs()
347  ->andReturnValues([$tokenCookie, $timestampCookie, $ttlCookie]);
348 
351 
352  $signed_path = $this->file_one->url();
354 
355  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($signed_path), $this->http, $this->cookieFactory);
356 
357  self::markTestSkipped("WIP");
358  return;
359 
360  $this->assertTrue($ilWACSignedPath->isFolderSigned());
361  $this->assertTrue($ilWACSignedPath->isFolderTokenValid());
362  $this->assertEquals($ilWACSignedPath->getPathObject()->getClient(), self::CLIENT_NAME);
363  $this->assertFalse($ilWACSignedPath->getPathObject()->isInSecFolder());
364  $this->assertTrue($ilWACSignedPath->getPathObject()->isImage());
365  $this->assertFalse($ilWACSignedPath->getPathObject()->isAudio());
366  $this->assertFalse($ilWACSignedPath->getPathObject()->isVideo());
367  $this->assertTrue($ilWACSignedPath->getPathObject()->hasTimestamp());
368  $this->assertTrue($ilWACSignedPath->getPathObject()->hasToken());
369 
370  // Request after lifetime
372  sleep($lifetime + self::ADDITIONAL_TIME);
373  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($signed_path), $this->http, $this->cookieFactory);
374  $this->assertTrue($ilWACSignedPath->isFolderSigned());
375  $this->assertFalse($ilWACSignedPath->isFolderTokenValid());
376 
377  // Revalidating cookie
378  $ilWACSignedPath->revalidatingFolderToken();
379  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($signed_path), $this->http, $this->cookieFactory);
380  $this->assertTrue($ilWACSignedPath->isFolderSigned());
381  $this->assertTrue($ilWACSignedPath->isFolderTokenValid());
382 
383  // Check other file
384  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->file_three->url()), $this->http, $this->cookieFactory);
385  $this->assertTrue($ilWACSignedPath->isFolderSigned());
386  $this->assertTrue($ilWACSignedPath->isFolderTokenValid());
387  }
static getCookieMaxLifetimeInSeconds()
Class ilWACPath.
static signFolderOfStartFile($start_file_path)
static http()
Fetches the global http state from ILIAS.
static setCookieMaxLifetimeInSeconds($cookie_max_lifetime_in_seconds)
Class ilWACSignedPath.
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
$response
+ Here is the call graph for this function:

◆ testFolderTokenWithSecondFile()

ilWACTokenTest::testFolderTokenWithSecondFile ( )

Definition at line 393 of file ilWACTokenTest.php.

References $file_two, ilWACSignedPath\getCookieMaxLifetimeInSeconds(), ILIAS\FileDelivery\http(), ilWACSignedPath\setCookieMaxLifetimeInSeconds(), and ilWACSignedPath\signFolderOfStartFile().

394  {
395  self::markTestSkipped("WIP");
396  return;
399  // Sign File One
400 
401  ilWACSignedPath::signFolderOfStartFile($this->file_one->url());
402  // Check File Two
403  $file_two = $this->file_two->url();
404  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($file_two), $this->http, $this->cookieFactory);
405  $this->assertTrue($ilWACSignedPath->isFolderSigned());
406  $this->assertTrue($ilWACSignedPath->isFolderTokenValid());
407 
408  // Request after lifetime
410  sleep($lifetime + self::ADDITIONAL_TIME);
411  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($file_two), $this->http, $this->cookieFactory);
412  $this->assertTrue($ilWACSignedPath->isFolderSigned());
413  $this->assertFalse($ilWACSignedPath->isFolderTokenValid());
414 
415  // Revalidating cookie
416  $ilWACSignedPath->revalidatingFolderToken();
417  $this->assertTrue($ilWACSignedPath->isFolderSigned());
418  $this->assertTrue($ilWACSignedPath->isFolderTokenValid());
419 
420  // Check other file
421  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->file_three->url()), $this->http, $this->cookieFactory);
422  $this->assertFalse($ilWACSignedPath->isFolderSigned());
423  $this->assertFalse($ilWACSignedPath->isFolderTokenValid());
424  }
static getCookieMaxLifetimeInSeconds()
Class ilWACPath.
static signFolderOfStartFile($start_file_path)
static http()
Fetches the global http state from ILIAS.
static setCookieMaxLifetimeInSeconds($cookie_max_lifetime_in_seconds)
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testModifiedTimestampAddTime()

ilWACTokenTest::testModifiedTimestampAddTime ( )

Definition at line 443 of file ilWACTokenTest.php.

References getModifiedSignedPath(), and ILIAS\FileDelivery\http().

444  {
445  self::markTestSkipped("WIP");
446  return;
447  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->getModifiedSignedPath(self::ADDITIONAL_TIME, 0)), $this->http, $this->cookieFactory);
448  $this->assertTrue($ilWACSignedPath->isSignedPath());
449  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
450  }
getModifiedSignedPath($add_ttl=0, $add_timestamp=0, $override_token=null)
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testModifiedTimestampNoMod()

ilWACTokenTest::testModifiedTimestampNoMod ( )

Definition at line 430 of file ilWACTokenTest.php.

References getModifiedSignedPath(), and ILIAS\FileDelivery\http().

431  {
432  self::markTestSkipped("WIP");
433  return;
434  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->getModifiedSignedPath(0, 0)), $this->http, $this->cookieFactory);
435  $this->assertTrue($ilWACSignedPath->isSignedPath());
436  $this->assertTrue($ilWACSignedPath->isSignedPathValid());
437  }
getModifiedSignedPath($add_ttl=0, $add_timestamp=0, $override_token=null)
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testModifiedTimestampSubTime()

ilWACTokenTest::testModifiedTimestampSubTime ( )

Definition at line 453 of file ilWACTokenTest.php.

References getModifiedSignedPath(), and ILIAS\FileDelivery\http().

454  {
455  self::markTestSkipped("WIP");
456  return;
457  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->getModifiedSignedPath(self::ADDITIONAL_TIME
458  * -1, 0)), $this->http, $this->cookieFactory);
459  $this->assertTrue($ilWACSignedPath->isSignedPath());
460  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
461  }
getModifiedSignedPath($add_ttl=0, $add_timestamp=0, $override_token=null)
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testModifiedToken()

ilWACTokenTest::testModifiedToken ( )

Definition at line 484 of file ilWACTokenTest.php.

References getModifiedSignedPath(), and ILIAS\FileDelivery\http().

485  {
486  self::markTestSkipped("WIP");
487  return;
488  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->getModifiedSignedPath(0, 0, md5('LOREM'))), $this->http, $this->cookieFactory);
489  $this->assertTrue($ilWACSignedPath->isSignedPath());
490  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
491  }
getModifiedSignedPath($add_ttl=0, $add_timestamp=0, $override_token=null)
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testModifiedTTL()

ilWACTokenTest::testModifiedTTL ( )

Definition at line 464 of file ilWACTokenTest.php.

References getModifiedSignedPath(), and ILIAS\FileDelivery\http().

465  {
466  self::markTestSkipped("WIP");
467  return;
468  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->getModifiedSignedPath(0, 1)), $this->http, $this->cookieFactory);
469  $this->assertTrue($ilWACSignedPath->isSignedPath());
470  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
471  }
getModifiedSignedPath($add_ttl=0, $add_timestamp=0, $override_token=null)
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testModifiedTTLAndTimestamp()

ilWACTokenTest::testModifiedTTLAndTimestamp ( )

Definition at line 474 of file ilWACTokenTest.php.

References getModifiedSignedPath(), and ILIAS\FileDelivery\http().

475  {
476  self::markTestSkipped("WIP");
477  return;
478  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->getModifiedSignedPath(1, 1)), $this->http, $this->cookieFactory);
479  $this->assertTrue($ilWACSignedPath->isSignedPath());
480  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
481  }
getModifiedSignedPath($add_ttl=0, $add_timestamp=0, $override_token=null)
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

◆ testSomeBasics()

ilWACTokenTest::testSomeBasics ( )

Definition at line 165 of file ilWACTokenTest.php.

References $query, and ILIAS\FileDelivery\http().

166  {
167  $query = 'myparam=1234';
168  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->file_four->url() . '?'
169  . $query), $this->http, $this->cookieFactory);
170 
171  $this->assertEquals('dummy.jpg', $ilWACSignedPath->getPathObject()->getFileName());
172  $this->assertEquals($query, $ilWACSignedPath->getPathObject()->getQuery());
173  $this->assertEquals('./data/' . self::CLIENT_NAME
174  . '/sec/ilBlog/mm_124/', $ilWACSignedPath->getPathObject()
175  ->getSecurePath());
176  $this->assertEquals('ilBlog', $ilWACSignedPath->getPathObject()->getSecurePathId());
177  $this->assertFalse($ilWACSignedPath->getPathObject()->isStreamable());
178  }
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
$query
+ Here is the call graph for this function:

◆ testTokenGeneration()

ilWACTokenTest::testTokenGeneration ( )

Definition at line 181 of file ilWACTokenTest.php.

References ilWACToken\generateToken(), and ilWACToken\getSALT().

182  {
183  $ilWacPath = new ilWacPath($this->file_four->url());
184  $ilWACToken = new ilWACToken($ilWacPath->getPath(), self::CLIENT_NAME, 123456, 20);
185  $ilWACToken->generateToken();
186  $this->assertEquals('SALT-client_name-123456-20', $ilWACToken->getRawToken());
187  $this->assertEquals('./data/client_name/sec/ilBlog/mm_124/dummy.jpg', $ilWACToken->getId());
188 
189  $this->assertEquals(self::SALT, ilWACToken::getSALT());
190  $ilWACToken = new ilWACToken($ilWacPath->getPath(), self::CLIENT_NAME, 123456, 20);
191  $this->assertEquals('b541e2bae42ee222f9be959b7ad2ab8844cbb05b', $ilWACToken->getToken());
192  $this->assertEquals('e45b98f267dc891c8206c844f7df29ea', $ilWACToken->getHashedId());
193  }
static getSALT()
Class ilWACToken.
+ Here is the call graph for this function:

◆ testWithoutSigning()

ilWACTokenTest::testWithoutSigning ( )

Definition at line 141 of file ilWACTokenTest.php.

References ILIAS\FileDelivery\http().

142  {
143  $ilWACSignedPath = new ilWACSignedPath(new ilWACPath($this->file_one->url()), $this->http, $this->cookieFactory);
144 
145  $cookieJar = Mockery::mock(CookieJar::class);
146 
147  $cookieJar
148  ->shouldReceive('get')
149  ->times(6)
150  ->withAnyArgs()
151  ->andReturnNull();
152 
153  $this->http->shouldReceive('cookieJar')
154  ->twice()
155  ->withNoArgs()
156  ->andReturn($cookieJar);
157 
158  $this->assertFalse($ilWACSignedPath->isSignedPath());
159  $this->assertFalse($ilWACSignedPath->isSignedPathValid());
160  $this->assertFalse($ilWACSignedPath->isFolderSigned());
161  $this->assertFalse($ilWACSignedPath->isFolderTokenValid());
162  }
Class ilWACPath.
static http()
Fetches the global http state from ILIAS.
Class ilWACSignedPath.
+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilWACTokenTest::$backupGlobals = false
protected

Definition at line 61 of file ilWACTokenTest.php.

◆ $cookieFactory

CookieFactory MockInterface ilWACTokenTest::$cookieFactory
private

Definition at line 97 of file ilWACTokenTest.php.

◆ $file_four

ilWACTokenTest::$file_four
protected

Definition at line 85 of file ilWACTokenTest.php.

◆ $file_one

ilWACTokenTest::$file_one
protected

Definition at line 65 of file ilWACTokenTest.php.

◆ $file_one_subfolder

ilWACTokenTest::$file_one_subfolder
protected

Definition at line 69 of file ilWACTokenTest.php.

◆ $file_one_subfolder_two

ilWACTokenTest::$file_one_subfolder_two
protected

Definition at line 73 of file ilWACTokenTest.php.

◆ $file_three

ilWACTokenTest::$file_three
protected

Definition at line 81 of file ilWACTokenTest.php.

◆ $file_two

ilWACTokenTest::$file_two
protected

Definition at line 77 of file ilWACTokenTest.php.

Referenced by testFolderTokenWithSecondFile().

◆ $http

GlobalHttpState MockInterface ilWACTokenTest::$http
private

Definition at line 93 of file ilWACTokenTest.php.

◆ $root

ilWACTokenTest::$root
protected

Definition at line 89 of file ilWACTokenTest.php.

◆ ADDITIONAL_TIME

const ilWACTokenTest::ADDITIONAL_TIME = 1

Definition at line 54 of file ilWACTokenTest.php.

◆ CLIENT_NAME

const ilWACTokenTest::CLIENT_NAME = 'client_name'

Definition at line 57 of file ilWACTokenTest.php.

◆ LIFETIME

const ilWACTokenTest::LIFETIME = 2

Definition at line 55 of file ilWACTokenTest.php.

◆ SALT

const ilWACTokenTest::SALT = 'SALT'

Definition at line 56 of file ilWACTokenTest.php.


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