ILIAS  release_8 Revision v8.24
ForumNotificationCacheTest Class Reference

Class ForumNotificationCacheTest. More...

+ Inheritance diagram for ForumNotificationCacheTest:
+ Collaboration diagram for ForumNotificationCacheTest:

Public Member Functions

 testExceptionIsRaisedWhenTryingToRetrieveItemNotCachedYet ()
 
 testCacheItemResultsInCacheHit ()
 
 nonScalarValuesProvider ()
 
 testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues ($nonScalarValue)
 
 scalarValuesAndNullProvider ()
 
 testCacheKeyCouldBeGeneratedByArray ($scalarValue)
 

Detailed Description

Member Function Documentation

◆ nonScalarValuesProvider()

ForumNotificationCacheTest::nonScalarValuesProvider ( )

Definition at line 46 of file ForumNotificationCacheTest.php.

46 : array
47 {
48 return [
49 'Array Type' => [[4]],
50 'Object Type' => [new stdClass()],
51 'Ressource Type' => [fopen('php://temp', 'rb')]
52 ];
53 }

◆ scalarValuesAndNullProvider()

ForumNotificationCacheTest::scalarValuesAndNullProvider ( )

Definition at line 67 of file ForumNotificationCacheTest.php.

67 : array
68 {
69 return [
70 'Float Type' => [4.0],
71 'String Type' => ['4'],
72 'Boolean Type' => [false],
73 'Integer Type' => [4],
74 'Null Type' => [null],
75 ];
76 }

◆ testCacheItemResultsInCacheHit()

ForumNotificationCacheTest::testCacheItemResultsInCacheHit ( )

Definition at line 37 of file ForumNotificationCacheTest.php.

37 : void
38 {
39 $cache = new ilForumNotificationCache();
40 $cache->store('item', 'ilias');
41
42 $this->assertTrue($cache->exists('item'));
43 $this->assertSame('ilias', $cache->fetch('item'));
44 }
Class ilForumNotificationCache.

◆ testCacheKeyCouldBeGeneratedByArray()

ForumNotificationCacheTest::testCacheKeyCouldBeGeneratedByArray (   $scalarValue)
Parameters
scalar$scalarValue@dataProvider scalarValuesAndNullProvider

Definition at line 82 of file ForumNotificationCacheTest.php.

82 : void
83 {
84 $cache = new ilForumNotificationCache();
85 $key = $cache->createKeyByValues([$scalarValue, $scalarValue]);
86
87 $this->assertNotEmpty($key);
88 $this->assertSame(32, strlen($key));
89 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key.

◆ testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues()

ForumNotificationCacheTest::testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues (   $nonScalarValue)
Parameters
mixed$nonScalarValue@dataProvider nonScalarValuesProvider

Definition at line 59 of file ForumNotificationCacheTest.php.

59 : void
60 {
61 $this->expectException(InvalidArgumentException::class);
62
63 $cache = new ilForumNotificationCache();
64 $key = $cache->createKeyByValues([$nonScalarValue, $nonScalarValue]);
65 }

References ILIAS\LTI\ToolProvider\$key.

◆ testExceptionIsRaisedWhenTryingToRetrieveItemNotCachedYet()

ForumNotificationCacheTest::testExceptionIsRaisedWhenTryingToRetrieveItemNotCachedYet ( )

Definition at line 29 of file ForumNotificationCacheTest.php.

29 : void
30 {
31 $this->expectException(InvalidArgumentException::class);
32
33 $cache = new ilForumNotificationCache();
34 $cache->fetch('item');
35 }

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