• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / canvas / 6222385879

18 Sep 2023 12:18PM UTC coverage: 85.938% (-7.9%) from 93.885%
6222385879

Pull #25

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #25: Use `Illuminate\Console\GeneratorCommand`

555 of 555 new or added lines in 33 files covered. (100.0%)

495 of 576 relevant lines covered (85.94%)

23.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.83
/src/LaravelServiceProvider.php
1
<?php
2

3
namespace Orchestra\Canvas;
4

5
use Illuminate\Contracts\Support\DeferrableProvider;
6
use Illuminate\Database\Console\Factories\FactoryMakeCommand;
7
use Illuminate\Database\Console\Migrations\MigrateMakeCommand;
8
use Illuminate\Database\Console\Seeds\SeederMakeCommand;
9
use Illuminate\Foundation\Console\CastMakeCommand;
10
use Illuminate\Foundation\Console\ChannelMakeCommand;
11
use Illuminate\Foundation\Console\ComponentMakeCommand;
12
use Illuminate\Foundation\Console\ConsoleMakeCommand;
13
use Illuminate\Foundation\Console\EventMakeCommand;
14
use Illuminate\Foundation\Console\ExceptionMakeCommand;
15
use Illuminate\Foundation\Console\JobMakeCommand;
16
use Illuminate\Foundation\Console\ListenerMakeCommand;
17
use Illuminate\Foundation\Console\MailMakeCommand;
18
use Illuminate\Foundation\Console\ModelMakeCommand;
19
use Illuminate\Foundation\Console\NotificationMakeCommand;
20
use Illuminate\Foundation\Console\ObserverMakeCommand;
21
use Illuminate\Foundation\Console\PolicyMakeCommand;
22
use Illuminate\Foundation\Console\ProviderMakeCommand;
23
use Illuminate\Foundation\Console\RequestMakeCommand;
24
use Illuminate\Foundation\Console\ResourceMakeCommand;
25
use Illuminate\Foundation\Console\RuleMakeCommand;
26
use Illuminate\Foundation\Console\TestMakeCommand;
27
use Illuminate\Routing\Console\ControllerMakeCommand;
28
use Illuminate\Routing\Console\MiddlewareMakeCommand;
29
use Illuminate\Support\ServiceProvider;
30

