Skip to content

Commit

Permalink
setUp
Browse files Browse the repository at this point in the history
  • Loading branch information
PavlosIsaris committed Oct 25, 2024
1 parent df064a2 commit a625e18
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/Feature/Controllers/UserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ class UserControllerTest extends TestCase {

protected $seed = true;

protected function setUp(): void {
parent::setUp();

// Ensure the directory exists for testing
$storagePath = storage_path('app');
if (!is_dir($storagePath)) {
if (!mkdir($storagePath, 0777, true) && !is_dir($storagePath)) {
$this->fail("Failed to create the directory: {$storagePath}");
}
}
}

/** @test */
public function myDashboardDisplaysDashboardForAuthenticated_user() {
$user = User::factory()->create();
Expand Down Expand Up @@ -80,10 +92,6 @@ public function patchUpdatesUserProfileWithValidData() {

/** @test */
public function patchUpdatesUserProfileWithValidDataWithImage() {
// Ensure the directory exists
if (!file_exists(storage_path('app'))) {
mkdir(storage_path('app'), 0777, true);
}
$user = User::factory()->create();
$this->be($user);
$faker = Faker::create();
Expand Down Expand Up @@ -119,10 +127,6 @@ public function patchUpdatesUserProfileWithValidDataWithImage() {

/** @test */
public function patchUpdatesUserProfileWithInvalidImage() {
// Ensure the directory exists
if (!file_exists(storage_path('app'))) {
mkdir(storage_path('app'), 0777, true);
}
$user = User::factory()->create();
$this->be($user);
$faker = Faker::create();
Expand Down Expand Up @@ -151,10 +155,6 @@ public function patchUpdatesUserProfileWithInvalidImage() {

/** @test */
public function pathUpdatesUserProfileWithVeryBigImage() {
// Ensure the directory exists
if (!file_exists(storage_path('app'))) {
mkdir(storage_path('app'), 0777, true);
}
$user = User::factory()->create();
$this->be($user);
$faker = Faker::create();
Expand Down

0 comments on commit a625e18

Please sign in to comment.