@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | FinalizerInterface $finalizer, |
50 | 50 | ContainerInterface $container, |
51 | 51 | FactoryInterface $factory |
52 | - ) { |
|
52 | + ){ |
|
53 | 53 | $this->env = $env; |
54 | 54 | $this->finalizer = $finalizer; |
55 | 55 | $this->container = $container; |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | |
76 | 76 | /** @var Http $http */ |
77 | 77 | $http = $this->container->get(Http::class); |
78 | - while ($request = $client->acceptRequest()) { |
|
79 | - try { |
|
78 | + while ($request = $client->acceptRequest()){ |
|
79 | + try{ |
|
80 | 80 | $client->respond($http->handle($request)); |
81 | - } catch (\Throwable $e) { |
|
81 | + }catch (\Throwable $e){ |
|
82 | 82 | $this->handleException($client, $e); |
83 | - } finally { |
|
83 | + }finally{ |
|
84 | 84 | $this->finalizer->finalize(false); |
85 | 85 | } |
86 | 86 | } |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | { |
95 | 95 | $handler = new HtmlHandler(); |
96 | 96 | |
97 | - try { |
|
97 | + try{ |
|
98 | 98 | /** @var SnapshotInterface $snapshot */ |
99 | 99 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
100 | 100 | error_log($snapshot->getMessage()); |
101 | 101 | |
102 | 102 | // on demand |
103 | 103 | $state = $this->container->get(StateInterface::class); |
104 | - if ($state !== null) { |
|
104 | + if ($state !== null){ |
|
105 | 105 | $handler = $handler->withState($state); |
106 | 106 | } |
107 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
107 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
108 | 108 | error_log((string)$e); |
109 | 109 | } |
110 | 110 |
@@ -75,12 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | /** @var Http $http */ |
77 | 77 | $http = $this->container->get(Http::class); |
78 | - while ($request = $client->acceptRequest()) { |
|
79 | - try { |
|
78 | + while ($request = $client->acceptRequest()) |
|
79 | + { |
|
80 | + try |
|
81 | + { |
|
80 | 82 | $client->respond($http->handle($request)); |
81 | - } catch (\Throwable $e) { |
|
83 | + } |
|
84 | + catch (\Throwable $e) |
|
85 | + { |
|
82 | 86 | $this->handleException($client, $e); |
83 | - } finally { |
|
87 | + } |
|
88 | + finally |
|
89 | + { |
|
84 | 90 | $this->finalizer->finalize(false); |
85 | 91 | } |
86 | 92 | } |
@@ -94,17 +100,21 @@ discard block |
||
94 | 100 | { |
95 | 101 | $handler = new HtmlHandler(); |
96 | 102 | |
97 | - try { |
|
103 | + try |
|
104 | + { |
|
98 | 105 | /** @var SnapshotInterface $snapshot */ |
99 | 106 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
100 | 107 | error_log($snapshot->getMessage()); |
101 | 108 | |
102 | 109 | // on demand |
103 | 110 | $state = $this->container->get(StateInterface::class); |
104 | - if ($state !== null) { |
|
111 | + if ($state !== null) |
|
112 | + { |
|
105 | 113 | $handler = $handler->withState($state); |
106 | 114 | } |
107 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
115 | + } |
|
116 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
117 | + { |
|
108 | 118 | error_log((string)$e); |
109 | 119 | } |
110 | 120 |
@@ -43,8 +43,8 @@ |
||
43 | 43 | { |
44 | 44 | $state->setTag('php', phpversion()); |
45 | 45 | |
46 | - if ($this->container->get(DispatcherInterface::class)) { |
|
47 | - switch (get_class($this->container->get(DispatcherInterface::class))) { |
|
46 | + if ($this->container->get(DispatcherInterface::class)){ |
|
47 | + switch (get_class($this->container->get(DispatcherInterface::class))){ |
|
48 | 48 | case RrDispatcher::class: |
49 | 49 | $state->setTag('dispatcher', 'roadrunner'); |
50 | 50 | break; |
@@ -43,8 +43,10 @@ |
||
43 | 43 | { |
44 | 44 | $state->setTag('php', phpversion()); |
45 | 45 | |
46 | - if ($this->container->get(DispatcherInterface::class)) { |
|
47 | - switch (get_class($this->container->get(DispatcherInterface::class))) { |
|
46 | + if ($this->container->get(DispatcherInterface::class)) |
|
47 | + { |
|
48 | + switch (get_class($this->container->get(DispatcherInterface::class))) |
|
49 | + { |
|
48 | 50 | case RrDispatcher::class: |
49 | 51 | $state->setTag('dispatcher', 'roadrunner'); |
50 | 52 | break; |
@@ -74,7 +74,7 @@ |
||
74 | 74 | |
75 | 75 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
76 | 76 | |
77 | - if (class_exists(PSR7Client::class)) { |
|
77 | + if (class_exists(PSR7Client::class)){ |
|
78 | 78 | $kernel->addDispatcher($factory->make(RrDispatcher::class)); |
79 | 79 | } |
80 | 80 | } |
@@ -74,7 +74,8 @@ |
||
74 | 74 | |
75 | 75 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
76 | 76 | |
77 | - if (class_exists(PSR7Client::class)) { |
|
77 | + if (class_exists(PSR7Client::class)) |
|
78 | + { |
|
78 | 79 | $kernel->addDispatcher($factory->make(RrDispatcher::class)); |
79 | 80 | } |
80 | 81 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getActor(TokenInterface $token): ?object |
54 | 54 | { |
55 | - foreach ($this->getProviders() as $provider) { |
|
56 | - if (!$provider instanceof ActorProviderInterface) { |
|
55 | + foreach ($this->getProviders() as $provider){ |
|
56 | + if (!$provider instanceof ActorProviderInterface){ |
|
57 | 57 | throw new AuthException( |
58 | 58 | sprintf( |
59 | 59 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | $actor = $provider->getActor($token); |
66 | - if ($actor !== null) { |
|
66 | + if ($actor !== null){ |
|
67 | 67 | return $actor; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - if ($this->actorProvider === []) { |
|
71 | + if ($this->actorProvider === []){ |
|
72 | 72 | throw new AuthException('No actor provider'); |
73 | 73 | } |
74 | 74 | |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private function getProviders(): \Generator |
92 | 92 | { |
93 | - foreach ($this->actorProvider as $provider) { |
|
94 | - if ($provider instanceof Autowire) { |
|
93 | + foreach ($this->actorProvider as $provider){ |
|
94 | + if ($provider instanceof Autowire){ |
|
95 | 95 | yield $provider->resolve($this->factory); |
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | - if (is_object($provider)) { |
|
99 | + if (is_object($provider)){ |
|
100 | 100 | yield $provider; |
101 | 101 | continue; |
102 | 102 | } |
@@ -52,8 +52,10 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getActor(TokenInterface $token): ?object |
54 | 54 | { |
55 | - foreach ($this->getProviders() as $provider) { |
|
56 | - if (!$provider instanceof ActorProviderInterface) { |
|
55 | + foreach ($this->getProviders() as $provider) |
|
56 | + { |
|
57 | + if (!$provider instanceof ActorProviderInterface) |
|
58 | + { |
|
57 | 59 | throw new AuthException( |
58 | 60 | sprintf( |
59 | 61 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -63,12 +65,14 @@ discard block |
||
63 | 65 | } |
64 | 66 | |
65 | 67 | $actor = $provider->getActor($token); |
66 | - if ($actor !== null) { |
|
68 | + if ($actor !== null) |
|
69 | + { |
|
67 | 70 | return $actor; |
68 | 71 | } |
69 | 72 | } |
70 | 73 | |
71 | - if ($this->actorProvider === []) { |
|
74 | + if ($this->actorProvider === []) |
|
75 | + { |
|
72 | 76 | throw new AuthException('No actor provider'); |
73 | 77 | } |
74 | 78 | |
@@ -90,13 +94,16 @@ discard block |
||
90 | 94 | */ |
91 | 95 | private function getProviders(): \Generator |
92 | 96 | { |
93 | - foreach ($this->actorProvider as $provider) { |
|
94 | - if ($provider instanceof Autowire) { |
|
97 | + foreach ($this->actorProvider as $provider) |
|
98 | + { |
|
99 | + if ($provider instanceof Autowire) |
|
100 | + { |
|
95 | 101 | yield $provider->resolve($this->factory); |
96 | 102 | continue; |
97 | 103 | } |
98 | 104 | |
99 | - if (is_object($provider)) { |
|
105 | + if (is_object($provider)) |
|
106 | + { |
|
100 | 107 | yield $provider; |
101 | 108 | continue; |
102 | 109 | } |
@@ -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 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function exists($value, string $role, ?string $field = null): bool |
39 | 39 | { |
40 | 40 | $repository = $this->orm->getRepository($role); |
41 | - if ($field === null) { |
|
41 | + if ($field === null){ |
|
42 | 42 | return $repository->findByPK($value) !== null; |
43 | 43 | } |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $values = $this->withValues($withFields); |
58 | 58 | $values[$field] = $value; |
59 | 59 | |
60 | - if ($this->isProvidedByContext($role, $values)) { |
|
60 | + if ($this->isProvidedByContext($role, $values)){ |
|
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | private function withValues(array $fields): array |
72 | 72 | { |
73 | 73 | $values = []; |
74 | - foreach ($fields as $field) { |
|
75 | - if ($this->getValidator()->hasValue($field)) { |
|
74 | + foreach ($fields as $field){ |
|
75 | + if ($this->getValidator()->hasValue($field)){ |
|
76 | 76 | $values[$field] = $this->getValidator()->getValue($field); |
77 | 77 | } |
78 | 78 | } |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | private function isProvidedByContext(string $role, array $values): bool |
89 | 89 | { |
90 | 90 | $entity = $this->getValidator()->getContext(); |
91 | - if (!is_object($entity) || !$this->orm->getHeap()->has($entity)) { |
|
91 | + if (!is_object($entity) || !$this->orm->getHeap()->has($entity)){ |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $extract = $this->orm->getMapper($role)->extract($entity); |
96 | - foreach ($values as $field => $value) { |
|
97 | - if (!isset($extract[$field]) || $extract[$field] !== $value) { |
|
96 | + foreach ($values as $field => $value){ |
|
97 | + if (!isset($extract[$field]) || $extract[$field] !== $value){ |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | } |
@@ -38,7 +38,8 @@ discard block |
||
38 | 38 | public function exists($value, string $role, ?string $field = null): bool |
39 | 39 | { |
40 | 40 | $repository = $this->orm->getRepository($role); |
41 | - if ($field === null) { |
|
41 | + if ($field === null) |
|
42 | + { |
|
42 | 43 | return $repository->findByPK($value) !== null; |
43 | 44 | } |
44 | 45 | |
@@ -57,7 +58,8 @@ discard block |
||
57 | 58 | $values = $this->withValues($withFields); |
58 | 59 | $values[$field] = $value; |
59 | 60 | |
60 | - if ($this->isProvidedByContext($role, $values)) { |
|
61 | + if ($this->isProvidedByContext($role, $values)) |
|
62 | + { |
|
61 | 63 | return true; |
62 | 64 | } |
63 | 65 | |
@@ -71,8 +73,10 @@ discard block |
||
71 | 73 | private function withValues(array $fields): array |
72 | 74 | { |
73 | 75 | $values = []; |
74 | - foreach ($fields as $field) { |
|
75 | - if ($this->getValidator()->hasValue($field)) { |
|
76 | + foreach ($fields as $field) |
|
77 | + { |
|
78 | + if ($this->getValidator()->hasValue($field)) |
|
79 | + { |
|
76 | 80 | $values[$field] = $this->getValidator()->getValue($field); |
77 | 81 | } |
78 | 82 | } |
@@ -88,13 +92,16 @@ discard block |
||
88 | 92 | private function isProvidedByContext(string $role, array $values): bool |
89 | 93 | { |
90 | 94 | $entity = $this->getValidator()->getContext(); |
91 | - if (!is_object($entity) || !$this->orm->getHeap()->has($entity)) { |
|
95 | + if (!is_object($entity) || !$this->orm->getHeap()->has($entity)) |
|
96 | + { |
|
92 | 97 | return false; |
93 | 98 | } |
94 | 99 | |
95 | 100 | $extract = $this->orm->getMapper($role)->extract($entity); |
96 | - foreach ($values as $field => $value) { |
|
97 | - if (!isset($extract[$field]) || $extract[$field] !== $value) { |
|
101 | + foreach ($values as $field => $value) |
|
102 | + { |
|
103 | + if (!isset($extract[$field]) || $extract[$field] !== $value) |
|
104 | + { |
|
98 | 105 | return false; |
99 | 106 | } |
100 | 107 | } |
@@ -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 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | public function setUp(): void |
24 | 24 | { |
25 | 25 | exec('protoc 2>&1', $out); |
26 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
26 | + if (strpos(join("\n", $out), '--php_out') === false){ |
|
27 | 27 | $this->markTestSkipped('Protoc binary is missing'); |
28 | 28 | } |
29 | 29 | |
30 | 30 | parent::setUp(); |
31 | 31 | |
32 | 32 | $fs = new Files(); |
33 | - $proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
33 | + $proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
34 | 34 | |
35 | 35 | // protoc can't figure relative paths |
36 | 36 | $proto = str_replace('Framework/../', '', $proto); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'proto' => $proto |
40 | 40 | ]); |
41 | 41 | |
42 | - file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
42 | + file_put_contents($this->app->dir('app').'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function tearDown(): void |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | |
49 | 49 | $fs = new Files(); |
50 | 50 | |
51 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
52 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
51 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
52 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
53 | 53 | } |
54 | 54 | |
55 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
56 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
55 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
56 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $msg->setMsg('hello'); |
80 | 80 | |
81 | 81 | $w->shouldReceive('receive')->once()->with( |
82 | - \Mockery::on(function (&$context) { |
|
82 | + \Mockery::on(function (&$context){ |
|
83 | 83 | $context = '{ |
84 | 84 | "service": "service.Echo", |
85 | 85 | "method": "Ping", |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | )->andReturn($msg->serializeToString()); |
92 | 92 | |
93 | 93 | $w->shouldReceive('send')->once()->with( |
94 | - \Mockery::on(function ($out) { |
|
94 | + \Mockery::on(function ($out){ |
|
95 | 95 | $msg = new Message(); |
96 | 96 | $msg->mergeFromString($out); |
97 | 97 | $this->assertSame('hello', $msg->getMsg()); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | // one command only |
105 | 105 | $w->shouldReceive('receive')->once()->with( |
106 | - \Mockery::on(function (&$context) { |
|
106 | + \Mockery::on(function (&$context){ |
|
107 | 107 | $context = null; |
108 | 108 | return true; |
109 | 109 | }) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $msg->setMsg('hello'); |
124 | 124 | |
125 | 125 | $w->shouldReceive('receive')->once()->with( |
126 | - \Mockery::on(function (&$context) { |
|
126 | + \Mockery::on(function (&$context){ |
|
127 | 127 | $context = '{ |
128 | 128 | "service": "service.Echo", |
129 | 129 | "method": "Invalid", |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | )->andReturn($msg->serializeToString()); |
136 | 136 | |
137 | 137 | $w->shouldReceive('error')->once()->with( |
138 | - \Mockery::on(function ($out) { |
|
138 | + \Mockery::on(function ($out){ |
|
139 | 139 | $this->assertStringContainsString('Method `Invalid` not found', $out); |
140 | 140 | return true; |
141 | 141 | }) |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | // one command only |
145 | 145 | $w->shouldReceive('receive')->once()->with( |
146 | - \Mockery::on(function (&$context) { |
|
146 | + \Mockery::on(function (&$context){ |
|
147 | 147 | $context = null; |
148 | 148 | return true; |
149 | 149 | }) |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | public function setUp(): void |
24 | 24 | { |
25 | 25 | exec('protoc 2>&1', $out); |
26 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
26 | + if (strpos(join("\n", $out), '--php_out') === false) |
|
27 | + { |
|
27 | 28 | $this->markTestSkipped('Protoc binary is missing'); |
28 | 29 | } |
29 | 30 | |
@@ -48,11 +49,13 @@ discard block |
||
48 | 49 | |
49 | 50 | $fs = new Files(); |
50 | 51 | |
51 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
52 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
53 | + { |
|
52 | 54 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
53 | 55 | } |
54 | 56 | |
55 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
57 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
58 | + { |
|
56 | 59 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
57 | 60 | } |
58 | 61 | } |
@@ -79,7 +82,8 @@ discard block |
||
79 | 82 | $msg->setMsg('hello'); |
80 | 83 | |
81 | 84 | $w->shouldReceive('receive')->once()->with( |
82 | - \Mockery::on(function (&$context) { |
|
85 | + \Mockery::on(function (&$context) |
|
86 | + { |
|
83 | 87 | $context = '{ |
84 | 88 | "service": "service.Echo", |
85 | 89 | "method": "Ping", |
@@ -91,7 +95,8 @@ discard block |
||
91 | 95 | )->andReturn($msg->serializeToString()); |
92 | 96 | |
93 | 97 | $w->shouldReceive('send')->once()->with( |
94 | - \Mockery::on(function ($out) { |
|
98 | + \Mockery::on(function ($out) |
|
99 | + { |
|
95 | 100 | $msg = new Message(); |
96 | 101 | $msg->mergeFromString($out); |
97 | 102 | $this->assertSame('hello', $msg->getMsg()); |
@@ -103,7 +108,8 @@ discard block |
||
103 | 108 | |
104 | 109 | // one command only |
105 | 110 | $w->shouldReceive('receive')->once()->with( |
106 | - \Mockery::on(function (&$context) { |
|
111 | + \Mockery::on(function (&$context) |
|
112 | + { |
|
107 | 113 | $context = null; |
108 | 114 | return true; |
109 | 115 | }) |
@@ -123,7 +129,8 @@ discard block |
||
123 | 129 | $msg->setMsg('hello'); |
124 | 130 | |
125 | 131 | $w->shouldReceive('receive')->once()->with( |
126 | - \Mockery::on(function (&$context) { |
|
132 | + \Mockery::on(function (&$context) |
|
133 | + { |
|
127 | 134 | $context = '{ |
128 | 135 | "service": "service.Echo", |
129 | 136 | "method": "Invalid", |
@@ -135,7 +142,8 @@ discard block |
||
135 | 142 | )->andReturn($msg->serializeToString()); |
136 | 143 | |
137 | 144 | $w->shouldReceive('error')->once()->with( |
138 | - \Mockery::on(function ($out) { |
|
145 | + \Mockery::on(function ($out) |
|
146 | + { |
|
139 | 147 | $this->assertStringContainsString('Method `Invalid` not found', $out); |
140 | 148 | return true; |
141 | 149 | }) |
@@ -143,7 +151,8 @@ discard block |
||
143 | 151 | |
144 | 152 | // one command only |
145 | 153 | $w->shouldReceive('receive')->once()->with( |
146 | - \Mockery::on(function (&$context) { |
|
154 | + \Mockery::on(function (&$context) |
|
155 | + { |
|
147 | 156 | $context = null; |
148 | 157 | return true; |
149 | 158 | }) |
@@ -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 | } |