File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class Cors implements HttpKernelInterface
37
37
'supportsCredentials ' => false ,
38
38
];
39
39
40
- public function __construct (HttpKernelInterface $ app , array $ options = null )
40
+ public function __construct (HttpKernelInterface $ app , array $ options = [] )
41
41
{
42
42
$ this ->app = $ app ;
43
43
$ this ->cors = new CorsService (array_merge ($ this ->defaultOptions , $ options ));
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of asm89/stack-cors.
5
+ *
6
+ * (c) Alexander <iam.asm89@gmail.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Asm89 \Stack \Tests ;
13
+
14
+ use Asm89 \Stack \CorsService ;
15
+ use PHPUnit \Framework \TestCase ;
16
+
17
+ class CorsServiceTest extends TestCase
18
+ {
19
+ /**
20
+ * @test
21
+ */
22
+ public function it_can_have_options ()
23
+ {
24
+ $ service = new CorsService ([
25
+ 'allowedOrigins ' => ['* ' ]
26
+ ]);
27
+
28
+ $ this ->assertInstanceOf (CorsService::class, $ service );
29
+ }
30
+
31
+ /**
32
+ * @test
33
+ */
34
+ public function it_can_have_no_options ()
35
+ {
36
+ $ service = new CorsService ();
37
+ $ this ->assertInstanceOf (CorsService::class, $ service );
38
+
39
+ }
40
+
41
+ /**
42
+ * @test
43
+ */
44
+ public function it_can_have_empty_options ()
45
+ {
46
+ $ service = new CorsService ([]);
47
+ $ this ->assertInstanceOf (CorsService::class, $ service );
48
+
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments