Skip to content

Conversation

zigzagdev
Copy link
Owner

Description

This PR rectifies a routing inconsistency in the User show test, where the endpoint was mistakenly written as api/user/show/{id} instead of the correct api/users/show/{id}.

The correct route is defined within the users prefix group in routes/api.php:

Route::get('/show/{id}', [UserController::class, 'showUser'])->name('show');

With this fix, the test now correctly targets the defined route and is no longer subject to 404 Not Found errors.

Copy link
Owner Author

@zigzagdev zigzagdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self Review

  • Updated the request URL from 'api/user/show/{id}' to 'api/users/show/{id}'
  • Confirmed that the test setup uses a valid user ID
  • Ensured that the status code and response assertions remain valid
  • Verified alignment with actual Route::get() definition in API routing
  • Confirmed successful execution of test after correction

@zigzagdev zigzagdev requested a review from Copilot July 7, 2025 11:14
@zigzagdev zigzagdev self-assigned this Jul 7, 2025
@zigzagdev zigzagdev linked an issue Jul 7, 2025 that may be closed by this pull request
@zigzagdev zigzagdev merged commit 61a3d9a into feature/fix-user-api-tests Jul 7, 2025
@zigzagdev zigzagdev deleted the feature/fix-user-api-test-show branch July 7, 2025 11:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR corrects the endpoint used in the User show tests and improves test method naming.

  • Updated test requests from api/user/show/{id} to api/users/show/{id}
  • Renamed test methods for better clarity
  • Removed explicit User type hint on the private $user property
Comments suppressed due to low confidence (3)

src/app/User/Tests/User_ShowTest.php:55

  • [nitpick] Method name suggests a failure scenario but asserts a 200 response; consider renaming to reflect the expected success status or adjust the assertion.
    public function test_failed_with_invalid_property(): void

src/app/User/Tests/User_ShowTest.php:12

  • [nitpick] The private $user property appears unused in this test class; consider removing it to reduce clutter.
    private  $user;

src/app/User/Tests/User_ShowTest.php:12

  • Removed the User type hint on $user; re-add the type declaration to maintain type safety.
    private  $user;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

User Show Test

1 participant