Skip to content

Add test coverage reporting, improve test coverage#271

Open
GonzaloGM wants to merge 934 commits into
masterfrom
coverage
Open

Add test coverage reporting, improve test coverage#271
GonzaloGM wants to merge 934 commits into
masterfrom
coverage

Conversation

@GonzaloGM

@GonzaloGM GonzaloGM commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Adds test coverage reporting and initial test suite

@GonzaloGM GonzaloGM changed the title Improve test coverage Add test coverage reporting, improve test coverage Apr 28, 2026
Assert stable JSON envelopes, reopen and status/note branches,
resolve/close optional messages, empty attachments, and resilient
reply success when notification delivery fails.
…ests)

- Route testing uploads through writable sys temp and resolve paths in file tests
- Fix get_query(0) index handling and image upload max-bytes null fallback
- Expose notification channels via BaseNotification::getVia()
- Persist automated bans with admin-scoped user updates
- Resolve social friend IDs to Users before FriendsManager::make
- Align Message fillable and transformer/unit tests with actual schema/accessors
- Drop obsolete dual-car validator scenario after one-car-per-user constraint
- Adjust FriendsManager mutual-request expectations; Announcement device seed via query insert
Align mysql/mariadb PDO options with Laravel by using Pdo\Mysql::ATTR_SSL_CA
instead of custom constant resolution, avoiding PHP 8.5 PDO deprecation
noise in Pest output.

Upgrade actions/checkout and actions/cache to v5 for Node runner compatibility.
Query conversations by trip_id with whereHas for the requesting user so we
do not pick an unrelated duplicate conversation and fail membership checks.

Use whereKey/exists for belongsToMany membership on getConversationFromId;
where user_id on the users relation targeted the wrong column.
Use whereKey on the users() belongsToMany relation so read state resolves
correctly.

MessagesTest: attach driver before getConversationByTrip; add matchUser tests;
assert duplicate createTripConversation calls yield two trip-scoped rows.
Cover enforcement flags, cutoff parsing, and new-user validation branches;
reset Carbon test time in tearDown.
Add integration coverage for six-month created_at gate, dual path LIKE
branches, three-point distance endpoint selection, and deterministic
getPotentialNode bbox checks using unsaved corner coordinates.

Document mutant motives and fixes in tests/mutation-notes.md.
Remove stray logging from matchUser. Add behavioral tests for symmetric
peer lookup, string conversation ids, and who-filter vs broadcast chat search.

Extend mutation-notes.md with ConversationRepository entries.
Add a two-friend scenario so only the friend whose display name contains
the search needle is returned, asserting the SQL LIKE pattern with
leading and trailing wildcards survives RemoveMethodCall and Concat*.
Track-search must treat seats_available <= 0 as full; a trip with exactly
zero remaining seats must increment amount_trips_carpooleados so mutants
that tighten the comparison to < 0 fail.
When two users share unread pivots on the same message, markMessages for
one user must not flip read for the other, killing RemoveMethodCall on
the whereHas user_id constraint.
Include a node exactly at minLat minus the default lat padding so
DecrementFloat/IncrementFloat mutants on the literal cannot shrink the
window without failing getPotentialsNodes.
generateTripFriendVisibility must no-op for PRIVACY_PUBLIC; assert zero
user_visibility_trip rows. Document Infection operators and fixes in
mutation-notes for this batch (conversation, trip search, message,
routes, trip repository).
…s graph

Assert pending listings eager-load users; accepting one passenger leaves a
second pending row untouched; distinct trips when multiple passengers
carry payment_status; nested passenger.trip.user eager loads.
When from/to rate on two trips, getRating must return the row for the
requested trip_id so chained where clauses cannot be dropped.
Lock resolveUploadFolder under phpunit to sys temp carpoolear-test-uploads
so concat/rtrim mutants on the testing branch fail visibly.
Register coverage for AppServiceProvider container wiring so RemoveMethodCall
mutants on bind/singleton registrations are killed.
…rovider

Document survivor causes, fixes, tests, and Infection operators for the new
repository and provider coverage.
Point phpunit.xml at tests/bootstrap.php so Composer loads after CREATE DATABASE IF NOT EXISTS for DB_DATABASE (from phpunit env).

Turn on dropViews during RefreshDatabase migrate:fresh so views drop before tables.

Optional MYSQL_ATTR_SSL_CA matches PDO option used in config/database.php for RDS-style setups.
…ocess runs

- Bootstrap loads .env/.env.testing, ensures the testing schema exists, and
  optionally serializes concurrent access with a file lock (TESTS_SKIP_MYSQL_FILE_LOCK).
- TestCase overrides beginDatabaseTransaction to avoid resetting migration state
  when PDO reports no transaction during teardown.
- phpunit.xml clears LARAVEL_PARALLEL_TESTING and documents single-DB runs.
- Remove DatabaseTransactions from suites that already use RefreshDatabase via
  the base TestCase to avoid double transactions and flaky teardown.
…al/friend tests

- Reapply Laravel’s non-transaction teardown branch so migrate:fresh reruns when
  the MySQL connection is no longer in a transaction, avoiding leaked rows.
- Scope testing uploads under sys temp with a PID suffix to avoid permission
  clashes on a shared carpoolear-test-uploads directory.
- Bind TestSocialProvider in AppServiceProviderBindingsTest so SocialManager resolves.
- FriendApiTest: stub getFriends/getPendings with fixed collections instead of User::all().
GonzaloGM added 30 commits May 4, 2026 21:55
…tion

