diff --git a/README.md b/README.md index 82083dc2..f4274846 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,9 @@ This is a [Laravel](https://laravel.com/) Web Application for Crowdsourcing Proj - [Related HTML Template](#related-html-template) - [PHP code style - Laravel Pint](#php-code-style---laravel-pint) - [Installation-specific resources](#installation-specific-resources) +- [Development Guidelines](#development-guidelines) + - [Directory Structure](#directory-structure) + - [About the Repository Pattern](#about-the-repository-pattern) - [Run Tests](#run-tests) - [How to debug](#how-to-debug) - [Troubleshooting](#troubleshooting) diff --git a/tests/Feature/Controllers/CrowdSourcingProjectControllerTest.php b/tests/Feature/Controllers/CrowdSourcingProjectControllerTest.php index de18595d..0c9ac171 100644 --- a/tests/Feature/Controllers/CrowdSourcingProjectControllerTest.php +++ b/tests/Feature/Controllers/CrowdSourcingProjectControllerTest.php @@ -12,6 +12,7 @@ use App\Repository\CrowdSourcingProject\CrowdSourcingProjectRepository; use Faker\Factory as Faker; use Tests\TestCase; +use Illuminate\Support\Str; class CrowdSourcingProjectControllerTest extends TestCase { protected CrowdSourcingProjectRepository $crowdSourcingProjectRepository; @@ -301,9 +302,7 @@ public function nonAdminUserCannotStoreProject() { $faker = Faker::create(); // we need a name with no special characters $name = $faker->name; - $slug = str_replace(' ', '-', strtolower($name)); - // remove dots from the slug - $slug = str_replace('.', '', $slug); + $slug = Str::slug($name); $response = $this->withoutMiddleware(VerifyCsrfToken::class) // Disable CSRF only ->post(route('projects.store'), [ 'name' => $name, @@ -327,7 +326,7 @@ public function adminCanStoreProjectWithValidData() { $faker = Faker::create(); $name = $faker->name; - $slug = str_replace(' ', '-', strtolower($name)); + $slug = Str::slug($name); $response = $this->withoutMiddleware(VerifyCsrfToken::class) ->post(route('projects.store'), [ @@ -425,8 +424,7 @@ public function authenticatedUserCannotUpdateProject() { $project = CrowdSourcingProject::factory()->create(); $faker = Faker::create(); $name = $faker->name; - $slug = str_replace(' ', '-', strtolower($name)); - $slug = str_replace('.', '', $slug); + $slug = Str::slug($name); $response = $this->withoutMiddleware(VerifyCsrfToken::class)->put(route('projects.update', ['project' => $project->id]), [ 'name' => $name, 'description' => 'Updated Description', @@ -450,7 +448,7 @@ public function adminCanUpdateProjectWithValidData() { $project = CrowdSourcingProject::factory()->create(); $faker = Faker::create(); $name = $faker->name; - $slug = str_replace(' ', '-', strtolower($name)); + $slug = Str::slug($name); $response = $this->withoutMiddleware(VerifyCsrfToken::class)->put(route('projects.update', ['project' => $project->id]), [ 'name' => $name, 'description' => 'Updated Description',