@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $e = new BufferEmitter(); |
40 | 40 | |
41 | 41 | $files = $this->app->get(FilesInterface::class)->getFiles( |
42 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
42 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
43 | 43 | ); |
44 | 44 | |
45 | 45 | $this->assertCount(0, $files); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->app->get(SapiDispatcher::class)->serve($e); |
49 | 49 | |
50 | 50 | $files = $this->app->get(FilesInterface::class)->getFiles( |
51 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
51 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
52 | 52 | ); |
53 | 53 | |
54 | 54 | $this->assertCount(1, $files); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ]); |
66 | 66 | |
67 | 67 | $files = $app->get(FilesInterface::class)->getFiles( |
68 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
68 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | $this->assertCount(0, $files); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $app->get(SapiDispatcher::class)->serve($e); |
75 | 75 | |
76 | 76 | $files = $app->get(FilesInterface::class)->getFiles( |
77 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
77 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $this->assertCount(1, $files); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | parent::setUp(); |
24 | - ini_set('error_log', __DIR__ . '/err.log'); |
|
24 | + ini_set('error_log', __DIR__.'/err.log'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function tearDown() |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | parent::tearDown(); |
30 | 30 | ini_set('error_log', 'stderr'); |
31 | 31 | |
32 | - if (file_exists(__DIR__ . '/err.log')) { |
|
33 | - unlink(__DIR__ . '/err.log'); |
|
32 | + if (file_exists(__DIR__.'/err.log')){ |
|
33 | + unlink(__DIR__.'/err.log'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ); |
57 | 57 | |
58 | 58 | $psr->shouldReceive('respond')->once()->with( |
59 | - \Mockery::on(function ($r) { |
|
59 | + \Mockery::on(function ($r){ |
|
60 | 60 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
61 | 61 | return true; |
62 | 62 | }) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ); |
79 | 79 | |
80 | 80 | $psr->shouldReceive('respond')->once()->with( |
81 | - \Mockery::on(function ($r) { |
|
81 | + \Mockery::on(function ($r){ |
|
82 | 82 | $this->assertContains('500', (string)$r->getBody()); |
83 | 83 | return true; |
84 | 84 | }) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
88 | 88 | |
89 | 89 | $files = $this->app->get(FilesInterface::class)->getFiles( |
90 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
90 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
91 | 91 | ); |
92 | 92 | |
93 | 93 | $this->assertCount(0, $files); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->app->get(RrDispacher::class)->serve($psr); |
96 | 96 | |
97 | 97 | $files = $this->app->get(FilesInterface::class)->getFiles( |
98 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
98 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | $this->assertCount(1, $files); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ); |
117 | 117 | |
118 | 118 | $psr->shouldReceive('respond')->once()->with( |
119 | - \Mockery::on(function ($r) { |
|
119 | + \Mockery::on(function ($r){ |
|
120 | 120 | $this->assertContains('undefined', (string)$r->getBody()); |
121 | 121 | return true; |
122 | 122 | }) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
126 | 126 | |
127 | 127 | $files = $this->app->get(FilesInterface::class)->getFiles( |
128 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
128 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $this->assertCount(0, $files); |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | $this->app->get(RrDispacher::class)->serve($psr); |
134 | 134 | |
135 | 135 | $files = $this->app->get(FilesInterface::class)->getFiles( |
136 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
136 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
137 | 137 | ); |
138 | 138 | |
139 | 139 | $this->assertCount(1, $files); |
140 | 140 | |
141 | - $this->assertContains('undefined', file_get_contents(__DIR__ . '/err.log')); |
|
141 | + $this->assertContains('undefined', file_get_contents(__DIR__.'/err.log')); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | \ No newline at end of file |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | parent::tearDown(); |
30 | 30 | ini_set('error_log', 'stderr'); |
31 | 31 | |
32 | - if (file_exists(__DIR__ . '/err.log')) { |
|
32 | + if (file_exists(__DIR__ . '/err.log')) |
|
33 | + { |
|
33 | 34 | unlink(__DIR__ . '/err.log'); |
34 | 35 | } |
35 | 36 | } |
@@ -56,7 +57,8 @@ discard block |
||
56 | 57 | ); |
57 | 58 | |
58 | 59 | $psr->shouldReceive('respond')->once()->with( |
59 | - \Mockery::on(function ($r) { |
|
60 | + \Mockery::on(function ($r) |
|
61 | + { |
|
60 | 62 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
61 | 63 | return true; |
62 | 64 | }) |
@@ -78,7 +80,8 @@ discard block |
||
78 | 80 | ); |
79 | 81 | |
80 | 82 | $psr->shouldReceive('respond')->once()->with( |
81 | - \Mockery::on(function ($r) { |
|
83 | + \Mockery::on(function ($r) |
|
84 | + { |
|
82 | 85 | $this->assertContains('500', (string)$r->getBody()); |
83 | 86 | return true; |
84 | 87 | }) |
@@ -116,7 +119,8 @@ discard block |
||
116 | 119 | ); |
117 | 120 | |
118 | 121 | $psr->shouldReceive('respond')->once()->with( |
119 | - \Mockery::on(function ($r) { |
|
122 | + \Mockery::on(function ($r) |
|
123 | + { |
|
120 | 124 | $this->assertContains('undefined', (string)$r->getBody()); |
121 | 125 | return true; |
122 | 126 | }) |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
41 | 41 | { |
42 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
42 | + if (!$config->hasDumper($this->option('dumper'))){ |
|
43 | 43 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
44 | 44 | |
45 | 45 | return; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $manager->get($this->argument('locale')) |
52 | 52 | ); |
53 | 53 | |
54 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
54 | + if ($this->isVerbose() && !empty($mc->getDomains())){ |
|
55 | 55 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
56 | 56 | join(',', $mc->getDomains()) |
57 | 57 | ); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | 'xliff_version' => '2.0' // forcing default version for xliff dumper only |
66 | 66 | ]); |
67 | 67 | |
68 | - $this->writeln("Export successfully completed using <info>" . get_class($dumper) . "</info>"); |
|
69 | - $this->writeln("Output: <comment>" . realpath($this->argument('path')) . "</comment>"); |
|
68 | + $this->writeln("Export successfully completed using <info>".get_class($dumper)."</info>"); |
|
69 | + $this->writeln("Output: <comment>".realpath($this->argument('path'))."</comment>"); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $catalogue->getData() |
86 | 86 | ); |
87 | 87 | |
88 | - if ($this->option('fallback')) { |
|
89 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
90 | - foreach ($messages as $id => $message) { |
|
91 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
88 | + if ($this->option('fallback')){ |
|
89 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages){ |
|
90 | + foreach ($messages as $id => $message){ |
|
91 | + if (!$messageCatalogue->defines($id, $domain)){ |
|
92 | 92 | $messageCatalogue->set($id, $message, $domain); |
93 | 93 | } |
94 | 94 | } |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
41 | 41 | { |
42 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
42 | + if (!$config->hasDumper($this->option('dumper'))) |
|
43 | + { |
|
43 | 44 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
44 | 45 | |
45 | 46 | return; |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | $manager->get($this->argument('locale')) |
52 | 53 | ); |
53 | 54 | |
54 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
55 | + if ($this->isVerbose() && !empty($mc->getDomains())) |
|
56 | + { |
|
55 | 57 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
56 | 58 | join(',', $mc->getDomains()) |
57 | 59 | ); |
@@ -85,10 +87,14 @@ discard block |
||
85 | 87 | $catalogue->getData() |
86 | 88 | ); |
87 | 89 | |
88 | - if ($this->option('fallback')) { |
|
89 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
90 | - foreach ($messages as $id => $message) { |
|
91 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
90 | + if ($this->option('fallback')) |
|
91 | + { |
|
92 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) |
|
93 | + { |
|
94 | + foreach ($messages as $id => $message) |
|
95 | + { |
|
96 | + if (!$messageCatalogue->defines($id, $domain)) |
|
97 | + { |
|
92 | 98 | $messageCatalogue->set($id, $message, $domain); |
93 | 99 | } |
94 | 100 | } |
@@ -70,31 +70,31 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function configureExtensions(ConsoleBootloader $console, Container $container): void |
72 | 72 | { |
73 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
73 | + if ($container->has(DatabaseProviderInterface::class)){ |
|
74 | 74 | $this->configureDatabase($console); |
75 | 75 | } |
76 | 76 | |
77 | - if ($container->has(ORMInterface::class)) { |
|
77 | + if ($container->has(ORMInterface::class)){ |
|
78 | 78 | $this->configureCycle($console, $container); |
79 | 79 | } |
80 | 80 | |
81 | - if ($container->has(TranslatorInterface::class)) { |
|
81 | + if ($container->has(TranslatorInterface::class)){ |
|
82 | 82 | $this->configureTranslator($console); |
83 | 83 | } |
84 | 84 | |
85 | - if ($container->has(ViewsInterface::class)) { |
|
85 | + if ($container->has(ViewsInterface::class)){ |
|
86 | 86 | $this->configureViews($console); |
87 | 87 | } |
88 | 88 | |
89 | - if ($container->has(Migrator::class)) { |
|
89 | + if ($container->has(Migrator::class)){ |
|
90 | 90 | $this->configureMigrations($console); |
91 | 91 | } |
92 | 92 | |
93 | - if ($container->has(InvokerInterface::class)) { |
|
93 | + if ($container->has(InvokerInterface::class)){ |
|
94 | 94 | $this->configureGRPC($console); |
95 | 95 | } |
96 | 96 | |
97 | - if ($container->has(EncryptionInterface::class)) { |
|
97 | + if ($container->has(EncryptionInterface::class)){ |
|
98 | 98 | $this->configureEncrypter($console); |
99 | 99 | } |
100 | 100 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $console->addCommand(Cycle\SyncCommand::class); |
125 | 125 | |
126 | - if ($container->has(Migrator::class)) { |
|
126 | + if ($container->has(Migrator::class)){ |
|
127 | 127 | $console->addCommand(Cycle\MigrateCommand::class); |
128 | 128 | } |
129 | 129 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $console->addCommand(Translator\ResetCommand::class); |
139 | 139 | |
140 | 140 | $console->addConfigureSequence( |
141 | - function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) { |
|
141 | + function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output){ |
|
142 | 142 | $files->ensureDirectory($config->getLocaleDirectory($config->getDefaultLocale())); |
143 | 143 | $output->writeln("<info>The default locale directory has been ensured.</info>"); |
144 | 144 | }, |
@@ -70,31 +70,38 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function configureExtensions(ConsoleBootloader $console, Container $container): void |
72 | 72 | { |
73 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
73 | + if ($container->has(DatabaseProviderInterface::class)) |
|
74 | + { |
|
74 | 75 | $this->configureDatabase($console); |
75 | 76 | } |
76 | 77 | |
77 | - if ($container->has(ORMInterface::class)) { |
|
78 | + if ($container->has(ORMInterface::class)) |
|
79 | + { |
|
78 | 80 | $this->configureCycle($console, $container); |
79 | 81 | } |
80 | 82 | |
81 | - if ($container->has(TranslatorInterface::class)) { |
|
83 | + if ($container->has(TranslatorInterface::class)) |
|
84 | + { |
|
82 | 85 | $this->configureTranslator($console); |
83 | 86 | } |
84 | 87 | |
85 | - if ($container->has(ViewsInterface::class)) { |
|
88 | + if ($container->has(ViewsInterface::class)) |
|
89 | + { |
|
86 | 90 | $this->configureViews($console); |
87 | 91 | } |
88 | 92 | |
89 | - if ($container->has(Migrator::class)) { |
|
93 | + if ($container->has(Migrator::class)) |
|
94 | + { |
|
90 | 95 | $this->configureMigrations($console); |
91 | 96 | } |
92 | 97 | |
93 | - if ($container->has(InvokerInterface::class)) { |
|
98 | + if ($container->has(InvokerInterface::class)) |
|
99 | + { |
|
94 | 100 | $this->configureGRPC($console); |
95 | 101 | } |
96 | 102 | |
97 | - if ($container->has(EncryptionInterface::class)) { |
|
103 | + if ($container->has(EncryptionInterface::class)) |
|
104 | + { |
|
98 | 105 | $this->configureEncrypter($console); |
99 | 106 | } |
100 | 107 | } |
@@ -123,7 +130,8 @@ discard block |
||
123 | 130 | |
124 | 131 | $console->addCommand(Cycle\SyncCommand::class); |
125 | 132 | |
126 | - if ($container->has(Migrator::class)) { |
|
133 | + if ($container->has(Migrator::class)) |
|
134 | + { |
|
127 | 135 | $console->addCommand(Cycle\MigrateCommand::class); |
128 | 136 | } |
129 | 137 | } |
@@ -138,7 +146,8 @@ discard block |
||
138 | 146 | $console->addCommand(Translator\ResetCommand::class); |
139 | 147 | |
140 | 148 | $console->addConfigureSequence( |
141 | - function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) { |
|
149 | + function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) |
|
150 | + { |
|
142 | 151 | $files->ensureDirectory($config->getLocaleDirectory($config->getDefaultLocale())); |
143 | 152 | $output->writeln("<info>The default locale directory has been ensured.</info>"); |
144 | 153 | }, |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function testMountFileNotFound() |
24 | 24 | { |
25 | 25 | $out = $this->runCommand('encrypt:key', [ |
26 | - '-m' => __DIR__ . '/.env' |
|
26 | + '-m' => __DIR__.'/.env' |
|
27 | 27 | ]); |
28 | 28 | |
29 | 29 | $this->assertContains('Unable to find', $out); |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | |
32 | 32 | public function testReplace() |
33 | 33 | { |
34 | - file_put_contents(__DIR__ . '/.env', '{encrypt-key}'); |
|
34 | + file_put_contents(__DIR__.'/.env', '{encrypt-key}'); |
|
35 | 35 | |
36 | 36 | $out = $this->runCommand('encrypt:key', [ |
37 | - '-m' => __DIR__ . '/.env' |
|
37 | + '-m' => __DIR__.'/.env' |
|
38 | 38 | ]); |
39 | 39 | |
40 | 40 | $this->assertContains('key has been updated', $out); |
41 | 41 | |
42 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
42 | + $body = file_get_contents(__DIR__.'/.env'); |
|
43 | 43 | $this->assertContains($body, $out); |
44 | 44 | |
45 | - unlink(__DIR__ . '/.env'); |
|
45 | + unlink(__DIR__.'/.env'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function testReplaceCurrent() |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | 'ENCRYPTER_KEY' => $key |
54 | 54 | ]); |
55 | 55 | |
56 | - file_put_contents(__DIR__ . '/.env', $key); |
|
56 | + file_put_contents(__DIR__.'/.env', $key); |
|
57 | 57 | |
58 | 58 | $out = $app->console()->run('encrypt:key', [ |
59 | - '-m' => __DIR__ . '/.env' |
|
59 | + '-m' => __DIR__.'/.env' |
|
60 | 60 | ]); |
61 | 61 | $out = $out->getOutput()->fetch(); |
62 | 62 | |
63 | 63 | $this->assertContains('key has been updated', $out); |
64 | 64 | |
65 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
65 | + $body = file_get_contents(__DIR__.'/.env'); |
|
66 | 66 | $this->assertContains($body, $out); |
67 | 67 | |
68 | - unlink(__DIR__ . '/.env'); |
|
68 | + unlink(__DIR__.'/.env'); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -55,21 +55,21 @@ |
||
55 | 55 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
56 | 56 | |
57 | 57 | $file = $this->option('mount'); |
58 | - if ($file === null) { |
|
58 | + if ($file === null){ |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if (!$files->exists($file)) { |
|
62 | + if (!$files->exists($file)){ |
|
63 | 63 | $this->sprintf("<error>Unable to find `%s`</error>", $file); |
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | 67 | $content = $files->read($file); |
68 | 68 | |
69 | - try { |
|
69 | + try{ |
|
70 | 70 | $content = str_replace($this->option('placeholder'), $key, $content); |
71 | 71 | $content = str_replace($enc->getKey(), $key, $content); |
72 | - } catch (\Throwable $e) { |
|
72 | + }catch (\Throwable $e){ |
|
73 | 73 | // current keys is not set |
74 | 74 | } |
75 | 75 |
@@ -55,21 +55,26 @@ |
||
55 | 55 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
56 | 56 | |
57 | 57 | $file = $this->option('mount'); |
58 | - if ($file === null) { |
|
58 | + if ($file === null) |
|
59 | + { |
|
59 | 60 | return; |
60 | 61 | } |
61 | 62 | |
62 | - if (!$files->exists($file)) { |
|
63 | + if (!$files->exists($file)) |
|
64 | + { |
|
63 | 65 | $this->sprintf("<error>Unable to find `%s`</error>", $file); |
64 | 66 | return; |
65 | 67 | } |
66 | 68 | |
67 | 69 | $content = $files->read($file); |
68 | 70 | |
69 | - try { |
|
71 | + try |
|
72 | + { |
|
70 | 73 | $content = str_replace($this->option('placeholder'), $key, $content); |
71 | 74 | $content = str_replace($enc->getKey(), $key, $content); |
72 | - } catch (\Throwable $e) { |
|
75 | + } |
|
76 | + catch (\Throwable $e) |
|
77 | + { |
|
73 | 78 | // current keys is not set |
74 | 79 | } |
75 | 80 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function setUp() |
20 | 20 | { |
21 | 21 | exec('protoc 2>&1', $out); |
22 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
22 | + if (strpos(join("\n", $out), '--php_out') === false){ |
|
23 | 23 | $this->markTestSkipped('Protoc binary is missing'); |
24 | 24 | return; |
25 | 25 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | parent::setUp(); |
28 | 28 | |
29 | 29 | $fs = new Files(); |
30 | - $this->proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
30 | + $this->proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
31 | 31 | |
32 | 32 | // protoc can't figure relative paths |
33 | 33 | $this->proto = str_replace('Framework/../', '', $this->proto); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | |
40 | 40 | $fs = new Files(); |
41 | 41 | |
42 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
43 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
42 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
43 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
44 | 44 | } |
45 | 45 | |
46 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
47 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
46 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
47 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'proto' => $this->proto |
62 | 62 | ]); |
63 | 63 | |
64 | - file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
64 | + file_put_contents($this->app->dir('app').'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
65 | 65 | |
66 | 66 | $out = $this->runCommandDebug('grpc:services'); |
67 | 67 |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | public function setUp() |
20 | 20 | { |
21 | 21 | exec('protoc 2>&1', $out); |
22 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
22 | + if (strpos(join("\n", $out), '--php_out') === false) |
|
23 | + { |
|
23 | 24 | $this->markTestSkipped('Protoc binary is missing'); |
24 | 25 | return; |
25 | 26 | } |
@@ -39,11 +40,13 @@ discard block |
||
39 | 40 | |
40 | 41 | $fs = new Files(); |
41 | 42 | |
42 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
43 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
44 | + { |
|
43 | 45 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
44 | 46 | } |
45 | 47 | |
46 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
48 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
49 | + { |
|
47 | 50 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
48 | 51 | } |
49 | 52 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | exec('protoc 2>&1', $out); |
24 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
24 | + if (strpos(join("\n", $out), '--php_out') === false){ |
|
25 | 25 | $this->markTestSkipped('Protoc binary is missing'); |
26 | 26 | } |
27 | 27 | |
28 | 28 | parent::setUp(); |
29 | 29 | |
30 | 30 | $fs = new Files(); |
31 | - $proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
31 | + $proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
32 | 32 | |
33 | 33 | // protoc can't figure relative paths |
34 | 34 | $proto = str_replace('Framework/../', '', $proto); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'proto' => $proto |
38 | 38 | ]); |
39 | 39 | |
40 | - file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
40 | + file_put_contents($this->app->dir('app').'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function tearDown() |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | $fs = new Files(); |
48 | 48 | |
49 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
50 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
49 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
50 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
51 | 51 | } |
52 | 52 | |
53 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
54 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
53 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
54 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $msg->setMsg("hello"); |
78 | 78 | |
79 | 79 | $w->shouldReceive('receive')->once()->with( |
80 | - \Mockery::on(function (&$context) { |
|
80 | + \Mockery::on(function (&$context){ |
|
81 | 81 | $context = '{ |
82 | 82 | "service": "service.Echo", |
83 | 83 | "method": "Ping" |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | )->andReturn($msg->serializeToString()); |
89 | 89 | |
90 | 90 | $w->shouldReceive('send')->once()->with( |
91 | - \Mockery::on(function ($out) { |
|
91 | + \Mockery::on(function ($out){ |
|
92 | 92 | |
93 | 93 | $msg = new Message(); |
94 | 94 | $msg->mergeFromString($out); |
@@ -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 | }) |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | exec('protoc 2>&1', $out); |
24 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
24 | + if (strpos(join("\n", $out), '--php_out') === false) |
|
25 | + { |
|
25 | 26 | $this->markTestSkipped('Protoc binary is missing'); |
26 | 27 | } |
27 | 28 | |
@@ -46,11 +47,13 @@ discard block |
||
46 | 47 | |
47 | 48 | $fs = new Files(); |
48 | 49 | |
49 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
50 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
51 | + { |
|
50 | 52 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
51 | 53 | } |
52 | 54 | |
53 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
55 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
56 | + { |
|
54 | 57 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
55 | 58 | } |
56 | 59 | } |
@@ -77,7 +80,8 @@ discard block |
||
77 | 80 | $msg->setMsg("hello"); |
78 | 81 | |
79 | 82 | $w->shouldReceive('receive')->once()->with( |
80 | - \Mockery::on(function (&$context) { |
|
83 | + \Mockery::on(function (&$context) |
|
84 | + { |
|
81 | 85 | $context = '{ |
82 | 86 | "service": "service.Echo", |
83 | 87 | "method": "Ping" |
@@ -88,7 +92,8 @@ discard block |
||
88 | 92 | )->andReturn($msg->serializeToString()); |
89 | 93 | |
90 | 94 | $w->shouldReceive('send')->once()->with( |
91 | - \Mockery::on(function ($out) { |
|
95 | + \Mockery::on(function ($out) |
|
96 | + { |
|
92 | 97 | |
93 | 98 | $msg = new Message(); |
94 | 99 | $msg->mergeFromString($out); |
@@ -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 | }) |
@@ -32,7 +32,8 @@ discard block |
||
32 | 32 | public function setUp() |
33 | 33 | { |
34 | 34 | exec('protoc 2>&1', $out); |
35 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
35 | + if (strpos(join("\n", $out), '--php_out') === false) |
|
36 | + { |
|
36 | 37 | $this->markTestSkipped('Protoc binary is missing'); |
37 | 38 | } |
38 | 39 | |
@@ -51,11 +52,13 @@ discard block |
||
51 | 52 | |
52 | 53 | $fs = new Files(); |
53 | 54 | |
54 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
55 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
56 | + { |
|
55 | 57 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
56 | 58 | } |
57 | 59 | |
58 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
60 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
61 | + { |
|
59 | 62 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
60 | 63 | } |
61 | 64 | } |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | public function setUp() |
34 | 34 | { |
35 | 35 | exec('protoc 2>&1', $out); |
36 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
36 | + if (strpos(join("\n", $out), '--php_out') === false){ |
|
37 | 37 | $this->markTestSkipped('Protoc binary is missing'); |
38 | 38 | } |
39 | 39 | |
40 | 40 | parent::setUp(); |
41 | 41 | |
42 | 42 | $fs = new Files(); |
43 | - $this->proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
43 | + $this->proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
44 | 44 | |
45 | 45 | // protoc can't figure relative paths |
46 | 46 | $this->proto = str_replace('Framework/../', '', $this->proto); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | $fs = new Files(); |
54 | 54 | |
55 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
56 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
55 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
56 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
57 | 57 | } |
58 | 58 | |
59 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
60 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
59 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
60 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | 'proto' => $this->proto |
86 | 86 | ]); |
87 | 87 | |
88 | - $this->assertFileExists($this->app->dir('app') . 'src/Service/EchoInterface.php'); |
|
89 | - $this->assertFileExists($this->app->dir('app') . 'src/Service/Sub/Message.php'); |
|
90 | - $this->assertFileExists($this->app->dir('app') . 'src/GPBMetadata/Service.php'); |
|
88 | + $this->assertFileExists($this->app->dir('app').'src/Service/EchoInterface.php'); |
|
89 | + $this->assertFileExists($this->app->dir('app').'src/Service/Sub/Message.php'); |
|
90 | + $this->assertFileExists($this->app->dir('app').'src/GPBMetadata/Service.php'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |