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

orchestral / canvas / 6222558446

18 Sep 2023 12:33PM UTC coverage: 91.007% (-2.9%) from 93.885%
6222558446

Pull #25

github

crynobone
wip

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

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

506 of 556 relevant lines covered (91.01%)

25.62 hits per line

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

86.78
/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\ScopeMakeCommand;
27
use Illuminate\Foundation\Console\TestMakeCommand;
28
use Illuminate\Routing\Console\ControllerMakeCommand;
29
use Illuminate\Routing\Console\MiddlewareMakeCommand;
30
use Illuminate\Support\ServiceProvider;
31

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

264
            $composer = $app['composer'];
89✔
265

266
            return new Console\MigrateMakeCommand($creator, $composer);
89✔
267
        });
91✔
268
    }
269

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

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

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

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

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

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

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

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

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

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

390
    /**
391
     * Register the command.
392
     *
393
     * @return void
394
     */
395
    protected function registerTestMakeCommand()
396
    {
397
        $this->app->singleton(TestMakeCommand::class, function ($app) {
91✔
398
            return new Console\TestMakeCommand($app['files']);
×
399
        });
91✔
400
    }
401

402
    /**
403
     * Get the services provided by the provider.
404
     *
405
     * @return array
406
     */
407
    public function provides()
408
    {
409
        return [
1✔
410
            CastMakeCommand::class,
1✔
411
            Console\CastMakeCommand::class,
1✔
412
            ChannelMakeCommand::class,
1✔
413
            Console\ChannelMakeCommand::class,
1✔
414
            ComponentMakeCommand::class,
1✔
415
            Console\ComponentMakeCommand::class,
1✔
416
            ConsoleMakeCommand::class,
1✔
417
            Console\ConsoleMakeCommand::class,
1✔
418
            ControllerMakeCommand::class,
1✔
419
            Console\ControllerMakeCommand::class,
1✔
420
            EventMakeCommand::class,
1✔
421
            Console\EventMakeCommand::class,
1✔
422
            ExceptionMakeCommand::class,
1✔
423
            Console\ExceptionMakeCommand::class,
1✔
424
            FactoryMakeCommand::class,
1✔
425
            Console\FactoryMakeCommand::class,
1✔
426
            JobMakeCommand::class,
1✔
427
            Console\JobMakeCommand::class,
1✔
428
            ListenerMakeCommand::class,
1✔
429
            Console\ListenerMakeCommand::class,
1✔
430
            MailMakeCommand::class,
1✔
431
            Console\MailMakeCommand::class,
1✔
432
            MiddlewareMakeCommand::class,
1✔
433
            Console\MiddlewareMakeCommand::class,
1✔
434
            MigrateMakeCommand::class,
1✔
435
            Console\MigrateMakeCommand::class,
1✔
436
            ModelMakeCommand::class,
1✔
437
            Console\ModelMakeCommand::class,
1✔
438
            NotificationMakeCommand::class,
1✔
439
            Console\NotificationMakeCommand::class,
1✔
440
            ObserverMakeCommand::class,
1✔
441
            Console\ObserverMakeCommand::class,
1✔
442
            PolicyMakeCommand::class,
1✔
443
            Console\PolicyMakeCommand::class,
1✔
444
            ProviderMakeCommand::class,
1✔
445
            Console\ProviderMakeCommand::class,
1✔
446
            RequestMakeCommand::class,
1✔
447
            Console\RequestMakeCommand::class,
1✔
448
            ResourceMakeCommand::class,
1✔
449
            Console\ResourceMakeCommand::class,
1✔
450
            RuleMakeCommand::class,
1✔
451
            Console\RuleMakeCommand::class,
1✔
452
            ScopeMakeCommand::class,
1✔
453
            Console\ScopeMakeCommand::class,
1✔
454
            SeederMakeCommand::class,
1✔
455
            Console\SeederMakeCommand::class,
1✔
456
            TestMakeCommand::class,
1✔
457
            Console\TestMakeCommand::class,
1✔
458
        ];
1✔
459
    }
460
}
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