ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ForumNotificationCacheTest Class Reference

Class ForumNotificationCacheTest. More...

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

Public Member Functions

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

Static Public Member Functions

static nonScalarValuesProvider ()
 
static scalarValuesAndNullProvider ()
 

Detailed Description

Member Function Documentation

◆ nonScalarValuesProvider()

static ForumNotificationCacheTest::nonScalarValuesProvider ( )
static

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()

static ForumNotificationCacheTest::scalarValuesAndNullProvider ( )
static

Definition at line 67 of file ForumNotificationCacheTest.php.

References null.

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ 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 | null$scalarValuescalarValuesAndNullProvider

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  }
Class ilForumNotificationCache.

◆ testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues()

ForumNotificationCacheTest::testExceptionIsRaisedWhenKeyShouldBeBuiltWithNonScalarValues (   $nonScalarValue)
Parameters
mixed$nonScalarValuenonScalarValuesProvider

Definition at line 59 of file ForumNotificationCacheTest.php.

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

◆ 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  }
Class ilForumNotificationCache.

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