-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cache_methods.php
More file actions
executable file
·47 lines (40 loc) · 1.35 KB
/
test_cache_methods.php
File metadata and controls
executable file
·47 lines (40 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Simple test to verify cache methods exist on LayoutBuilder
*/
require_once __DIR__.'/src/LayoutBuilder.php';
require_once __DIR__.'/src/Traits/Cacheable.php';
use Litepie\Layout\LayoutBuilder;
// Test that methods exist and are chainable
try {
$builder = new LayoutBuilder('test', 'view');
echo "Testing cache methods...\n";
// Test cache methods
$result = $builder
->cache()
->ttl(600)
->key('test-key')
->tags(['tag1', 'tag2'])
->beforeRender(function ($layout) {
echo "Before render callback\n";
})
->afterRender(function ($layout, $output) {
echo "After render callback\n";
})
->resolveAuthorization((object) ['id' => 1]);
if ($result instanceof LayoutBuilder) {
echo "✓ All cache methods are chainable\n";
echo "✓ ttl() method exists\n";
echo "✓ key() method exists\n";
echo "✓ tags() method exists\n";
echo "✓ beforeRender() method exists\n";
echo "✓ afterRender() method exists\n";
echo "✓ resolveAuthorization() method exists\n";
echo "\nAll tests passed!\n";
} else {
echo "✗ Methods are not chainable\n";
}
} catch (\Throwable $e) {
echo '✗ Error: '.$e->getMessage()."\n";
echo ' in '.$e->getFile().' on line '.$e->getLine()."\n";
}