@@ -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 | }) |
@@ -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,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,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 | }) |
@@ -19,7 +19,8 @@ |
||
| 19 | 19 | { |
| 20 | 20 | $output = $this->runCommand('php:extensions'); |
| 21 | 21 | |
| 22 | - foreach (get_loaded_extensions() as $extension) { |
|
| 22 | + foreach (get_loaded_extensions() as $extension) |
|
| 23 | + { |
|
| 23 | 24 | $this->assertStringContainsString($extension, $output); |
| 24 | 25 | } |
| 25 | 26 | } |