Commit graph

28 commits

Author SHA1 Message Date
8cbc84b051
test PromoteUserToAdmin use case 2026-05-06 22:34:29 +03:00
31a807f0ae
test SearchUsers use case 2026-05-06 22:33:22 +03:00
e61492f864
test ListFeaturedPosts use case 2026-05-06 22:30:32 +03:00
7bd3ff78b4
test ClearFeaturedPost use case 2026-05-06 22:29:54 +03:00
13ca655f9b
test SetFeaturedPost use case 2026-05-06 22:29:09 +03:00
64a334c63e
test Post entity feature slot 2026-05-06 22:27:18 +03:00
5bbef871db
test DeleteComment use case 2026-05-06 22:16:10 +03:00
a59fc4890f
implement ListCommentsForPost use case
Renames seed() helper to seedComment() to avoid clashing with
Illuminate\Foundation\Testing\TestCase::seed().
2026-05-06 22:15:49 +03:00
f9e2529994
test ListCommentsForPost use case 2026-05-06 22:15:10 +03:00
2557c9b6a9
test CreateComment use case 2026-05-06 22:14:31 +03:00
11f2823a30
test SignupUser two-step confirm flow 2026-05-06 22:08:25 +03:00
60308988f7
test ConfirmUserEmail use case 2026-05-06 22:07:08 +03:00
9747d07c31
test EmailConfirmationToken entity 2026-05-06 22:04:57 +03:00
4829a02aac
test SignupUser displayname requirement
Adds displayname to existing assertions and new tests covering:
null/short/invalid-charset displayname, duplicate displayname,
findability by displayname. AuthenticateUser tests pick up the
seedUser displayname argument.
2026-05-06 22:03:40 +03:00
298b8634ec
extend User entity with displayname and email confirmation
Add display_name (unique) and email_confirmed_at columns plus
matching getters, DTO fields, repo methods (findByDisplayName,
update), and migration. Existing auth tests updated to construct
User with the new params.
2026-05-06 22:03:19 +03:00
d547ec2c61
test User entity displayname and email confirmation 2026-05-06 22:00:22 +03:00
yisroel
fd91da6bab
test DeletePost use case
7 cases: zero postId or requesterId -> BadRequest; unknown post
is idempotent no-op; author can delete own post; admin can
delete anyone's post; non-author non-admin -> ForbiddenException;
forbidden attempts leave post intact.
2026-05-06 15:26:28 +03:00
yisroel
eb0ebc6f63
test GetPost use case
4 cases: zero/negative id -> BadRequest; unknown id -> null
(controller maps to 404); existing id returns the Post.
GetPost takes int id directly (no Request object - the value is
trivial and controllers pull it from a route param).
2026-05-06 15:25:36 +03:00
yisroel
e97ca28237
test ListUserPosts use case
5 cases: zero/negative userId -> BadRequest; user with no posts
-> []; returns only requested user's posts (filters out other
authors); ordered newest-first by createdAt. fails red.
2026-05-06 15:24:41 +03:00
yisroel
e9779d8459
test ListRecentPosts use case
5 cases: zero/negative limit -> BadRequest; empty repo -> [];
returns posts ordered newest-first; respects limit truncation.
fails red - ListRecentPosts class missing.
2026-05-06 15:23:53 +03:00
yisroel
504554bf7f
test CreatePost use case
7 cases: null + whitespace title -> BadRequest; null +
whitespace body -> BadRequest; valid request returns Post with
correct userId/title/body and createdAt = clock.now(); the post
is findable via the repo afterwards; title and body get trimmed
of leading/trailing whitespace. fails red - CreatePost class
absent.
2026-05-06 15:22:57 +03:00
yisroel
d87215ff9b
test AuthMiddleware
4 cases: missing auth_token cookie -> 401 json
{error: unauthenticated}; unknown token -> 401; expired token
-> 401 + repo cleanup; valid token -> 200 with the User attached
to request->attributes['user']. fails red - middleware class
absent.
2026-05-06 15:16:35 +03:00
yisroel
30e97864c8
test Logout use case
2 cases: existing token's session gets removed; unknown token
is a no-op (deleteByToken stays idempotent).
2026-05-06 15:15:46 +03:00
yisroel
adc60a8059
test CreateSession use case
4 cases: returns Session with the generated token + supplied
user; createdAt matches injected Clock now; expiresAt is now+7d;
session is findable via SessionRepository->findByToken. fails
red - CreateSession class missing.
2026-05-06 15:15:04 +03:00
yisroel
2731e610e5
test AuthenticateUser use case
9 cases: null/empty/malformed email -> BadRequest; null/empty
password -> BadRequest; unknown email -> Unauthorized; wrong
password -> Unauthorized; valid creds return the User entity;
isAdmin flag survives the auth round-trip. fails red - the
AuthenticateUser class does not exist yet.
2026-05-06 15:14:03 +03:00
yisroel
fefc992431
test SignupUser use case
9 cases: null/empty/malformed email -> BadRequest; null or
sub-8-char password -> BadRequest; duplicate email -> DomainException;
valid signup returns User with hashed password and isAdmin=false;
user is findable by email afterwards; EmailAddress vo lowercases
the domain. fails red - SignupUser class not yet defined.
2026-05-06 15:12:52 +03:00
yisroel
f862348a31 test EmailAddress value object
7 cases: rejects spaces, double-@, empty input; trims whitespace;
lowercases domain only (preserving local-part case); equality by
normalized value; __toString and getDomain. fails red - class
App\\Shared\\ValueObject\\EmailAddress not yet defined.
2026-05-06 14:52:14 +03:00
yisroel
c03ffc8941 scaffold laravel 12 backend
composer create-project laravel/laravel + artisan install:api.
sanctum removed (custom session-cookie auth per ai/backend-context).
personal_access_tokens migration + config/sanctum.php deleted.
default .gitignore excludes vendor/, .env, etc - composer install
recreates vendor at setup time.
2026-05-06 14:46:41 +03:00