Commit Graph

169 Commits

Author SHA1 Message Date
Chirag Aggarwal d2230f8fe7 chore: bump PHPStan to level 4 and fix all new errors
Raises `phpstan.neon` level from 3 to 4 and fixes the 549 new errors
that level 4 surfaces across 157 files. Fixes are root-cause — no
`@phpstan-ignore`, no `@var` casts, no baseline entries, no widened
types. A handful of latent bugs were fixed along the way:

- `app/controllers/general.php`: path-traversal guard was negating
  `\substr(...)` before the strict comparison (`!\substr(...) === $base`
  was always `false === $base`). Rewritten as `\substr(...) !== $base`.
- `src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php`
  and `.../TablesDB/Logs/XList.php`: were importing the raw Matomo
  `DeviceDetector` (whose `getDevice()` returns `?int`) but treating the
  result as an array with `deviceName/deviceBrand/deviceModel` keys.
  Swapped to `Appwrite\Detector\Detector`, matching the wrapper already
  used a few lines below for `$os`/`$client`.
- `src/Appwrite/Platform/Modules/Functions/Workers/Builds.php`: a match
  key was checking `$resourceKey === 'functions'` when `$resourceKey`
  is `'functionId'|'siteId'` — always false. Switched to the intended
  `$resource->getCollection() === 'functions'` check.
- `src/Appwrite/OpenSSL/OpenSSL.php`: `encrypt()` return type tightened
  to `string|false` to match `openssl_encrypt`; this lets callers'
  `=== false` error handling remain meaningful.
- `app/controllers/api/messaging.php`: removed a dead
  `array_key_exists('from', [])` branch in the Msg91 provider (empty
  array literal; branch was unreachable).

Large cleanup categories across the 549 fixes:
- Removed redundant `?? default` on array offsets and expressions that
  PHPStan now knows are non-nullable.
- Removed unreachable statements (mostly `return;` after `throw` or
  `markTestSkipped()`).
- Removed redundant `is_array`/`is_string`/`is_bool`/`instanceof` checks
  on already-narrowed types.
- Added `default =>` arms (or throwing arms) to non-exhaustive matches
  on `string`/`mixed` input.
- Removed dead `$document === false` branches where method return types
  were tightened to non-nullable `Document`.
- Removed unused properties (`$version` on Etsy/Zoom OAuth2, `$paths` on
  Installer State, `$source` on MigrationsWorker, `$account2` on two
  GraphQL auth tests), unused traits (`ApiVectorsDB`, `DatabaseFixture`),
  and an unused `cleanupStaleExecutions` task method.
- Replaced `assertTrue(true)` and redundant `assertIsArray`/`assertIsString`/
  `assertNotNull` assertions with `addToAssertionCount(1)` or
  `assertNotEmpty` where the runtime type was already known.
2026-04-19 17:31:20 +05:30
Jake Barnby 5cb36a0a3a fix: resolve E2E test race conditions in parallel execution
- Add probe callback support to getLastEmail(), getLastEmailByAddress(),
  and getLastRequest() to filter results by content before accepting
- Fix variable name typo in TeamsCustomClientTest ($email vs $lastEmail)
- Add event probes to all 56 webhook test getLastRequest() calls to
  filter by specific event pattern (resource ID + action)
- Add email probes to Account OTP/recovery/magic-url tests to wait for
  the correct email (security phrase, Password Reset subject, etc.)
- Add email probes to Projects tests for recovery email URL matching
- Increase FunctionsSchedule future time from 1min to 2min to avoid
  timing issues when seconds are zeroed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 14:43:15 +13:00
