/** * Tests whether getFromCache() works as expected. * * @return void */ public function testGetFromCache() { $cache = new ArrayCache(); // check first call $this->assertSame('first call', CacheUtil::getFromCache($cache, 'foobar', function () { return 'first call'; })); // check following calls $this->assertSame('first call', CacheUtil::getFromCache($cache, 'foobar', function () { return 'second call'; })); }
/** * Returns the asset base URL. * * @return \Ableron\Lib\Net\Uri */ public static function getAssetBaseUrl() { return clone CacheUtil::getFromCache(self::getCache(), __FUNCTION__, function () { return new Uri(rtrim(self::getSiteUrl()->toString(), '/') . '/assets'); }); }