Skip to content

Commit

Permalink
- Fixed slug generator
Browse files Browse the repository at this point in the history
- Added missing chapter in ToC
  • Loading branch information
PavlosIsaris committed Oct 7, 2024
1 parent 082aca1 commit 3a3e57d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 5 additions & 7 deletions tests/Feature/Controllers/CrowdSourcingProjectControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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'), [
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 3a3e57d

Please sign in to comment.