ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ForumNotificationCacheTest Class Reference
+ Inheritance diagram for ForumNotificationCacheTest:
+ Collaboration diagram for ForumNotificationCacheTest:

Public Member Functions

 testExceptionIsRaisedWhenTryingToRetrieveItemNotCachedYet ()
 
 testCacheItemResultsInCacheHit ()
 
 testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues (mixed $nonScalarValue)
 
 testCacheKeyCouldBeGeneratedByArray ($scalarValue)
 

Static Public Member Functions

static nonScalarValuesProvider ()
 
static scalarValuesAndNullProvider ()
 

Detailed Description

Definition at line 24 of file ForumNotificationCacheTest.php.

Member Function Documentation

◆ nonScalarValuesProvider()

static ForumNotificationCacheTest::nonScalarValuesProvider ( )
static

Definition at line 43 of file ForumNotificationCacheTest.php.

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

◆ scalarValuesAndNullProvider()

static ForumNotificationCacheTest::scalarValuesAndNullProvider ( )
static

Definition at line 61 of file ForumNotificationCacheTest.php.

61 : array
62 {
63 return [
64 'Float Type' => [4.0],
65 'String Type' => ['4'],
66 'Boolean Type' => [false],
67 'Integer Type' => [4],
68 'Null Type' => [null],
69 ];
70 }

◆ testCacheItemResultsInCacheHit()

ForumNotificationCacheTest::testCacheItemResultsInCacheHit ( )

Definition at line 34 of file ForumNotificationCacheTest.php.

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

◆ testCacheKeyCouldBeGeneratedByArray()

ForumNotificationCacheTest::testCacheKeyCouldBeGeneratedByArray (   $scalarValue)
Parameters
scalar | null$scalarValue

Definition at line 76 of file ForumNotificationCacheTest.php.

76 : void
77 {
78 $cache = new ilForumNotificationCache();
79 $key = $cache->createKeyByValues([$scalarValue, $scalarValue]);
80
81 $this->assertNotEmpty($key);
82 $this->assertSame(32, strlen($key));
83 }

◆ testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues()

ForumNotificationCacheTest::testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues ( mixed  $nonScalarValue)

Definition at line 53 of file ForumNotificationCacheTest.php.

53 : void
54 {
55 $this->expectException(InvalidArgumentException::class);
56
57 $cache = new ilForumNotificationCache();
58 $cache->createKeyByValues([$nonScalarValue, $nonScalarValue]);
59 }

◆ testExceptionIsRaisedWhenTryingToRetrieveItemNotCachedYet()

ForumNotificationCacheTest::testExceptionIsRaisedWhenTryingToRetrieveItemNotCachedYet ( )

Definition at line 26 of file ForumNotificationCacheTest.php.

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

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