<?php return ['name' => 'Cache Values', 'description' => 'To be used for testing only - test if caching works', 'basePath' => __DIR__ . '/resources/', 'tasks' => [\Aedart\Scaffold\Tasks\AskForTemplateData::class], 'templateData' => ['sentence' => ['value' => scaffold_cache()->remember('mySentence', 10, function () { return 'Damn yer grog, feed the lass.'; }), 'postProcess' => function ($answer) { return scaffold_cache_get('mySentence'); }]]];
/** * @test */ public function canUseCaseViaHelpers() { $key = $this->faker->word; $value = $this->faker->uuid; scaffold_cache_forever($key, $value); $this->assertSame($value, scaffold_cache_get($key), 'Helper methods seem not to work correctly'); }
/** * @test */ public function canUseCache() { $command = $this->getCommandFromApp('build'); $commandTester = $this->makeCommandTester($command); $cacheDir = $this->outputPath() . 'cache/'; $commandTester->execute(['command' => $command->getName(), 'config' => $this->dataPath() . 'cacheValues.scaffold.php', '--cache' => $cacheDir]); $this->assertFileExists($cacheDir, 'Cache dir not created!'); $this->assertNotEmpty(scaffold_cache_get('mySentence'), 'Item was not cached'); }