ILIAS  release_8 Revision v8.23
ilServicesGlobalCacheTest Class Reference
+ Inheritance diagram for ilServicesGlobalCacheTest:
+ Collaboration diagram for ilServicesGlobalCacheTest:

Public Member Functions

 testService ()
 
 testValues ()
 

Private Member Functions

 getSettings ()
 

Detailed Description

Definition at line 23 of file ilServicesGlobalCacheTest.php.

Member Function Documentation

◆ getSettings()

ilServicesGlobalCacheTest::getSettings ( )
private
Returns
ilGlobalCacheSettings

Definition at line 28 of file ilServicesGlobalCacheTest.php.

References ILIAS\LTI\ToolProvider\$settings, and ilGlobalCache\TYPE_STATIC.

Referenced by testService(), and testValues().

29  {
31  $settings->setActive(true);
32  $settings->setActivatedComponents(['test']);
34  return $settings;
35  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
Class ilGlobalCacheSettings.
+ Here is the caller graph for this function:

◆ testService()

ilServicesGlobalCacheTest::testService ( )

Definition at line 37 of file ilServicesGlobalCacheTest.php.

References ILIAS\LTI\ToolProvider\$settings, ilGlobalCache\getInstance(), getSettings(), and ilGlobalCache\setup().

37  : void
38  {
39  $settings = $this->getSettings();
41 
42  $cache = ilGlobalCache::getInstance('test');
43  $this->assertTrue($cache->isActive());
44  $this->assertEquals('test', $cache->getComponent());
45  $this->assertEquals(0, $cache->getServiceType());
46 
47  $cache = ilGlobalCache::getInstance('test_2');
48  $this->assertFalse($cache->isActive());
49  $this->assertEquals('test_2', $cache->getComponent());
50  $this->assertEquals(0, $cache->getServiceType());
51  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
static setup(ilGlobalCacheSettings $ilGlobalCacheSettings)
static getInstance(?string $component)
+ Here is the call graph for this function:

◆ testValues()

ilServicesGlobalCacheTest::testValues ( )

Definition at line 53 of file ilServicesGlobalCacheTest.php.

References ILIAS\LTI\ToolProvider\$settings, ilGlobalCache\getInstance(), getSettings(), and ilGlobalCache\setup().

53  : void
54  {
55  $settings = $this->getSettings();
57  $cache = ilGlobalCache::getInstance('test');
58 
59  $this->assertFalse($cache->isValid('test_key'));
60  $cache->set('test_key', 'value');
61  $this->assertTrue($cache->isValid('test_key'));
62  $this->assertEquals('value', $cache->get('test_key'));
63  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
static setup(ilGlobalCacheSettings $ilGlobalCacheSettings)
static getInstance(?string $component)
+ Here is the call graph for this function:

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