@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | CookiesConfig $cookiesConfig, |
| 58 | 58 | SessionFactory $factory, |
| 59 | 59 | ScopeInterface $scope |
| 60 | - ) { |
|
| 60 | + ){ |
|
| 61 | 61 | $this->config = $config; |
| 62 | 62 | $this->httpConfig = $httpConfig; |
| 63 | 63 | $this->cookiesConfig = $cookiesConfig; |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | $this->fetchID($request) |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | - try { |
|
| 79 | + try{ |
|
| 80 | 80 | $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
| 81 | - } catch (\Throwable $e) { |
|
| 81 | + }catch (\Throwable $e){ |
|
| 82 | 82 | $session->abort(); |
| 83 | 83 | throw $e; |
| 84 | 84 | } |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | Request $request, |
| 98 | 98 | Response $response |
| 99 | 99 | ): Response { |
| 100 | - if (!$session->isStarted()) { |
|
| 100 | + if (!$session->isStarted()){ |
|
| 101 | 101 | return $response; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $session->commit(); |
| 105 | 105 | |
| 106 | 106 | //SID changed |
| 107 | - if ($this->fetchID($request) != $session->getID()) { |
|
| 107 | + if ($this->fetchID($request) != $session->getID()){ |
|
| 108 | 108 | return $this->withCookie($request, $response, $session->getID()); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | protected function fetchID(Request $request): ?string |
| 122 | 122 | { |
| 123 | 123 | $cookies = $request->getCookieParams(); |
| 124 | - if (empty($cookies[$this->config->getCookie()])) { |
|
| 124 | + if (empty($cookies[$this->config->getCookie()])){ |
|
| 125 | 125 | return null; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | protected function clientSignature(Request $request): string |
| 155 | 155 | { |
| 156 | 156 | $signature = ''; |
| 157 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
| 158 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
| 157 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
| 158 | + $signature .= $request->getHeaderLine($header).';'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return hash('sha256', $signature); |
@@ -76,9 +76,12 @@ discard block |
||
| 76 | 76 | $this->fetchID($request) |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | - try { |
|
| 79 | + try |
|
| 80 | + { |
|
| 80 | 81 | $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
| 81 | - } catch (\Throwable $e) { |
|
| 82 | + } |
|
| 83 | + catch (\Throwable $e) |
|
| 84 | + { |
|
| 82 | 85 | $session->abort(); |
| 83 | 86 | throw $e; |
| 84 | 87 | } |
@@ -97,14 +100,16 @@ discard block |
||
| 97 | 100 | Request $request, |
| 98 | 101 | Response $response |
| 99 | 102 | ): Response { |
| 100 | - if (!$session->isStarted()) { |
|
| 103 | + if (!$session->isStarted()) |
|
| 104 | + { |
|
| 101 | 105 | return $response; |
| 102 | 106 | } |
| 103 | 107 | |
| 104 | 108 | $session->commit(); |
| 105 | 109 | |
| 106 | 110 | //SID changed |
| 107 | - if ($this->fetchID($request) != $session->getID()) { |
|
| 111 | + if ($this->fetchID($request) != $session->getID()) |
|
| 112 | + { |
|
| 108 | 113 | return $this->withCookie($request, $response, $session->getID()); |
| 109 | 114 | } |
| 110 | 115 | |
@@ -121,7 +126,8 @@ discard block |
||
| 121 | 126 | protected function fetchID(Request $request): ?string |
| 122 | 127 | { |
| 123 | 128 | $cookies = $request->getCookieParams(); |
| 124 | - if (empty($cookies[$this->config->getCookie()])) { |
|
| 129 | + if (empty($cookies[$this->config->getCookie()])) |
|
| 130 | + { |
|
| 125 | 131 | return null; |
| 126 | 132 | } |
| 127 | 133 | |
@@ -154,7 +160,8 @@ discard block |
||
| 154 | 160 | protected function clientSignature(Request $request): string |
| 155 | 161 | { |
| 156 | 162 | $signature = ''; |
| 157 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
| 163 | + foreach (static::SIGNATURE_HEADERS as $header) |
|
| 164 | + { |
|
| 158 | 165 | $signature .= $request->getHeaderLine($header) . ';'; |
| 159 | 166 | } |
| 160 | 167 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | PermissionsInterface $permissions, |
| 42 | 42 | ContainerInterface $actorScope, |
| 43 | 43 | array $roles = [] |
| 44 | - ) { |
|
| 44 | + ){ |
|
| 45 | 45 | $this->roles = $roles; |
| 46 | 46 | $this->container = $actorScope; |
| 47 | 47 | $this->permissions = $permissions; |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | public function allows(string $permission, array $context = []): bool |
| 54 | 54 | { |
| 55 | 55 | $allows = false; |
| 56 | - foreach ($this->getRoles() as $role) { |
|
| 57 | - if (!$this->permissions->hasRole($role)) { |
|
| 56 | + foreach ($this->getRoles() as $role){ |
|
| 57 | + if (!$this->permissions->hasRole($role)){ |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function getActor(): ActorInterface |
| 102 | 102 | { |
| 103 | - if (!is_null($this->actor)) { |
|
| 103 | + if (!is_null($this->actor)){ |
|
| 104 | 104 | return $this->actor; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - try { |
|
| 107 | + try{ |
|
| 108 | 108 | return $this->container->get(ActorInterface::class); |
| 109 | - } catch (ContainerException $e) { |
|
| 109 | + }catch (ContainerException $e){ |
|
| 110 | 110 | throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -52,8 +52,10 @@ discard block |
||
| 52 | 52 | public function allows(string $permission, array $context = []): bool |
| 53 | 53 | { |
| 54 | 54 | $allows = false; |
| 55 | - foreach ($this->getRoles() as $role) { |
|
| 56 | - if (!$this->permissions->hasRole($role)) { |
|
| 55 | + foreach ($this->getRoles() as $role) |
|
| 56 | + { |
|
| 57 | + if (!$this->permissions->hasRole($role)) |
|
| 58 | + { |
|
| 57 | 59 | continue; |
| 58 | 60 | } |
| 59 | 61 | |
@@ -99,13 +101,17 @@ discard block |
||
| 99 | 101 | */ |
| 100 | 102 | public function getActor(): ActorInterface |
| 101 | 103 | { |
| 102 | - if (!is_null($this->actor)) { |
|
| 104 | + if (!is_null($this->actor)) |
|
| 105 | + { |
|
| 103 | 106 | return $this->actor; |
| 104 | 107 | } |
| 105 | 108 | |
| 106 | - try { |
|
| 109 | + try |
|
| 110 | + { |
|
| 107 | 111 | return $this->container->get(ActorInterface::class); |
| 108 | - } catch (ContainerException $e) { |
|
| 112 | + } |
|
| 113 | + catch (ContainerException $e) |
|
| 114 | + { |
|
| 109 | 115 | throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e); |
| 110 | 116 | } |
| 111 | 117 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | string $domain = null, |
| 109 | 109 | bool $secure = null, |
| 110 | 110 | bool $httpOnly = true |
| 111 | - ) { |
|
| 111 | + ){ |
|
| 112 | 112 | $this->getCookieQueue()->set($name, $value, $lifetime, $path, $domain, $secure, $httpOnly); |
| 113 | 113 | |
| 114 | 114 | return $this; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | private function getRequest(): ServerRequestInterface |
| 161 | 161 | { |
| 162 | - try { |
|
| 162 | + try{ |
|
| 163 | 163 | return $this->container->get(ServerRequestInterface::class); |
| 164 | - } catch (NotFoundExceptionInterface $e) { |
|
| 164 | + }catch (NotFoundExceptionInterface $e){ |
|
| 165 | 165 | throw new ScopeException('Unable to receive active request', $e->getCode(), $e); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | $request = $this->getRequest(); |
| 177 | 177 | $queue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
| 178 | - if ($queue === null) { |
|
| 178 | + if ($queue === null){ |
|
| 179 | 179 | throw new ScopeException('Unable to receive cookie queue, invalid request scope'); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -159,9 +159,12 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | private function getRequest(): ServerRequestInterface |
| 161 | 161 | { |
| 162 | - try { |
|
| 162 | + try |
|
| 163 | + { |
|
| 163 | 164 | return $this->container->get(ServerRequestInterface::class); |
| 164 | - } catch (NotFoundExceptionInterface $e) { |
|
| 165 | + } |
|
| 166 | + catch (NotFoundExceptionInterface $e) |
|
| 167 | + { |
|
| 165 | 168 | throw new ScopeException('Unable to receive active request', $e->getCode(), $e); |
| 166 | 169 | } |
| 167 | 170 | } |
@@ -175,7 +178,8 @@ discard block |
||
| 175 | 178 | { |
| 176 | 179 | $request = $this->getRequest(); |
| 177 | 180 | $queue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
| 178 | - if ($queue === null) { |
|
| 181 | + if ($queue === null) |
|
| 182 | + { |
|
| 179 | 183 | throw new ScopeException('Unable to receive cookie queue, invalid request scope'); |
| 180 | 184 | } |
| 181 | 185 | |
@@ -121,15 +121,15 @@ |
||
| 121 | 121 | */ |
| 122 | 122 | private function getSession(): SessionInterface |
| 123 | 123 | { |
| 124 | - try { |
|
| 124 | + try{ |
|
| 125 | 125 | $request = $this->container->get(ServerRequestInterface::class); |
| 126 | 126 | $session = $request->getAttribute(SessionMiddleware::ATTRIBUTE); |
| 127 | - if ($session === null) { |
|
| 127 | + if ($session === null){ |
|
| 128 | 128 | throw new ScopeException('Unable to receive active Session, invalid request scope'); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | return $session; |
| 132 | - } catch (NotFoundExceptionInterface $e) { |
|
| 132 | + }catch (NotFoundExceptionInterface $e){ |
|
| 133 | 133 | throw new ScopeException('Unable to receive active session', $e->getCode(), $e); |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -121,15 +121,19 @@ |
||
| 121 | 121 | */ |
| 122 | 122 | private function getSession(): SessionInterface |
| 123 | 123 | { |
| 124 | - try { |
|
| 124 | + try |
|
| 125 | + { |
|
| 125 | 126 | $request = $this->container->get(ServerRequestInterface::class); |
| 126 | 127 | $session = $request->getAttribute(SessionMiddleware::ATTRIBUTE); |
| 127 | - if ($session === null) { |
|
| 128 | + if ($session === null) |
|
| 129 | + { |
|
| 128 | 130 | throw new ScopeException('Unable to receive active Session, invalid request scope'); |
| 129 | 131 | } |
| 130 | 132 | |
| 131 | 133 | return $session; |
| 132 | - } catch (NotFoundExceptionInterface $e) { |
|
| 134 | + } |
|
| 135 | + catch (NotFoundExceptionInterface $e) |
|
| 136 | + { |
|
| 133 | 137 | throw new ScopeException('Unable to receive active session', $e->getCode(), $e); |
| 134 | 138 | } |
| 135 | 139 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | private function route(ServerRequestInterface $request): RouteInterface |
| 58 | 58 | { |
| 59 | 59 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
| 60 | - if ($route === null) { |
|
| 60 | + if ($route === null){ |
|
| 61 | 61 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -57,7 +57,8 @@ |
||
| 57 | 57 | private function route(ServerRequestInterface $request): RouteInterface |
| 58 | 58 | { |
| 59 | 59 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
| 60 | - if ($route === null) { |
|
| 60 | + if ($route === null) |
|
| 61 | + { |
|
| 61 | 62 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
| 62 | 63 | } |
| 63 | 64 | |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
| 73 | 73 | { |
| 74 | 74 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
| 75 | - if ($cookieQueue === null) { |
|
| 75 | + if ($cookieQueue === null){ |
|
| 76 | 76 | throw new ScopeException('Unable to resolve CookieQueue, invalid request scope'); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -72,7 +72,8 @@ |
||
| 72 | 72 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
| 73 | 73 | { |
| 74 | 74 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
| 75 | - if ($cookieQueue === null) { |
|
| 75 | + if ($cookieQueue === null) |
|
| 76 | + { |
|
| 76 | 77 | throw new ScopeException('Unable to resolve CookieQueue, invalid request scope'); |
| 77 | 78 | } |
| 78 | 79 | |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | public function setUp(): void |
| 23 | 23 | { |
| 24 | 24 | exec('protoc 2>&1', $out); |
| 25 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
| 25 | + if (strpos(join("\n", $out), '--php_out') === false){ |
|
| 26 | 26 | $this->markTestSkipped('Protoc binary is missing'); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | parent::setUp(); |
| 30 | 30 | |
| 31 | 31 | $fs = new Files(); |
| 32 | - $proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
| 32 | + $proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
| 33 | 33 | |
| 34 | 34 | // protoc can't figure relative paths |
| 35 | 35 | $proto = str_replace('Framework/../', '', $proto); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | 'proto' => $proto |
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | - file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
| 41 | + file_put_contents($this->app->dir('app').'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function tearDown(): void |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $fs = new Files(); |
| 49 | 49 | |
| 50 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
| 51 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
| 50 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
| 51 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
| 55 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
| 54 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
| 55 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $msg->setMsg('hello'); |
| 79 | 79 | |
| 80 | 80 | $w->shouldReceive('receive')->once()->with( |
| 81 | - \Mockery::on(function (&$context) { |
|
| 81 | + \Mockery::on(function (&$context){ |
|
| 82 | 82 | $context = '{ |
| 83 | 83 | "service": "service.Echo", |
| 84 | 84 | "method": "Ping" |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | )->andReturn($msg->serializeToString()); |
| 90 | 90 | |
| 91 | 91 | $w->shouldReceive('send')->once()->with( |
| 92 | - \Mockery::on(function ($out) { |
|
| 92 | + \Mockery::on(function ($out){ |
|
| 93 | 93 | $msg = new Message(); |
| 94 | 94 | $msg->mergeFromString($out); |
| 95 | 95 | $this->assertSame('hello', $msg->getMsg()); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // one command only |
| 102 | 102 | $w->shouldReceive('receive')->once()->with( |
| 103 | - \Mockery::on(function (&$context) { |
|
| 103 | + \Mockery::on(function (&$context){ |
|
| 104 | 104 | $context = null; |
| 105 | 105 | return true; |
| 106 | 106 | }) |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $msg->setMsg('hello'); |
| 121 | 121 | |
| 122 | 122 | $w->shouldReceive('receive')->once()->with( |
| 123 | - \Mockery::on(function (&$context) { |
|
| 123 | + \Mockery::on(function (&$context){ |
|
| 124 | 124 | $context = '{ |
| 125 | 125 | "service": "service.Echo", |
| 126 | 126 | "method": "Invalid" |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | )->andReturn($msg->serializeToString()); |
| 132 | 132 | |
| 133 | 133 | $w->shouldReceive('error')->once()->with( |
| 134 | - \Mockery::on(function ($out) { |
|
| 134 | + \Mockery::on(function ($out){ |
|
| 135 | 135 | $this->assertContains('Method `Invalid` not found', $out); |
| 136 | 136 | return true; |
| 137 | 137 | }) |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | // one command only |
| 141 | 141 | $w->shouldReceive('receive')->once()->with( |
| 142 | - \Mockery::on(function (&$context) { |
|
| 142 | + \Mockery::on(function (&$context){ |
|
| 143 | 143 | $context = null; |
| 144 | 144 | return true; |
| 145 | 145 | }) |
@@ -22,7 +22,8 @@ discard block |
||
| 22 | 22 | public function setUp(): void |
| 23 | 23 | { |
| 24 | 24 | exec('protoc 2>&1', $out); |
| 25 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
| 25 | + if (strpos(join("\n", $out), '--php_out') === false) |
|
| 26 | + { |
|
| 26 | 27 | $this->markTestSkipped('Protoc binary is missing'); |
| 27 | 28 | } |
| 28 | 29 | |
@@ -47,11 +48,13 @@ discard block |
||
| 47 | 48 | |
| 48 | 49 | $fs = new Files(); |
| 49 | 50 | |
| 50 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
| 51 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
| 52 | + { |
|
| 51 | 53 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
| 52 | 54 | } |
| 53 | 55 | |
| 54 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
| 56 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
| 57 | + { |
|
| 55 | 58 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
| 56 | 59 | } |
| 57 | 60 | } |
@@ -78,7 +81,8 @@ discard block |
||
| 78 | 81 | $msg->setMsg('hello'); |
| 79 | 82 | |
| 80 | 83 | $w->shouldReceive('receive')->once()->with( |
| 81 | - \Mockery::on(function (&$context) { |
|
| 84 | + \Mockery::on(function (&$context) |
|
| 85 | + { |
|
| 82 | 86 | $context = '{ |
| 83 | 87 | "service": "service.Echo", |
| 84 | 88 | "method": "Ping" |
@@ -89,7 +93,8 @@ discard block |
||
| 89 | 93 | )->andReturn($msg->serializeToString()); |
| 90 | 94 | |
| 91 | 95 | $w->shouldReceive('send')->once()->with( |
| 92 | - \Mockery::on(function ($out) { |
|
| 96 | + \Mockery::on(function ($out) |
|
| 97 | + { |
|
| 93 | 98 | $msg = new Message(); |
| 94 | 99 | $msg->mergeFromString($out); |
| 95 | 100 | $this->assertSame('hello', $msg->getMsg()); |
@@ -100,7 +105,8 @@ discard block |
||
| 100 | 105 | |
| 101 | 106 | // one command only |
| 102 | 107 | $w->shouldReceive('receive')->once()->with( |
| 103 | - \Mockery::on(function (&$context) { |
|
| 108 | + \Mockery::on(function (&$context) |
|
| 109 | + { |
|
| 104 | 110 | $context = null; |
| 105 | 111 | return true; |
| 106 | 112 | }) |
@@ -120,7 +126,8 @@ discard block |
||
| 120 | 126 | $msg->setMsg('hello'); |
| 121 | 127 | |
| 122 | 128 | $w->shouldReceive('receive')->once()->with( |
| 123 | - \Mockery::on(function (&$context) { |
|
| 129 | + \Mockery::on(function (&$context) |
|
| 130 | + { |
|
| 124 | 131 | $context = '{ |
| 125 | 132 | "service": "service.Echo", |
| 126 | 133 | "method": "Invalid" |
@@ -131,7 +138,8 @@ discard block |
||
| 131 | 138 | )->andReturn($msg->serializeToString()); |
| 132 | 139 | |
| 133 | 140 | $w->shouldReceive('error')->once()->with( |
| 134 | - \Mockery::on(function ($out) { |
|
| 141 | + \Mockery::on(function ($out) |
|
| 142 | + { |
|
| 135 | 143 | $this->assertContains('Method `Invalid` not found', $out); |
| 136 | 144 | return true; |
| 137 | 145 | }) |
@@ -139,7 +147,8 @@ discard block |
||
| 139 | 147 | |
| 140 | 148 | // one command only |
| 141 | 149 | $w->shouldReceive('receive')->once()->with( |
| 142 | - \Mockery::on(function (&$context) { |
|
| 150 | + \Mockery::on(function (&$context) |
|
| 151 | + { |
|
| 143 | 152 | $context = null; |
| 144 | 153 | return true; |
| 145 | 154 | }) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
| 42 | 42 | |
| 43 | 43 | $w->shouldReceive('receive')->once()->with( |
| 44 | - \Mockery::on(function (&$context) { |
|
| 44 | + \Mockery::on(function (&$context){ |
|
| 45 | 45 | $context = '{ |
| 46 | 46 | "id": "1", |
| 47 | 47 | "job": "spiral.app.job.TestJob" |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->app->getContainer()->bind(Worker::class, $w); |
| 70 | 70 | |
| 71 | 71 | $w->shouldReceive('receive')->once()->with( |
| 72 | - \Mockery::on(function (&$context) { |
|
| 72 | + \Mockery::on(function (&$context){ |
|
| 73 | 73 | $context = '{ |
| 74 | 74 | "id": "1", |
| 75 | 75 | "job": "spiral.app.job.ErrorJob" |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $w->shouldReceive('receive')->once()->andReturn(null); |
| 86 | 86 | |
| 87 | 87 | $files = $this->app->get(FilesInterface::class)->getFiles( |
| 88 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
| 88 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | 91 | $this->assertCount(0, $files); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->app->get(JobDispatcher::class)->serve(); |
| 94 | 94 | |
| 95 | 95 | $files = $this->app->get(FilesInterface::class)->getFiles( |
| 96 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
| 96 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | $this->assertCount(1, $files); |
@@ -41,7 +41,8 @@ discard block |
||
| 41 | 41 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
| 42 | 42 | |
| 43 | 43 | $w->shouldReceive('receive')->once()->with( |
| 44 | - \Mockery::on(function (&$context) { |
|
| 44 | + \Mockery::on(function (&$context) |
|
| 45 | + { |
|
| 45 | 46 | $context = '{ |
| 46 | 47 | "id": "1", |
| 47 | 48 | "job": "spiral.app.job.TestJob" |
@@ -69,7 +70,8 @@ discard block |
||
| 69 | 70 | $this->app->getContainer()->bind(Worker::class, $w); |
| 70 | 71 | |
| 71 | 72 | $w->shouldReceive('receive')->once()->with( |
| 72 | - \Mockery::on(function (&$context) { |
|
| 73 | + \Mockery::on(function (&$context) |
|
| 74 | + { |
|
| 73 | 75 | $context = '{ |
| 74 | 76 | "id": "1", |
| 75 | 77 | "job": "spiral.app.job.ErrorJob" |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | public function testSetSid(): void |
| 20 | 20 | { |
| 21 | - $this->http->setHandler(function () { |
|
| 21 | + $this->http->setHandler(function (){ |
|
| 22 | 22 | return ++$this->session()->getSection('cli')->value; |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function testSessionResume(): void |
| 34 | 34 | { |
| 35 | - $this->http->setHandler(function () { |
|
| 35 | + $this->http->setHandler(function (){ |
|
| 36 | 36 | return ++$this->session()->getSection('cli')->value; |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function testSessionRegenerateId(): void |
| 58 | 58 | { |
| 59 | - $this->http->setHandler(function () { |
|
| 59 | + $this->http->setHandler(function (){ |
|
| 60 | 60 | return ++$this->session()->getSection('cli')->value; |
| 61 | 61 | }); |
| 62 | 62 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $this->assertSame(200, $result->getStatusCode()); |
| 74 | 74 | $this->assertSame('2', $result->getBody()->__toString()); |
| 75 | 75 | |
| 76 | - $this->http->setHandler(function () { |
|
| 76 | + $this->http->setHandler(function (){ |
|
| 77 | 77 | $this->session()->regenerateID(false); |
| 78 | 78 | |
| 79 | 79 | return ++$this->session()->getSection('cli')->value; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function testDestroySession(): void |
| 94 | 94 | { |
| 95 | - $this->http->setHandler(function () { |
|
| 95 | + $this->http->setHandler(function (){ |
|
| 96 | 96 | return ++$this->session()->getSection('cli')->value; |
| 97 | 97 | }); |
| 98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ]); |
| 106 | 106 | $this->assertSame(200, $result->getStatusCode()); |
| 107 | 107 | $this->assertSame('2', $result->getBody()->__toString()); |
| 108 | - $this->http->setHandler(function () { |
|
| 108 | + $this->http->setHandler(function (){ |
|
| 109 | 109 | $this->session()->destroy(); |
| 110 | 110 | $this->assertFalse($this->session()->isStarted()); |
| 111 | 111 | |
@@ -18,7 +18,8 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | public function testSetSid(): void |
| 20 | 20 | { |
| 21 | - $this->http->setHandler(function () { |
|
| 21 | + $this->http->setHandler(function () |
|
| 22 | + { |
|
| 22 | 23 | return ++$this->session()->getSection('cli')->value; |
| 23 | 24 | }); |
| 24 | 25 | |
@@ -32,7 +33,8 @@ discard block |
||
| 32 | 33 | |
| 33 | 34 | public function testSessionResume(): void |
| 34 | 35 | { |
| 35 | - $this->http->setHandler(function () { |
|
| 36 | + $this->http->setHandler(function () |
|
| 37 | + { |
|
| 36 | 38 | return ++$this->session()->getSection('cli')->value; |
| 37 | 39 | }); |
| 38 | 40 | |
@@ -56,7 +58,8 @@ discard block |
||
| 56 | 58 | |
| 57 | 59 | public function testSessionRegenerateId(): void |
| 58 | 60 | { |
| 59 | - $this->http->setHandler(function () { |
|
| 61 | + $this->http->setHandler(function () |
|
| 62 | + { |
|
| 60 | 63 | return ++$this->session()->getSection('cli')->value; |
| 61 | 64 | }); |
| 62 | 65 | |
@@ -73,7 +76,8 @@ discard block |
||
| 73 | 76 | $this->assertSame(200, $result->getStatusCode()); |
| 74 | 77 | $this->assertSame('2', $result->getBody()->__toString()); |
| 75 | 78 | |
| 76 | - $this->http->setHandler(function () { |
|
| 79 | + $this->http->setHandler(function () |
|
| 80 | + { |
|
| 77 | 81 | $this->session()->regenerateID(false); |
| 78 | 82 | |
| 79 | 83 | return ++$this->session()->getSection('cli')->value; |
@@ -92,7 +96,8 @@ discard block |
||
| 92 | 96 | |
| 93 | 97 | public function testDestroySession(): void |
| 94 | 98 | { |
| 95 | - $this->http->setHandler(function () { |
|
| 99 | + $this->http->setHandler(function () |
|
| 100 | + { |
|
| 96 | 101 | return ++$this->session()->getSection('cli')->value; |
| 97 | 102 | }); |
| 98 | 103 | |
@@ -105,7 +110,8 @@ discard block |
||
| 105 | 110 | ]); |
| 106 | 111 | $this->assertSame(200, $result->getStatusCode()); |
| 107 | 112 | $this->assertSame('2', $result->getBody()->__toString()); |
| 108 | - $this->http->setHandler(function () { |
|
| 113 | + $this->http->setHandler(function () |
|
| 114 | + { |
|
| 109 | 115 | $this->session()->destroy(); |
| 110 | 116 | $this->assertFalse($this->session()->isStarted()); |
| 111 | 117 | |