@@ -62,13 +62,12 @@ public function test_create_site(array $inputs): void
6262 $ this ->post (route ('sites.store ' , ['server ' => $ this ->server ]), $ inputs )
6363 ->assertSessionDoesntHaveErrors ();
6464
65- $ expectedUser = empty ($ inputs ['user ' ]) ? $ this ->server ->getSshUser () : $ inputs ['user ' ];
6665 $ this ->assertDatabaseHas ('sites ' , [
6766 'domain ' => $ inputs ['domain ' ],
6867 'aliases ' => $ this ->castAsJson ($ inputs ['aliases ' ] ?? []),
6968 'status ' => SiteStatus::READY ->value ,
70- 'user ' => $ expectedUser ,
71- 'path ' => '/home/ ' .$ expectedUser .'/ ' .$ inputs ['domain ' ],
69+ 'user ' => $ inputs [ ' user ' ] ,
70+ 'path ' => '/home/ ' .$ inputs [ ' user ' ] .'/ ' .$ inputs ['domain ' ],
7271 ]);
7372 }
7473
@@ -97,6 +96,7 @@ public function test_create_site_failed_due_to_source_control(int $status): void
9796 'repository ' => 'test/test ' ,
9897 'branch ' => 'main ' ,
9998 'composer ' => true ,
99+ 'user ' => 'example ' ,
100100 ];
101101
102102 SSH ::fake ();
@@ -421,6 +421,7 @@ public function test_create_site_with_valid_web_directory(): void
421421 'domain ' => 'example.com ' ,
422422 'php_version ' => '8.2 ' ,
423423 'web_directory ' => 'public/dist ' ,
424+ 'user ' => 'example ' ,
424425 ])
425426 ->assertSessionDoesntHaveErrors ();
426427
@@ -441,6 +442,7 @@ public function test_create_site_with_special_characters_web_directory(): void
441442 'domain ' => 'example.com ' ,
442443 'php_version ' => '8.2 ' ,
443444 'web_directory ' => 'public-dist_v1.0 ' ,
445+ 'user ' => 'example ' ,
444446 ])
445447 ->assertSessionDoesntHaveErrors ();
446448
@@ -461,6 +463,7 @@ public function test_create_site_normalizes_web_directory_slashes(): void
461463 'domain ' => 'example.com ' ,
462464 'php_version ' => '8.2 ' ,
463465 'web_directory ' => '/public/ ' ,
466+ 'user ' => 'example ' ,
464467 ])
465468 ->assertSessionDoesntHaveErrors ();
466469
@@ -481,6 +484,7 @@ public function test_create_site_normalizes_root_web_directory(): void
481484 'domain ' => 'example.com ' ,
482485 'php_version ' => '8.2 ' ,
483486 'web_directory ' => '/ ' ,
487+ 'user ' => 'example ' ,
484488 ])
485489 ->assertSessionDoesntHaveErrors ();
486490
@@ -501,6 +505,7 @@ public function test_create_site_rejects_invalid_web_directory_characters(): voi
501505 'domain ' => 'example.com ' ,
502506 'php_version ' => '8.2 ' ,
503507 'web_directory ' => 'public@invalid! ' ,
508+ 'user ' => 'example ' ,
504509 ])
505510 ->assertSessionHasErrors (['web_directory ' ]);
506511
@@ -520,6 +525,7 @@ public function test_create_site_rejects_directory_traversal(): void
520525 'domain ' => 'example.com ' ,
521526 'php_version ' => '8.2 ' ,
522527 'web_directory ' => '../etc/passwd ' ,
528+ 'user ' => 'example ' ,
523529 ])
524530 ->assertSessionHasErrors (['web_directory ' ]);
525531
@@ -593,18 +599,6 @@ public static function failure_create_data(): array
593599 public static function create_data (): array
594600 {
595601 return [
596- [
597- [
598- 'type ' => Laravel::id (),
599- 'domain ' => 'example.com ' ,
600- 'aliases ' => ['www.example.com ' , 'www2.example.com ' ],
601- 'php_version ' => '8.2 ' ,
602- 'web_directory ' => 'public ' ,
603- 'repository ' => 'test/test ' ,
604- 'branch ' => 'main ' ,
605- 'composer ' => true ,
606- ],
607- ],
608602 [
609603 [
610604 'type ' => Laravel::id (),
@@ -618,20 +612,6 @@ public static function create_data(): array
618612 'user ' => 'example ' ,
619613 ],
620614 ],
621- [
622- [
623- 'type ' => Wordpress::id (),
624- 'domain ' => 'example.com ' ,
625- 'aliases ' => ['www.example.com ' ],
626- 'php_version ' => '8.2 ' ,
627- 'title ' => 'Example ' ,
628- 'username ' => 'example ' ,
629- 'email ' => 'email@example.com ' ,
630- 'password ' => 'password ' ,
631- 'database ' => '1 ' ,
632- 'database_user ' => '1 ' ,
633- ],
634- ],
635615 [
636616 [
637617 'type ' => Wordpress::id (),
@@ -647,15 +627,6 @@ public static function create_data(): array
647627 'user ' => 'example ' ,
648628 ],
649629 ],
650- [
651- [
652- 'type ' => PHPBlank::id (),
653- 'domain ' => 'example.com ' ,
654- 'aliases ' => ['www.example.com ' ],
655- 'php_version ' => '8.2 ' ,
656- 'web_directory ' => 'public ' ,
657- ],
658- ],
659630 [
660631 [
661632 'type ' => PHPBlank::id (),
@@ -666,15 +637,6 @@ public static function create_data(): array
666637 'user ' => 'example ' ,
667638 ],
668639 ],
669- [
670- [
671- 'type ' => PHPMyAdmin::id (),
672- 'domain ' => 'example.com ' ,
673- 'aliases ' => ['www.example.com ' ],
674- 'php_version ' => '8.2 ' ,
675- 'version ' => '5.1.2 ' ,
676- ],
677- ],
678640 [
679641 [
680642 'type ' => PHPMyAdmin::id (),
0 commit comments