Kills RemoveMethodCall on startup log under MSI.
Cause/fix/mutant references for canPerformRestrictedActions refactor,
make_pagination/console_log/get_query, ssmtp log, AcceptPassenger extras,
and via-constructor notifications.
Assign delivery channels in __construct so RemoveArrayItem mutants on
via are exercised. Remove unused toPush message-text branch and assert
email URL when conversation payload is absent.
…tion

Wire channels in __construct for MSI coverage. Assert email url is the
base trips path when no trip attribute is set, matching push fallback.
NewUser and ResetPassword also set force_email in __construct so
TrueToFalse mutants on the flag are executed. Dummy and RequestRemainder
assign channel lists after parent::__construct().
Assert isEnabled returns bool and that exactly 25 coordinates still
reach Mapbox. Document 2026-04-30 notification and Mapbox fixes in
mutation-notes.
Distinct validation messages so CoalesceRemoveLeft on the extension
branch cannot masquerade as the MIME path. Add extension-only failure
case and tighten MIME assertions in existing tests.
Normalize compared user ids with int casts and === so EqualToIdentical
mutants cannot change loose equality without failing the contract.
Require comment to stay string-typed when rating is present. Compare
passenger request_state and canceled_state with int-cast === guards.
Fix rating in: rule list typo (in:0,1).
Strengthen attachment persistence assertions for RemoveArrayItem on
ticket_id and RemoveIntegerCast on stored size_bytes.
Pair strict ownership checks with tests that pin inactive-device
threshold behavior and same-session registration. Mutation targets:
RemoveEarlyReturn, DecrementInteger/IncrementInteger on cleanup,
EqualToIdentical on user_id comparisons.
Harden getNotifications pagination guard and read flag mapping.
Mutation targets: BooleanAndToBooleanOr on page/page_size isset,
NotEqualToNotIdentical on readed vs read_at.
Use strict int comparisons on cancel and accept paths; exercise
sendFullTripMessage only when accepted count reaches seats_available.
Mutation targets: EqualToIdentical on cancel, seats_available zero
check, PHPUnit assertions alongside Mockery for sendFullTripMessage.
Document Logic manager mutation fixes in mutation-notes.md.
Mutation targets: TernaryNegated, CoalesceRemoveLeft on constructor
defaults.
Inject optional FirebaseService so unregister can throw in tests.
Kills MSI mutants on catch Log::error context, delete, and count
(7477f0453ed06c39, e4009e822c150e2e, 69f7e8caf08b4d46,
6469c54fd15c2847, f5ba4072152a1fb5, d7b64ccb1e27ef1e).
Covers setErrors + early return when tripOwner is false while the
passenger is still pending (7150bc5043a39164, 8820f6f02012d44a,
76e57cd06df12f2f). Without return, repository would reject without
ownership check.
…pload paths

Extract fetchRecaptchaVerificationResponse for testable reCAPTCHA flow;
fix driver admin mail to run after driver_data_docs JSON encoding;
add tests for bankData, captcha success/fail/banned-word, validator
early return, uploadDoc/updatePhoto, and driver Mail::send.
Use file_get_contents named argument for reCAPTCHA fetch to drop a
meaningless use_include_path boolean mutant. Add unit tests for the
real fetch path, driver doc upload failure, non-driver JSON encoding of
driver_data_docs, Mail::send closure (to/subject), JPEG upload via
HeicToJpegConverter mock, and recursive makeDirectory when the docs
folder is missing. Document the follow-up in mutation-notes.
Add createFacebookSdk seam, guard WhatsApp local HTTP fallback when the
Facebook curl client stack is absent, and expand unit tests for unknown
provider logging, incomplete WhatsApp credentials, Facebook Graph paths,
local SMS log append, SMS Masivos 15-prefix normalization, and
verification code shape.
Allow optional Google Client injection for tests, drop empty-string
property defaults so EmptyStringToNotEmpty mutants are not meaningful,
and add constructor/setAuthConfig and fetchMessagingAccessToken coverage
plus web device and unregister smoke tests.
Add probe subclass for parent geocode fetch, null JSON paths, URL
encoding assertion, and single address_component mapping.
Cover female and missing gender, partial birthday, banned/terms flags,
and Graph URI access_token matching.
Assert banned=true persistence and synthetic email from md5(provider id);
cover empty friend_ids array.
Assert Log warning when rules lack type; expect InvalidArgumentException
for registration_duration, total_donated, and donated_to_campaign when
required keys are missing.
Expand unit coverage for isEnabled, waypoint caps, HTTP/parse paths,
and request-exception logging. Document mutant operators and fixes in
mutation-notes.md.
Refactor name normalization to intl-gated Normalizer plus extracted
latinAccentMap/normalizeNameAccentFallback. Add reflection coverage
for every accent mapping, partial last-name nameMatches negative, and
broader OAuth/PKCE/HTTP assertions. Document operators and fixes in
mutation-notes.md.
Assert getPaidRegions() matches canonical vertex tables, cover
doStopsRequireSellado thresholds, and reject Córdoba–Mar del Plata
without a paid route row. Remove unreachable region-null guard after
arePointsInPaidRegions. Document mutant operators and Infection IDs in
mutation-notes.md.
…ants

Add query-log assertions for both CONCAT/LIKE fragments; freeze Carbon in
today search test. Document causes and fixes in mutation-notes.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant