Skip to content

Commit 0a037a6

Browse files
committed
fix: default admin credenitals question
1 parent b6e7ee0 commit 0a037a6

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/Commands/InitCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ protected function fillCredentialsAndAccess(string $kebabName): void
333333
{
334334
$filePart = $this->loadReadmePart('CREDENTIALS_AND_ACCESS.md');
335335

336-
if (!empty($this->adminCredentials)) {
336+
if ($this->adminCredentials) {
337337
$this->setReadmeValue($filePart, 'admin_email', $this->adminCredentials['email']);
338338
$this->setReadmeValue($filePart, 'admin_password', $this->adminCredentials['password']);
339339
}
@@ -347,7 +347,7 @@ protected function fillCredentialsAndAccess(string $kebabName): void
347347
continue;
348348
}
349349

350-
if ($this->confirm("Is {$title}'s admin the same as default one?", true)) {
350+
if ($this->adminCredentials && $this->confirm("Is {$title}'s admin the same as default one?", true)) {
351351
$email = $this->adminCredentials['email'];
352352
$password = $this->adminCredentials['password'];
353353
} else {

tests/InitCommandTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,18 +428,22 @@ public function testRunWithAdminAndPartialReadmeCreation()
428428
->expectsQuestion(
429429
'Are you going to use Laravel Telescope? '
430430
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
431-
'no'
431+
'later'
432432
)
433433
->expectsQuestion(
434434
'Are you going to use Laravel Nova? '
435435
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
436-
'no'
436+
'later'
437437
)
438438
->expectsQuestion('Please enter a Manager\'s email', 'manager@mail.com')
439439
->expectsConfirmation('Do you need a `Prerequisites` part?')
440440
->expectsConfirmation('Do you need a `Getting Started` part?')
441441
->expectsConfirmation('Do you need an `Environments` part?', 'yes')
442442
->expectsConfirmation('Do you need a `Credentials and Access` part?', 'yes')
443+
->expectsQuestion('Please enter a Laravel Telescope\'s admin email', 'telescope_mail@mail.com')
444+
->expectsQuestion('Please enter a Laravel Telescope\'s admin password', '654321')
445+
->expectsQuestion('Please enter a Laravel Nova\'s admin email', 'nova_mail@mail.com')
446+
->expectsQuestion('Please enter a Laravel Nova\'s admin password', '654321')
443447
->expectsOutput('README generated successfully!')
444448
->expectsOutput('Don`t forget to fill the following empty values:')
445449
->expectsOutput('- Issue Tracker link')

tests/fixtures/InitCommandTest/partial_readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ process, so you can efficiently find what you need or reach out to who you need.
1212

1313
Below are links to tools and services used in this project:
1414
- [Issue Tracker](): Here, you can report any issues or bugs related to the project. (will be added later)
15+
- [Laravel Telescope](): This is debug assistant for the Laravel framework. (will be added later)
16+
- [Laravel Nova](): This is admin panel for the Laravel framework. (will be added later)
1517
- [API Documentation](https://mysite.com)
1618

1719
### Contacts
@@ -34,3 +36,10 @@ and `testing`. Each environment is represented by an appropriate environment fil
3436
| development | .env.development | [https://mysite.com](https://mysite.com) |
3537

3638
## Credentials and Access
39+
Laravel Telescope access:
40+
- email `telescope_mail@mail.com`
41+
- password `654321`
42+
43+
Laravel Nova access:
44+
- email `nova_mail@mail.com`
45+
- password `654321`

0 commit comments

Comments
 (0)