Jake Barnby 161e4e53d4 fix: Address remaining parallel-safety failures across all test suites
- Fix Legacy DatabasesStringTypesTest with project-keyed setup cache
- Fix Account OTP test with unique email, phone session re-login
- Fix GraphQL setup methods with sleep, 409 handling, missing columns
- Fix Databases list/pagination tests with document ID filtering
- Fix Permissions tests with assertGreaterThanOrEqual for counts
- Fix Messaging scheduled tests to not depend on scheduler timing
- Increase Realtime WebSocket timeout to 60s and assertEventually to 30s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:20:42 +13:00
Jake Barnby 714b8d7ea6 Migrate to PHPUnit 11 2026-01-15 16:14:53 +13:00
Jake Barnby a34fa1ceb6 Fix abuse 2026-01-13 22:01:22 +13:00
Jake Barnby 879a599bed Fix parallel cases 2026-01-11 02:33:20 +13:00
Matej Bačo 7567639996 grammar fix 2026-01-06 15:18:44 +01:00
Matej Bačo d7bb234072 PR reviews 2026-01-06 15:18:22 +01:00
Matej Bačo b29f70a0af Add new tests 2026-01-05 22:51:03 +01:00
Levi van Noort cd90974e15 chore: changes to test to validate default behaviour instead 2025-12-15 13:22:29 +01:00
Levi van Noort 90fb5b6321 feat: improved reference client ip through _APP_TRUSTED_HEADERS 2025-12-12 08:42:49 +01:00
loks0n f765eb92e7 feat: cors service 2025-12-11 09:01:31 +00:00
Damodar Lohani 866bd5ebc8 Fix: update test IP 2025-12-02 05:25:25 +00:00
fogelito 5afae248ae Test Update 2025-11-10 15:00:18 +02:00
fogelito fe9d49c346 Response Model 2025-11-04 17:13:53 +02:00
Hemachandar 29dbe99840 simplify config & templates 2025-10-06 19:58:01 +05:30
Hemachandar 752368327f feedback 2025-09-24 13:06:20 +05:30
Hemachandar 0812ac97a9 tests 2025-09-18 14:09:42 +05:30
Chirag Aggarwal 06e4920ee2 fix: create email target when using email otp registration 2025-07-29 11:57:57 +05:30
hmacr ee5a644771 tests 2025-07-24 19:39:23 +05:30
Chirag Aggarwal 1e71eb84c4 chore: added devkeys to account and database tests 2025-01-29 04:25:52 +00:00
Damodar Lohani cd54ba1b83 fix account test 2024-12-15 10:49:35 +00:00
Damodar Lohani b8388a4092 fix expected in test 2024-12-15 10:41:01 +00:00
Matej Bačo 4c6f01ad68 Update tests 2024-05-07 09:05:54 +00:00
Torsten Dittmann 0a1d572c72 chore: run formatter 2024-03-06 18:34:21 +01:00
Khushboo Verma 0f1df4b5bb Fixed tests 2024-02-05 13:25:52 +05:30
Khushboo Verma 0ea7b28a6b Resolve merge conflicts 2024-02-02 12:53:25 +05:30
Khushboo Verma 1f0dc6cc1e Update swoole version 2024-02-02 12:50:27 +05:30
Matej Bačo ef3f7878dc PR review changes 2024-02-01 14:13:30 +00:00
Khushboo Verma 851e5c5154 Remove restrict group and add logic to auth group 2024-02-01 17:40:41 +05:30
Matej Bačo a47a4240ed Rename security phrases 2024-02-01 10:41:01 +00:00
Khushboo Verma dadb94c499 Merge branch '1.5.x' into feat-block-countries 2024-01-31 12:24:21 +05:30
Khushboo Verma f4426d553c Throw 451 exception 2024-01-29 16:49:13 +05:30
Khushboo Verma 4cd5999bb3 Merge branch '1.5.x' into feat-block-countries 2024-01-29 16:25:31 +05:30
fogelito a782e20315 Merge branch '1.5.x' of github.com:appwrite/appwrite into json-parsing
 Conflicts:
	app/controllers/api/account.php
	composer.json
	composer.lock
	src/Appwrite/Platform/Tasks/CalcTierStats.php
	tests/e2e/Services/Account/AccountBase.php
2024-01-25 17:44:05 +02:00
Khushboo Verma 51d1a38f0f Added test case 2024-01-24 18:24:48 +05:30
Torsten Dittmann 9f5a0312cf Merge branch 'main' of https://github.com/appwrite/appwrite into 1.5.x 2024-01-24 11:24:59 +01:00
Torsten Dittmann a9f1e4d78d feat: delete account (#7392)
* feat: delete account

* fix: new endpoint only for console sdk

* fix: hide endpoint from public sdks

* fix: account delete scope
2024-01-22 18:29:10 +01:00
Matej Bačo 1ac7fae9f8 Fix more tests 2024-01-22 14:46:53 +00:00
Matej Bačo d637efb27c Fix failing tests 2024-01-22 14:41:23 +00:00
Matej Bačo 1528eb548a Add failre tests 2024-01-19 14:42:06 +00:00
Matej Bačo df9bc6df56 Implement OTP email endpoint + tests 2024-01-19 13:42:26 +00:00
Torsten Dittmann d344ba46c4 feat: account delete (#7415)
* feat: account delete

* chore: run specs

* release: console sdk

* chore: run formatter

* tests: fix project tests
2024-01-09 12:58:36 +01:00
Jake Barnby 51b2019ab6 Merge remote-tracking branch 'origin/1.5.x' into json-parsing
# Conflicts:
#	composer.lock
2024-01-09 13:56:01 +13:00
loks0n 5c803f6eff Merge branch '1.5.x' of https://github.com/appwrite/appwrite into feat-ssr 2024-01-08 11:41:55 +00:00
Matej Bačo 554e9f93b6 Implement max password length 2024-01-02 10:59:35 +00:00
fogelito dc203a494e Syntax change 2023-12-20 12:55:09 +02:00
Christy Jacob 731e7b86a7 fix: failing tests 2023-12-09 00:17:13 +01:00
loks0n 49425fb8fc test: fix 2023-10-26 15:04:47 +01:00
loks0n 7109e85711 test: seperate client and server tests 2023-10-26 09:43:15 +01:00