@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | array $headers = [] |
46 | 46 | ): ResponseInterface { |
47 | 47 | $r = $this->request($uri, 'GET', [], $headers, []); |
48 | - foreach ($attributes as $k => $v) { |
|
48 | + foreach ($attributes as $k => $v){ |
|
49 | 49 | $r = $r->withAttribute($k, $v); |
50 | 50 | } |
51 | 51 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | protected function fetchCookies(array $header) |
87 | 87 | { |
88 | 88 | $result = []; |
89 | - foreach ($header as $line) { |
|
89 | + foreach ($header as $line){ |
|
90 | 90 | $cookie = explode('=', $line); |
91 | 91 | $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';'))); |
92 | 92 | } |
@@ -45,7 +45,8 @@ discard block |
||
45 | 45 | array $headers = [] |
46 | 46 | ): ResponseInterface { |
47 | 47 | $r = $this->request($uri, 'GET', [], $headers, []); |
48 | - foreach ($attributes as $k => $v) { |
|
48 | + foreach ($attributes as $k => $v) |
|
49 | + { |
|
49 | 50 | $r = $r->withAttribute($k, $v); |
50 | 51 | } |
51 | 52 | |
@@ -86,7 +87,8 @@ discard block |
||
86 | 87 | protected function fetchCookies(array $header) |
87 | 88 | { |
88 | 89 | $result = []; |
89 | - foreach ($header as $line) { |
|
90 | + foreach ($header as $line) |
|
91 | + { |
|
90 | 92 | $cookie = explode('=', $line); |
91 | 93 | $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';'))); |
92 | 94 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | EnvironmentInterface $env, |
24 | 24 | BootloadManager $bootloadManager |
25 | 25 | ): void { |
26 | - if ($env->get('CYCLE_AUTH')) { |
|
26 | + if ($env->get('CYCLE_AUTH')){ |
|
27 | 27 | $bootloadManager->bootload([CycleTokensBootloader::class]); |
28 | 28 | return; |
29 | 29 | } |
@@ -23,7 +23,8 @@ |
||
23 | 23 | EnvironmentInterface $env, |
24 | 24 | BootloadManager $bootloadManager |
25 | 25 | ): void { |
26 | - if ($env->get('CYCLE_AUTH')) { |
|
26 | + if ($env->get('CYCLE_AUTH')) |
|
27 | + { |
|
27 | 28 | $bootloadManager->bootload([CycleTokensBootloader::class]); |
28 | 29 | return; |
29 | 30 | } |
@@ -21,17 +21,17 @@ |
||
21 | 21 | |
22 | 22 | public function boot(WebsocketsBootloader $ws, EnvironmentInterface $env): void |
23 | 23 | { |
24 | - if ($env->get('RR_BROADCAST_PATH') === null) { |
|
24 | + if ($env->get('RR_BROADCAST_PATH') === null){ |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $ws->authorizeServer($env->get('WS_SERVER_CALLBACK')); |
29 | 29 | |
30 | - if ($env->get('WS_TOPIC_CALLBACK') !== null) { |
|
30 | + if ($env->get('WS_TOPIC_CALLBACK') !== null){ |
|
31 | 31 | $ws->authorizeTopic('topic', $env->get('WS_TOPIC_CALLBACK')); |
32 | 32 | } |
33 | 33 | |
34 | - if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null) { |
|
34 | + if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null){ |
|
35 | 35 | $ws->authorizeTopic('wildcard.{id}', $env->get('WS_TOPIC_WILDCARD_CALLBACK')); |
36 | 36 | } |
37 | 37 | } |
@@ -21,17 +21,20 @@ |
||
21 | 21 | |
22 | 22 | public function boot(WebsocketsBootloader $ws, EnvironmentInterface $env): void |
23 | 23 | { |
24 | - if ($env->get('RR_BROADCAST_PATH') === null) { |
|
24 | + if ($env->get('RR_BROADCAST_PATH') === null) |
|
25 | + { |
|
25 | 26 | return; |
26 | 27 | } |
27 | 28 | |
28 | 29 | $ws->authorizeServer($env->get('WS_SERVER_CALLBACK')); |
29 | 30 | |
30 | - if ($env->get('WS_TOPIC_CALLBACK') !== null) { |
|
31 | + if ($env->get('WS_TOPIC_CALLBACK') !== null) |
|
32 | + { |
|
31 | 33 | $ws->authorizeTopic('topic', $env->get('WS_TOPIC_CALLBACK')); |
32 | 34 | } |
33 | 35 | |
34 | - if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null) { |
|
36 | + if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null) |
|
37 | + { |
|
35 | 38 | $ws->authorizeTopic('wildcard.{id}', $env->get('WS_TOPIC_WILDCARD_CALLBACK')); |
36 | 39 | } |
37 | 40 | } |
@@ -19,7 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | parent::tearDown(); |
21 | 21 | |
22 | - if (file_exists(sys_get_temp_dir() . '/messages.ru.php')) { |
|
22 | + if (file_exists(sys_get_temp_dir() . '/messages.ru.php')) |
|
23 | + { |
|
23 | 24 | unlink(sys_get_temp_dir() . '/messages.ru.php'); |
24 | 25 | } |
25 | 26 | } |
@@ -19,14 +19,14 @@ |
||
19 | 19 | { |
20 | 20 | parent::tearDown(); |
21 | 21 | |
22 | - if (file_exists(sys_get_temp_dir() . '/messages.ru.php')) { |
|
23 | - unlink(sys_get_temp_dir() . '/messages.ru.php'); |
|
22 | + if (file_exists(sys_get_temp_dir().'/messages.ru.php')){ |
|
23 | + unlink(sys_get_temp_dir().'/messages.ru.php'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function testReset(): void |
28 | 28 | { |
29 | - $this->assertFalse(is_file(sys_get_temp_dir() . '/messages.ru.php')); |
|
29 | + $this->assertFalse(is_file(sys_get_temp_dir().'/messages.ru.php')); |
|
30 | 30 | |
31 | 31 | $this->runCommandDebug('i18n:index'); |
32 | 32 | $this->runCommandDebug('configure'); |
@@ -142,7 +142,7 @@ |
||
142 | 142 | ['value' => $value] + $data, |
143 | 143 | ['value' => [['entity::unique', User::class, $field, $fields]]] |
144 | 144 | ); |
145 | - if ($context !== null) { |
|
145 | + if ($context !== null){ |
|
146 | 146 | $validator = $validator->withContext($context); |
147 | 147 | } |
148 | 148 |
@@ -142,7 +142,8 @@ |
||
142 | 142 | ['value' => $value] + $data, |
143 | 143 | ['value' => [['entity::unique', User::class, $field, $fields]]] |
144 | 144 | ); |
145 | - if ($context !== null) { |
|
145 | + if ($context !== null) |
|
146 | + { |
|
146 | 147 | $validator = $validator->withContext($context); |
147 | 148 | } |
148 | 149 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function testMountFileNotFound(): void |
26 | 26 | { |
27 | 27 | $out = $this->runCommand('encrypt:key', [ |
28 | - '-m' => __DIR__ . '/.env' |
|
28 | + '-m' => __DIR__.'/.env' |
|
29 | 29 | ]); |
30 | 30 | |
31 | 31 | $this->assertStringContainsString('Unable to find', $out); |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | |
34 | 34 | public function testReplace(): void |
35 | 35 | { |
36 | - file_put_contents(__DIR__ . '/.env', '{encrypt-key}'); |
|
36 | + file_put_contents(__DIR__.'/.env', '{encrypt-key}'); |
|
37 | 37 | |
38 | 38 | $out = $this->runCommand('encrypt:key', [ |
39 | - '-m' => __DIR__ . '/.env' |
|
39 | + '-m' => __DIR__.'/.env' |
|
40 | 40 | ]); |
41 | 41 | |
42 | 42 | $this->assertStringContainsString('key has been updated', $out); |
43 | 43 | |
44 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
44 | + $body = file_get_contents(__DIR__.'/.env'); |
|
45 | 45 | $this->assertStringContainsString($body, $out); |
46 | 46 | |
47 | - unlink(__DIR__ . '/.env'); |
|
47 | + unlink(__DIR__.'/.env'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function testReplaceCurrent(): void |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | 'ENCRYPTER_KEY' => $key |
56 | 56 | ]); |
57 | 57 | |
58 | - file_put_contents(__DIR__ . '/.env', $key); |
|
58 | + file_put_contents(__DIR__.'/.env', $key); |
|
59 | 59 | |
60 | 60 | $out = $app->console()->run('encrypt:key', [ |
61 | - '-m' => __DIR__ . '/.env' |
|
61 | + '-m' => __DIR__.'/.env' |
|
62 | 62 | ]); |
63 | 63 | $out = $out->getOutput()->fetch(); |
64 | 64 | |
65 | 65 | $this->assertStringContainsString('key has been updated', $out); |
66 | 66 | |
67 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
67 | + $body = file_get_contents(__DIR__.'/.env'); |
|
68 | 68 | $this->assertStringContainsString($body, $out); |
69 | 69 | |
70 | - unlink(__DIR__ . '/.env'); |
|
70 | + unlink(__DIR__.'/.env'); |
|
71 | 71 | } |
72 | 72 | } |
@@ -53,13 +53,13 @@ |
||
53 | 53 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
54 | 54 | $this->assertStringContainsString('default.users', $output); |
55 | 55 | |
56 | - $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php'); |
|
57 | - unlink(__DIR__ . '/../../app/src/User/User.php'); |
|
58 | - try { |
|
56 | + $user = file_get_contents(__DIR__.'/../../app/src/User/User.php'); |
|
57 | + unlink(__DIR__.'/../../app/src/User/User.php'); |
|
58 | + try{ |
|
59 | 59 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
60 | 60 | $this->assertStringContainsString('drop foreign key', $output); |
61 | - } finally { |
|
62 | - file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user); |
|
61 | + }finally{ |
|
62 | + file_put_contents(__DIR__.'/../../app/src/User/User.php', $user); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -55,10 +55,13 @@ |
||
55 | 55 | |
56 | 56 | $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php'); |
57 | 57 | unlink(__DIR__ . '/../../app/src/User/User.php'); |
58 | - try { |
|
58 | + try |
|
59 | + { |
|
59 | 60 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
60 | 61 | $this->assertStringContainsString('drop foreign key', $output); |
61 | - } finally { |
|
62 | + } |
|
63 | + finally |
|
64 | + { |
|
62 | 65 | file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user); |
63 | 66 | } |
64 | 67 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | public function testHasCookie(): void |
38 | 38 | { |
39 | - $this->http->setHandler(function () { |
|
40 | - return (int) $this->cookies()->has('a'); |
|
39 | + $this->http->setHandler(function (){ |
|
40 | + return (int)$this->cookies()->has('a'); |
|
41 | 41 | }); |
42 | 42 | |
43 | 43 | $result = $this->get('/'); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | ]); |
55 | 55 | $this->http = $this->app->get(Http::class); |
56 | 56 | |
57 | - $this->http->setHandler(function () { |
|
58 | - return (int) $this->cookies()->has('a'); |
|
57 | + $this->http->setHandler(function (){ |
|
58 | + return (int)$this->cookies()->has('a'); |
|
59 | 59 | }); |
60 | 60 | |
61 | 61 | $result = $this->get('/', [], [], [ |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
72 | 72 | $this->http = $this->app->get(Http::class); |
73 | 73 | |
74 | - $this->http->setHandler(function () { |
|
74 | + $this->http->setHandler(function (){ |
|
75 | 75 | return $this->cookies()->get('a'); |
76 | 76 | }); |
77 | 77 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
89 | 89 | $this->http = $this->app->get(Http::class); |
90 | 90 | |
91 | - $this->http->setHandler(function () { |
|
91 | + $this->http->setHandler(function (){ |
|
92 | 92 | $this->cookies()->set('a', 'value'); |
93 | 93 | |
94 | 94 | return 'ok'; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
113 | 113 | $this->http = $this->app->get(Http::class); |
114 | 114 | |
115 | - $this->http->setHandler(function () { |
|
115 | + $this->http->setHandler(function (){ |
|
116 | 116 | $this->cookies()->schedule(Cookie::create('a', 'value')); |
117 | 117 | $this->assertSame([], $this->cookies()->getAll()); |
118 | 118 | $this->assertCount(1, $this->cookies()->getScheduled()); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
139 | 139 | $this->http = $this->app->get(Http::class); |
140 | 140 | |
141 | - $this->http->setHandler(function () { |
|
141 | + $this->http->setHandler(function (){ |
|
142 | 142 | $this->cookies()->delete('cookie'); |
143 | 143 | |
144 | 144 | return 'ok'; |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | public function testHasCookie(): void |
38 | 38 | { |
39 | - $this->http->setHandler(function () { |
|
39 | + $this->http->setHandler(function () |
|
40 | + { |
|
40 | 41 | return (int) $this->cookies()->has('a'); |
41 | 42 | }); |
42 | 43 | |
@@ -54,7 +55,8 @@ discard block |
||
54 | 55 | ]); |
55 | 56 | $this->http = $this->app->get(Http::class); |
56 | 57 | |
57 | - $this->http->setHandler(function () { |
|
58 | + $this->http->setHandler(function () |
|
59 | + { |
|
58 | 60 | return (int) $this->cookies()->has('a'); |
59 | 61 | }); |
60 | 62 | |
@@ -71,7 +73,8 @@ discard block |
||
71 | 73 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
72 | 74 | $this->http = $this->app->get(Http::class); |
73 | 75 | |
74 | - $this->http->setHandler(function () { |
|
76 | + $this->http->setHandler(function () |
|
77 | + { |
|
75 | 78 | return $this->cookies()->get('a'); |
76 | 79 | }); |
77 | 80 | |
@@ -88,7 +91,8 @@ discard block |
||
88 | 91 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
89 | 92 | $this->http = $this->app->get(Http::class); |
90 | 93 | |
91 | - $this->http->setHandler(function () { |
|
94 | + $this->http->setHandler(function () |
|
95 | + { |
|
92 | 96 | $this->cookies()->set('a', 'value'); |
93 | 97 | |
94 | 98 | return 'ok'; |
@@ -112,7 +116,8 @@ discard block |
||
112 | 116 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
113 | 117 | $this->http = $this->app->get(Http::class); |
114 | 118 | |
115 | - $this->http->setHandler(function () { |
|
119 | + $this->http->setHandler(function () |
|
120 | + { |
|
116 | 121 | $this->cookies()->schedule(Cookie::create('a', 'value')); |
117 | 122 | $this->assertSame([], $this->cookies()->getAll()); |
118 | 123 | $this->assertCount(1, $this->cookies()->getScheduled()); |
@@ -138,7 +143,8 @@ discard block |
||
138 | 143 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
139 | 144 | $this->http = $this->app->get(Http::class); |
140 | 145 | |
141 | - $this->http->setHandler(function () { |
|
146 | + $this->http->setHandler(function () |
|
147 | + { |
|
142 | 148 | $this->cookies()->delete('cookie'); |
143 | 149 | |
144 | 150 | return 'ok'; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | $psr->shouldReceive('respond')->once()->with( |
46 | - \Mockery::on(function ($r) { |
|
46 | + \Mockery::on(function ($r){ |
|
47 | 47 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
48 | 48 | return true; |
49 | 49 | }) |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $psr->shouldReceive('respond')->once()->with( |
68 | - \Mockery::on(function ($r) { |
|
68 | + \Mockery::on(function ($r){ |
|
69 | 69 | $this->assertStringContainsString('500', (string)$r->getBody()); |
70 | 70 | return true; |
71 | 71 | }) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
75 | 75 | |
76 | 76 | $files = $this->app->get(FilesInterface::class)->getFiles( |
77 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
77 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $this->assertCount(0, $files); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $this->app->get(RrDispatcher::class)->serve($psr); |
83 | 83 | |
84 | 84 | $files = $this->app->get(FilesInterface::class)->getFiles( |
85 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
85 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
86 | 86 | ); |
87 | 87 | |
88 | 88 | $this->assertCount(1, $files); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ); |
104 | 104 | |
105 | 105 | $psr->shouldReceive('respond')->once()->with( |
106 | - \Mockery::on(function ($r) { |
|
106 | + \Mockery::on(function ($r){ |
|
107 | 107 | $this->assertStringContainsString('undefined', (string)$r->getBody()); |
108 | 108 | return true; |
109 | 109 | }) |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
113 | 113 | |
114 | 114 | $files = $this->app->get(FilesInterface::class)->getFiles( |
115 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
115 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
116 | 116 | ); |
117 | 117 | |
118 | 118 | $this->assertCount(0, $files); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->app->get(RrDispatcher::class)->serve($psr); |
121 | 121 | |
122 | 122 | $files = $this->app->get(FilesInterface::class)->getFiles( |
123 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
123 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
124 | 124 | ); |
125 | 125 | |
126 | 126 | $this->assertCount(1, $files); |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | $psr->shouldReceive('respond')->once()->with( |
46 | - \Mockery::on(function ($r) { |
|
46 | + \Mockery::on(function ($r) |
|
47 | + { |
|
47 | 48 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
48 | 49 | return true; |
49 | 50 | }) |
@@ -65,7 +66,8 @@ discard block |
||
65 | 66 | ); |
66 | 67 | |
67 | 68 | $psr->shouldReceive('respond')->once()->with( |
68 | - \Mockery::on(function ($r) { |
|
69 | + \Mockery::on(function ($r) |
|
70 | + { |
|
69 | 71 | $this->assertStringContainsString('500', (string)$r->getBody()); |
70 | 72 | return true; |
71 | 73 | }) |
@@ -103,7 +105,8 @@ discard block |
||
103 | 105 | ); |
104 | 106 | |
105 | 107 | $psr->shouldReceive('respond')->once()->with( |
106 | - \Mockery::on(function ($r) { |
|
108 | + \Mockery::on(function ($r) |
|
109 | + { |
|
107 | 110 | $this->assertStringContainsString('undefined', (string)$r->getBody()); |
108 | 111 | return true; |
109 | 112 | }) |