Skip to content

Commit 943a830

Browse files
committed
Merge branch '1-86c34dha8-clerk-step' into 2-86c34dha8-clerk-step
2 parents 0e15e1f + c9d1269 commit 943a830

File tree

3 files changed

+167
-1
lines changed

3 files changed

+167
-1
lines changed

src/Commands/InitCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ protected function fillCredentialsAndAccess(string $kebabName): void
360360
continue;
361361
}
362362

363-
if ($this->confirm("Is {$title}'s admin the same as default one?", true)) {
363+
if (!empty($this->adminCredentials) && $this->confirm("Is {$title}'s admin the same as default one?", true)) {
364364
$email = $this->adminCredentials['email'];
365365
$password = $this->adminCredentials['password'];
366366
} else {

tests/InitCommandTest.php

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,4 +607,125 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns
607607
->expectsConfirmation('Do you want to uninstall project-initializator package?', 'yes')
608608
->assertExitCode(0);
609609
}
610+
611+
public function testRunWithoutAdminAndUsingTelescope()
612+
{
613+
$this->mockChangeConfig('config/auto-doc.php', 'auto_doc.php', 'auto_doc_after_changes.php');
614+
615+
$this->mockFileGetContent(
616+
[
617+
'arguments' => ['.env.example'],
618+
'result' => $this->getFixture('env.example.yml'),
619+
],
620+
[
621+
'arguments' => ['.env.development'],
622+
'result' => $this->getFixture('env.development.yml'),
623+
],
624+
[
625+
'arguments' => [base_path('/vendor/ronasit/laravel-project-initializator/resources/md/readme/README.md')],
626+
'result' => $this->getTemplate('README.md'),
627+
],
628+
[
629+
'arguments' => [base_path('/vendor/ronasit/laravel-project-initializator/resources/md/readme/RESOURCES_AND_CONTACTS.md')],
630+
'result' => $this->getTemplate('RESOURCES_AND_CONTACTS.md'),
631+
],
632+
[
633+
'arguments' => [base_path('/vendor/ronasit/laravel-project-initializator/resources/md/readme/RESOURCES.md')],
634+
'result' => $this->getTemplate('RESOURCES.md'),
635+
],
636+
[
637+
'arguments' => [base_path('/vendor/ronasit/laravel-project-initializator/resources/md/readme/CONTACTS.md')],
638+
'result' => $this->getTemplate('CONTACTS.md'),
639+
],
640+
[
641+
'arguments' => [base_path('/vendor/ronasit/laravel-project-initializator/resources/md/readme/ENVIRONMENTS.md')],
642+
'result' => $this->getTemplate('ENVIRONMENTS.md'),
643+
],
644+
[
645+
'arguments' => [base_path('/vendor/ronasit/laravel-project-initializator/resources/md/readme/CREDENTIALS_AND_ACCESS.md')],
646+
'result' => $this->getTemplate('CREDENTIALS_AND_ACCESS.md'),
647+
],
648+
);
649+
650+
$this->mockFilePutContent(
651+
'env.example.yml',
652+
'env.development.yml',
653+
[
654+
'README.md',
655+
$this->getFixture('partial_readme_with_telescope.md'),
656+
]
657+
);
658+
659+
$this->mockShellExec(
660+
['arguments' => 'composer require ronasit/laravel-helpers --ansi'],
661+
['arguments' => 'composer require ronasit/laravel-swagger --ansi'],
662+
['arguments' => 'php artisan vendor:publish --provider="RonasIT\AutoDoc\AutoDocServiceProvider" --ansi'],
663+
['arguments' => 'composer require --dev ronasit/laravel-entity-generator --ansi'],
664+
['arguments' => 'composer require ronasit/laravel-telescope-extension --ansi'],
665+
['arguments' => 'php artisan telescope:install --ansi'],
666+
);
667+
668+
$this
669+
->artisan('init "My App"')
670+
->expectsConfirmation('The application name is not in PascalCase, would you like to use MyApp')
671+
->expectsQuestion("Please specify a Code Owner/Team Lead's email", 'test@example.com')
672+
->expectsOutput('Project initialized successfully!')
673+
->expectsQuestion('Please enter an application URL', 'https://mysite.com')
674+
->expectsChoice('Please choose the authentication type', 'none', ['clerk', 'none'])
675+
->expectsConfirmation('Do you want to generate an admin user?')
676+
->expectsConfirmation('Do you want to generate a README file?', 'yes')
677+
->expectsQuestion('What type of application will your API serve?', 'Web')
678+
->expectsConfirmation('Do you need a `Resources & Contacts` part?', 'yes')
679+
->expectsQuestion(
680+
'Are you going to use Issue Tracker? '
681+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
682+
'later'
683+
)
684+
->expectsQuestion(
685+
'Are you going to use Figma? '
686+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
687+
'no'
688+
)
689+
->expectsQuestion(
690+
'Are you going to use Sentry? '
691+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
692+
'no'
693+
)
694+
->expectsQuestion(
695+
'Are you going to use DataDog? '
696+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
697+
'no'
698+
)
699+
->expectsQuestion(
700+
'Are you going to use ArgoCD? '
701+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
702+
'no'
703+
)
704+
->expectsQuestion(
705+
'Are you going to use Laravel Telescope? '
706+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
707+
'later'
708+
)
709+
->expectsQuestion(
710+
'Are you going to use Laravel Nova? '
711+
. 'Please enter a link or select `later` to do it later, otherwise select `no`.',
712+
'later'
713+
)
714+
->expectsQuestion('Please enter a Manager\'s email', 'manager@mail.com')
715+
->expectsConfirmation('Do you need a `Prerequisites` part?')
716+
->expectsConfirmation('Do you need a `Getting Started` part?')
717+
->expectsConfirmation('Do you need an `Environments` part?', 'yes')
718+
->expectsConfirmation('Do you need a `Credentials and Access` part?', 'yes')
719+
->expectsQuestion('Please enter a Laravel Telescope\'s admin email', 'telescope_mail@mail.com')
720+
->expectsQuestion('Please enter a Laravel Telescope\'s admin password', '654321')
721+
->expectsQuestion('Please enter a Laravel Nova\'s admin email', 'nova_mail@mail.com')
722+
->expectsQuestion('Please enter a Laravel Nova\'s admin password', '654321')
723+
->expectsOutput('README generated successfully!')
724+
->expectsOutput('Don`t forget to fill the following empty values:')
725+
->expectsOutput('- Issue Tracker link')
726+
->expectsConfirmation('Would you use Renovate dependabot?')
727+
->expectsConfirmation('Do you want to install media package?')
728+
->expectsConfirmation('Do you want to uninstall project-initializator package?')
729+
->assertExitCode(0);
730+
}
610731
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# My App
2+
3+
This project implements an API for the My App Web app.
4+
5+
## Project Resources & Contacts
6+
7+
This section provides quick links to various resources and contacts associated
8+
with this project. It's here to streamline your navigation and communication
9+
process, so you can efficiently find what you need or reach out to who you need.
10+
11+
### Resources
12+
13+
Below are links to tools and services used in this project:
14+
- [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)
17+
- [API Documentation](https://mysite.com)
18+
19+
### Contacts
20+
21+
Should you need assistance or have questions, feel free to connect with the following individuals:
22+
- Manager: If you have any high-level project concerns, feel free to get in touch with our project manager. [Connect with Manager](mailto:manager@mail.com)
23+
- Code Owner/Team Lead: For specific questions about the codebase or technical aspects, reach out to our team lead. [Connect with Team Lead](mailto:test@example.com)
24+
25+
Please be mindful of each individual's preferred contact method and office hours.
26+
27+
## Environments
28+
29+
This repository by default supports three environments: `local`, `development`,
30+
and `testing`. Each environment is represented by an appropriate environment file:
31+
32+
| Environment | File | URL |
33+
| --- | --- |--------------------------------------|
34+
| local | .env | [http://localhost](http://localhost) |
35+
| testing | .env.testing | - |
36+
| development | .env.development | [https://mysite.com](https://mysite.com) |
37+
38+
## 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)