31
class LaravelServiceProvider extends ServiceProvider implements DeferrableProvider
32
{
33
    /**
34
     * The commands to be registered.
35
     *
36
     * @var array
37
     */
38
    protected $devCommands = [
39
        // 'ControllerMake' => ControllerMakeCommand::class,
40
        // 'NotificationTable' => NotificationTableCommand::class,
41
        // 'QueueFailedTable' => FailedTableCommand::class,
42
        // 'QueueTable' => TableCommand::class,
43
        // 'QueueBatchesTable' => BatchesTableCommand::class,
44
        // 'ScopeMake' => ScopeMakeCommand::class,
45
        // 'SessionTable' => SessionTableCommand::class,
46
    ];
47

48
    /**
49
     * Register the service provider.
50
     *
51
     * @return void
52
     */
53
    public function register()
54
    {
55
        $this->registerCastMakeCommand();
90✔
56
        $this->registerChannelMakeCommand();
90✔
57
        $this->registerComponentMakeCommand();
90✔
58
        $this->registerConsoleMakeCommand();
90✔
59
        $this->registerControllerMakeCommand();
90✔
60
        $this->registerEventMakeCommand();
90✔
61
        $this->registerExceptionMakeCommand();
90✔
62
        $this->registerFactoryMakeCommand();
90✔
63
        $this->registerJobMakeCommand();
90✔
64
        $this->registerListenerMakeCommand();
90✔
65
        $this->registerMailMakeCommand();
90✔
66
        $this->registerMiddlewareMakeCommand();
90✔
67
        $this->registerMigrateMakeCommand();
90✔
68
        $this->registerModelMakeCommand();
90✔
69
        $this->registerNotificationMakeCommand();
90✔
70
        $this->registerObserverMakeCommand();
90✔
71
        $this->registerPolicyMakeCommand();
90✔
72
        $this->registerProviderMakeCommand();
90✔
73
        $this->registerRequestMakeCommand();
90✔
74
        $this->registerResourceMakeCommand();
90✔
75
        $this->registerRuleMakeCommand();
90✔
76
        $this->registerSeederMakeCommand();
90✔
77
        $this->registerTestMakeCommand();
90✔
78

79
        $this->commands([
90✔
80
            Console\CastMakeCommand::class,
90✔
81
            Console\ChannelMakeCommand::class,
90✔
82
            Console\ComponentMakeCommand::class,
90✔
83
            Console\ConsoleMakeCommand::class,
90✔
84
            Console\ControllerMakeCommand::class,
90✔
85
            Console\EventMakeCommand::class,
90✔
86
            Console\ExceptionMakeCommand::class,
90✔
87
            Console\FactoryMakeCommand::class,
90✔
88
            Console\JobMakeCommand::class,
90✔
89
            Console\ListenerMakeCommand::class,
90✔
90
            Console\MailMakeCommand::class,
90✔
91
            Console\MiddlewareMakeCommand::class,
90✔
92
            Console\MigrateMakeCommand::class,
90✔
93
            Console\ModelMakeCommand::class,
90✔
94
            Console\NotificationMakeCommand::class,
90✔
95
            Console\ObserverMakeCommand::class,
90✔
96
            Console\PolicyMakeCommand::class,
90✔
97
            Console\ProviderMakeCommand::class,
90✔
98
            Console\RequestMakeCommand::class,
90✔
99
            Console\ResourceMakeCommand::class,
90✔
100
            Console\RuleMakeCommand::class,
90✔
101
            Console\SeederMakeCommand::class,
90✔
102
            Console\TestMakeCommand::class,
90✔
103
        ]);
90✔
104
    }
105

106
    /**
107
     * Register the command.
108
     *
109
     * @return void
110
     */
111
    protected function registerCastMakeCommand()
112
    {
113
        $this->app->singleton(CastMakeCommand::class, function ($app) {
90✔
114
            return new Console\CastMakeCommand($app['files']);
×
115
        });
90✔
116
    }
117

118
    /**
119
     * Register the command.
120
     *
121
     * @return void
122
     */
123
    protected function registerChannelMakeCommand()
124
    {
125
        $this->app->singleton(ChannelMakeCommand::class, function ($app) {
90✔
126
            return new Console\ChannelMakeCommand($app['files']);
×
127
        });
90✔
128
    }
129

130
    /**
131
     * Register the command.
132
     *
133
     * @return void
134
     */
135
    protected function registerComponentMakeCommand()
136
    {
137
        $this->app->singleton(ComponentMakeCommand::class, function ($app) {
90✔
138
            return new Console\ComponentMakeCommand($app['files']);
×
139
        });
90✔
140
    }
141

142
    /**
143
     * Register the command.
144
     *
145
     * @return void
146
     */
147
    protected function registerConsoleMakeCommand()
148
    {
149
        $this->app->singleton(ConsoleMakeCommand::class, function ($app) {
90✔
150
            return new Console\ConsoleMakeCommand($app['files']);
×
151
        });
90✔
152
    }
153

154
    /**
155
     * Register the command.
156
     *
157
     * @return void
158
     */
159
    protected function registerControllerMakeCommand()
160
    {
161
        $this->app->singleton(ControllerMakeCommand::class, function ($app) {
90✔
162
            return new Console\ControllerMakeCommand($app['files']);
×
163
        });
90✔
164
    }
165

166
    /**
167
     * Register the command.
168
     *
169
     * @return void
170
     */
171
    protected function registerEventMakeCommand()
172
    {
173
        $this->app->singleton(EventMakeCommand::class, function ($app) {
90✔
174
            return new Console\EventMakeCommand($app['files']);
×
175
        });
90✔
176
    }
177

178
    /**
179
     * Register the command.
180
     *
181
     * @return void
182
     */
183
    protected function registerExceptionMakeCommand()
184
    {
185
        $this->app->singleton(ExceptionMakeCommand::class, function ($app) {
90✔
186
            return new Console\ExceptionMakeCommand($app['files']);
×
187
        });
90✔
188
    }
189

190
    /**
191
     * Register the command.
192
     *
193
     * @return void
194
     */
195
    protected function registerFactoryMakeCommand()
196
    {
197
        $this->app->singleton(FactoryMakeCommand::class, function ($app) {
90✔
198
            return new Console\FactoryMakeCommand($app['files']);
×
199
        });
90✔
200
    }
201

202
    /**
203
     * Register the command.
204
     *
205
     * @return void
206
     */
207
    protected function registerJobMakeCommand()
208
    {
209
        $this->app->singleton(JobMakeCommand::class, function ($app) {
90✔
210
            return new Console\JobMakeCommand($app['files']);
×
211
        });
90✔
212
    }
213

214
    /**
215
     * Register the command.
216
     *
217
     * @return void
218
     */
219
    protected function registerListenerMakeCommand()
220
    {
221
        $this->app->singleton(ListenerMakeCommand::class, function ($app) {
90✔
222
            return new Console\ListenerMakeCommand($app['files']);
×
223
        });
90✔
224
    }
225

226
    /**
227
     * Register the command.
228
     *
229
     * @return void
230
     */
231
    protected function registerMailMakeCommand()
232
    {
233
        $this->app->singleton(MailMakeCommand::class, function ($app) {
90✔
234
            return new Console\MailMakeCommand($app['files']);
×
235
        });
90✔
236
    }
237

238
    /**
239
     * Register the command.
240
     *
241
     * @return void
242
     */
243
    protected function registerMiddlewareMakeCommand()
244
    {
245
        $this->app->singleton(MiddlewareMakeCommand::class, function ($app) {
90✔
246
            return new Console\MiddlewareMakeCommand($app['files']);
×
247
        });
90✔
248
    }
249

250
    /**
251
     * Register the command.
252
     *
253
     * @return void
254
     */
255
    protected function registerMigrateMakeCommand()
256
    {
257
        $this->app->singleton(MigrateMakeCommand::class, function ($app) {
90✔
258
            // Once we have the migration creator registered, we will create the command
259
            // and inject the creator. The creator is responsible for the actual file
260
            // creation of the migrations, and may be extended by these developers.
261
            $creator = $app['migration.creator'];
88✔
262

263
            $composer = $app['composer'];
88✔
264

265
            return new Console\MigrateMakeCommand($creator, $composer);
88✔
266
        });
90✔
267
    }
268

269
    /**
270
     * Register the command.
271
     *
272
     * @return void
273
     */
274
    protected function registerModelMakeCommand()
275
    {
276
        $this->app->singleton(ModelMakeCommand::class, function ($app) {
90✔
277
            return new Console\ModelMakeCommand($app['files']);
×
278
        });
90✔
279
    }
280

281
    /**
282
     * Register the command.
283
     *
284
     * @return void
285
     */
286
    protected function registerNotificationMakeCommand()
287
    {
288
        $this->app->singleton(NotificationMakeCommand::class, function ($app) {
90✔
289
            return new Console\NotificationMakeCommand($app['files']);
×
290
        });
90✔
291
    }
292

293
    /**
294
     * Register the command.
295
     *
296
     * @return void
297
     */
298
    protected function registerObserverMakeCommand()
299
    {
300
        $this->app->singleton(ObserverMakeCommand::class, function ($app) {
90✔
301
            return new Console\ObserverMakeCommand($app['files']);
×
302
        });
90✔
303
    }
304

305
    /**
306
     * Register the command.
307
     *
308
     * @return void
309
     */
310
    protected function registerPolicyMakeCommand()
311
    {
312
        $this->app->singleton(PolicyMakeCommand::class, function ($app) {
90✔
313
            return new Console\PolicyMakeCommand($app['files']);
×
314
        });
90✔
315
    }
316

317
    /**
318
     * Register the command.
319
     *
320
     * @return void
321
     */
322
    protected function registerProviderMakeCommand()
323
    {
324
        $this->app->singleton(ProviderMakeCommand::class, function ($app) {
90✔
325
            return new Console\ProviderMakeCommand($app['files']);
×
326
        });
90✔
327
    }
328

329
    /**
330
     * Register the command.
331
     *
332
     * @return void
333
     */
334
    protected function registerRequestMakeCommand()
335
    {
336
        $this->app->singleton(RequestMakeCommand::class, function ($app) {
90✔
337
            return new Console\RequestMakeCommand($app['files']);
×
338
        });
90✔
339
    }
340

341
    /**
342
     * Register the command.
343
     *
344
     * @return void
345
     */
346
    protected function registerResourceMakeCommand()
347
    {
348
        $this->app->singleton(ResourceMakeCommand::class, function ($app) {
90✔
349
            return new Console\ResourceMakeCommand($app['files']);
×
350
        });
90✔
351
    }
352

353
    /**
354
     * Register the command.
355
     *
356
     * @return void
357
     */
358
    protected function registerRuleMakeCommand()
359
    {
360
        $this->app->singleton(RuleMakeCommand::class, function ($app) {
90✔
361
            return new Console\RuleMakeCommand($app['files']);
×
362
        });
90✔
363
    }
364

365
    /**
366
     * Register the command.
367
     *
368
     * @return void
369
     */
370
    protected function registerSeederMakeCommand()
371
    {
372
        $this->app->singleton(SeederMakeCommand::class, function ($app) {
90✔
373
            return new Console\SeederMakeCommand($app['files']);
×
374
        });
90✔
375
    }
376

377
    /**
378
     * Register the command.
379
     *
380
     * @return void
381
     */
382
    protected function registerTestMakeCommand()
383
    {
384
        $this->app->singleton(TestMakeCommand::class, function ($app) {
90✔
385
            return new Console\TestMakeCommand($app['files']);
×
386
        });
90✔
387
    }
388

389
    /**
390
     * Get the services provided by the provider.
391
     *
392
     * @return array
393
     */
394
    public function provides()
395
    {
396
        return [
1✔
397
            CastMakeCommand::class,
1✔
398
            Console\CastMakeCommand::class,
1✔
399
            ChannelMakeCommand::class,
1✔
400
            Console\ChannelMakeCommand::class,
1✔
401
            ComponentMakeCommand::class,
1✔
402
            Console\ComponentMakeCommand::class,
1✔
403
            ConsoleMakeCommand::class,
1✔
404
            Console\ConsoleMakeCommand::class,
1✔
405
            ControllerMakeCommand::class,
1✔
406
            Console\ControllerMakeCommand::class,
1✔
407
            EventMakeCommand::class,
1✔
408
            Console\EventMakeCommand::class,
1✔
409
            ExceptionMakeCommand::class,
1✔
410
            Console\ExceptionMakeCommand::class,
1✔
411
            FactoryMakeCommand::class,
1✔
412
            Console\FactoryMakeCommand::class,
1✔
413
            JobMakeCommand::class,
1✔
414
            Console\JobMakeCommand::class,
1✔
415
            ListenerMakeCommand::class,
1✔
416
            Console\ListenerMakeCommand::class,
1✔
417
            MailMakeCommand::class,
1✔
418
            Console\MailMakeCommand::class,
1✔
419
            MiddlewareMakeCommand::class,
1✔
420
            Console\MiddlewareMakeCommand::class,
1✔
421
            MigrateMakeCommand::class,
1✔
422
            Console\MigrateMakeCommand::class,
1✔
423
            ModelMakeCommand::class,
1✔
424
            Console\ModelMakeCommand::class,
1✔
425
            NotificationMakeCommand::class,
1✔
426
            Console\NotificationMakeCommand::class,
1✔
427
            ObserverMakeCommand::class,
1✔
428
            Console\ObserverMakeCommand::class,
1✔
429
            PolicyMakeCommand::class,
1✔
430
            Console\PolicyMakeCommand::class,
1✔
431
            ProviderMakeCommand::class,
1✔
432
            Console\ProviderMakeCommand::class,
1✔
433
            RequestMakeCommand::class,
1✔
434
            Console\RequestMakeCommand::class,
1✔
435
            ResourceMakeCommand::class,
1✔
436
            Console\ResourceMakeCommand::class,
1✔
437
            RuleMakeCommand::class,
1✔
438
            Console\RuleMakeCommand::class,
1✔
439
            SeederMakeCommand::class,
1✔
440
            Console\SeederMakeCommand::class,
1✔
441
            TestMakeCommand::class,
1✔
442
            Console\TestMakeCommand::class,
1✔
443
        ];
1✔
444
    }
445
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc