Skip to content

Commit 334cd10

Browse files
committed
test: add header configuration test
1 parent fad4da0 commit 334cd10

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/Feature/HeadersTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use AceOfAces\LaravelImageTransformUrl\Tests\TestCase;
6+
7+
beforeEach(function () {
8+
Cache::flush();
9+
Storage::fake('local');
10+
});
11+
12+
it('responds with the configured headers', function () {
13+
14+
// Set up the headers configuration
15+
config()->set('image-transform-url.headers', [
16+
'Cache-Control' => 'immutable, max-age=10000, public, s-maxage=10000',
17+
'X-Header' => 'Value',
18+
]);
19+
20+
/** @var TestCase $this */
21+
$response = $this->get(route('image.transform', [
22+
'options' => 'width=500',
23+
'path' => 'cat.jpg',
24+
]));
25+
26+
$response->assertOk();
27+
$response->assertHeader('Cache-Control', 'immutable, max-age=10000, public, s-maxage=10000');
28+
$response->assertHeader('X-Header', 'Value');
29+
});

0 commit comments

Comments
 (0)