-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfigTest.php
51 lines (42 loc) · 1.23 KB
/
ConfigTest.php
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
48
49
50
51
<?php
namespace TomKeyte\LaravelHttp2Push\Tests\Feature;
use TomKeyte\LaravelHttp2Push\Http2PushServiceProvider;
use TomKeyte\LaravelHttp2Push\PushCookie;
use Orchestra\Testbench\TestCase;
class ConfigTest extends TestCase
{
/**
* Override Orchestra TestCase method
*/
protected function getPackageProviders($app)
{
return [Http2PushServiceProvider::class];
}
/**
* @test
*/
public function it_respects_cookie_prefix()
{
$prefix = 'test_prefix_';
$this->app['config']->set('http2push.cookie_prefix', $prefix);
$this->assertStringStartsWith($prefix, (new PushCookie('app.js'))->getName());
}
/**
* @test
*/
public function it_respects_global_cookie_expiry()
{
$expiry = 27;
$this->app['config']->set('http2push.cookie_expires_in', $expiry);
$this->assertEquals($expiry, (new PushCookie('/app.js'))->getExpires());
}
/**
* @test
*/
public function it_respects_type_specific_expiry()
{
$script_expiry = 17;
$this->app['config']->set('http2push.cookie_expire_types.script', $script_expiry);
$this->assertEquals($script_expiry, (new PushCookie('/app.js'))->getExpires());
}
}