Commit Graph

93 Commits

Author SHA1 Message Date
Sami Mazouz
379298acb0
feat: add support for PgSQL (#3985)
* feat: add support for `PgSQL`
* chore: generate dump
* feat: query exception errors db driver hint
* feat: allow defining supported databases
* chore: review comments
* feat: setting for pgsql preferred search config
2024-06-22 08:03:56 +01:00
Sami Mazouz
a8777c6198
refactor: JSON:API (#3971)
* refactor: json:api refactor iteration 1
* chore: delete dead code
* fix: regressions
* chore: move additions/changes to package
* feat: AccessTokenResource
* feat: allow dependency injection in resources
* feat: `ApiResource` extender
* feat: improve
* feat: refactor tags extension
* feat: refactor flags extension
* fix: regressions
* fix: drop bc layer
* feat: refactor suspend extension
* feat: refactor subscriptions extension
* feat: refactor approval extension
* feat: refactor sticky extension
* feat: refactor nicknames extension
* feat: refactor mentions extension
* feat: refactor lock extension
* feat: refactor likes extension
* chore: merge conflicts
* feat: refactor extension-manager extension
* feat: context current endpoint helpers
* chore: minor
* feat: cleaner sortmap implementation
* chore: drop old package
* chore: not needed (auto scoping)
* fix: actor only fields
* refactor: simplify index endpoint
* feat: eager loading
* test: adapt
* test: phpstan
* test: adapt
* fix: typing
* fix: approving content
* tet: adapt frontend tests
* chore: typings
* chore: review
* fix: breaking change
2024-06-21 09:36:32 +01:00
Sami Mazouz
eb6e599df1
feat: add support for SQLite (#3984)
* feat: add support for sqlite

* chore: add warning on install

* fix: ignore constraints before transaction begins

* chore: update workflow

* Apply fixes from StyleCI

* chore: generate sqlite dump and manually add foreign keys

* chore: fix actions

* chore: fix actions

* chore: fix actions

* chore: fix actions

* chore: fix actions

* chore: fix actions

* test: fix

* Apply fixes from StyleCI

* fix: sqlite with db prefix

* Apply fixes from StyleCI

* fix: statistics sqlite
2024-06-21 07:25:11 +01:00
Sami Mazouz
b8e17182e9
feat: advanced maintenance modes (#3977)
* feat: low maintenance mode (maintenance with admin access) (#3975)
* feat: low maintenance mode (maintenance with admin access)
* Apply fixes from StyleCI
* chore: only required when basic
* chore: more concise code
* chore(review): enum
* feat: enable through settings
* Apply fixes from StyleCI
* core: typing
* feat: safe mode (#3978)
* feat: safe mode
* feat: add extension page warning
* feat: `safe_mode_extensions`
* Apply fixes from StyleCI
2024-05-03 14:05:58 +01:00
Sami Mazouz
2b917372a7
feat: eloquent factories (primarily for tests) (#3982) 2024-05-03 09:20:27 +01:00
StyleCI Bot
5399c86a1b
Apply fixes from StyleCI 2024-01-09 15:06:12 +00:00
Sami Mazouz
693bce912a
fix(testing): use cookie for testing authentication (#3924) 2023-11-10 21:35:24 +00:00
Sami Mazouz
ec5cb98c77
chore: merge the app with the container & implement the ApplicationContract (#3862)
* chore: merge the app with the container & implement the ApplicationContract

Illuminate components always expect the app to be the container, but also expect the app to be implementing the laravel app contract. This means that very often between minor illuminate updates we get a call to a method on the app that doesn't exist in the Flarum app. This fixes the issue once and for all.

* chore: improve concern implementation readability
* chore: service provider no longer has to change app type
* chore: unimplement `terminat(e/ing)`
* Apply fixes from StyleCI
* chore: recover `container` prop
* chore: return types
* fix: phpstan errors
2023-09-15 09:30:24 +01:00
Nicolas Peugnet
4a966b830f
Do not catch exceptions when testing Console commands (#3813)
* Do not catch exceptions when testing Console commands

This allows to easily test a case where a command should throw using `$this->expectException()`.

* Rewrite ConsoleTest to use expectException

Now that the ConsoleApplication is set to not catch exceptions.

---------

Co-authored-by: IanM <16573496+imorland@users.noreply.github.com>
2023-06-21 08:14:12 +01:00
Sami Mazouz
493ffa0538
chore(phpstan): upgrade to be compatible with latest dependency updates (#3835) 2023-06-15 17:49:39 +01:00
Sami Mazouz
64b25b26c3
chore: improve test suite (#3814)
Allows running tests without constantly running `composer install` on each extension.
2023-06-15 13:26:39 +01:00
IanM
6bc19e2e52
chore: Upgrade dependencies (#3830)
* wip: laraval and symfony upgrades

* Apply fixes from StyleCI

* Apply fixes from StyleCI

* bump var dumper to 6.3

* require guzzle 7.7

* remove docbloc

* lock symfony/translation-contracts to 2.5

* fix: require mailgun package

* remove docblock

* fix: flysystem tests

* fix: instance flarum assets for testing

* Apply fixes from StyleCI

* downgrade intervention/image back to 2.x

* Apply fixes from StyleCI

* provide ImageManager to AvatarUploader

* fix larastan

* revert back some other intervention/image changes

* fix image resize

* Update framework/core/src/Http/Middleware/AuthenticateWithHeader.php

Co-authored-by: Daniël Klabbers <luceos@users.noreply.github.com>

* Apply fixes from StyleCI

* Update framework/core/src/Mail/SmtpDriver.php

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>

* Update framework/core/src/User/LoginProvider.php

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>

* use named attrs

* revert imagemanager in constructor

* revert to using Contract mailer

* reinstate and update FlarumLogTransport

* correct var typo, use one less temp var

* names attrs

* uncomment test

* mailer contract

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Daniël Klabbers <luceos@users.noreply.github.com>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2023-06-14 14:46:15 +01:00
Sami Mazouz
082f04d3c3
fix(regression): caught errors
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-31 09:50:39 +01:00
Sami Mazouz
6f11e044a7
chore: update codebase to php8.1 (#3827)
* chore: set minimum php version to 8.1

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* chore: update codebase to php8.1

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

* chore: update workflow php version

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: more caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: phpstan caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: introduce `Flarum\Locale\TranslatorInterface`

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

* chore: remove mixin

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: one last error

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

---------

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-05-30 11:36:12 +01:00
Nicolas Peugnet
3264455068
fix(testing): always clear cache in integration test's tearDown (#3818)
This prevent tests from interacting between each other through the cache.
2023-05-02 19:24:14 +01:00
Sami Mazouz
7298ccb301
feat(testing): add a trait to flush the formatter cache in tests (#3811) 2023-04-30 09:48:46 +01:00
Sami Mazouz
9342903d68
feat: access tokens user management UI (#3587)
Signed-off-by: Sami Mazouz <ilyasmazouz@gmail.com>
Co-authored-by: David <hi@davwheat.dev>
2023-02-21 14:14:53 +01:00
Rafael Horvat
7ce9d63ed6
feat(test): Make it possible to extend SetupScript (#3643)
* Make it possible to extend Flarum\Testing\integration\Setup\SetupScript and added public methods to add settings or extensions to in initial installation pipeline

* Fix syntax error, unexpected 'static'

* Remove `addExtensions` method and document `addSettings`
2022-09-23 13:44:17 +02:00
Sami Mazouz
f6761843b2
feat: customizable session driver (#3610) 2022-09-14 18:10:30 +01:00
Daniël Klabbers
a35df8c139 chore: v1.5.0 preparations 2022-09-13 10:55:30 +02:00
Sami Mazouz
2b31b185e4
feat: clear password & email tokens when appropriate (#3567)
* test: password tokens are generated and deleted on password change
* chore: delete all password tokens when the password is changed
* test: email tokens are generated and deleted on email change
* test: email tokens are deleted after password reset
* chore: delete email tokens after password change
* test: password tokens are deleted after email change
* chore: delete password tokens after email change
* chore: syntactic sugar
* chore: unify event listening
2022-07-30 13:02:06 +01:00
Alexander Skvortsov
a595665bfb
fix: Assorted Typing Fixes (#3348)
With all the commits below, we resolve all outstanding typing issues in the repo, and CI jobs run green.

* fix: Convert DashboardPage and DashboardWidget to TypeScript

* fix: fix type errors in package manager ext

* fix: Convert Post component to TypeScript

* fix: avatar typings should accept null user

* fix: convert Notification component to TypeScript

* fix: properly use `typeof` in ForumApplication

* feat: make Notification content attr generic

* chore: format Notification component

* fix: Convert DiscussionRenamedNotification to TypeScript

* fix(pusher) move shims to a location where they get applied

* fix(pusher): fix some typing errors

* fix(akismet): fix some typing issues

* chore: update core dist typings

* chore(pusher): format

* fix: anchorScroll should accept string selectors

* fix: more accurately represent ApiQueryParamsPlural

* fix: convert PostStreamState to TypeScript

* chore(core): rebuild typings

* feat: allow extending app.routes

* fix: more flexible typings for highlight.ts

* fix: use primitive `number` type for Discussion typings

* fix: convert DiscussionListItem to TypeScript

* chore: rebuild core typings

* fix: final pusher type fixes

* feat: start tags TypeScript conversion

* fix: require-dev tags in pusher for CI TypeScript purposes.

* chore(core): format

* chore(tags): build dist typings

* feat(pusher): use dist types from tags.

* feat: convert flags to TypeScript

* chore(flags): generate dist typings

* fix(akismet): last type errors

* chore: update .yarn-integrity

* chore: partially run flarum-cli audit infra --fix

The tsconfig changes from that command are ignored, since we don't yet support "replacable sections" that would let us add custom config.

* chore: use type imports

* fix: broader gitattributes

* chore: run flarum-cli audit infra --monorepo --fix

* feat: make `app.data` typings extensible

* chore(core): format

* chore: boost tags TypeScript coverage

* fix(tags): further increase type coverage.
2022-03-23 11:43:14 -04:00
dependabot[bot]
37a882118a
chore(deps): bump glob-parent from 3.1.0 to 5.1.2 in /extensions/emoji/js (#3345)
* chore(deps): bump glob-parent in /extensions/emoji/js

Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply fixes from StyleCI

[ci skip] [skip ci]

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
2022-03-11 18:11:20 -05:00
Alexander Skvortsov
693da58c41 chore: set up composer path repos 2022-03-11 18:02:49 -05:00
Alexander Skvortsov
2bf6b12a64 chore: remove centralizable repo config
- Remove .github conf folder from Flarum packages

- Remove styleci config from all packages
2022-03-11 18:01:44 -05:00
Daniel Klabbers
23dc0d7182 allow empty db password "" again 2021-06-21 09:32:27 +02:00
Daniel Klabbers
8eb5cfd062 fix branch alias 2021-05-25 22:59:06 +02:00
David Wheatley
f2398017a7 Update copyright year 2021-05-15 00:58:25 +01:00
Alexander Skvortsov
ce7484e2c8 Extensions should be considered enabled after boot.
Before boot, we consider them "disabled" so they get migrated.
2021-05-11 19:31:35 -04:00
Alexander Skvortsov
d68d551e16 Ensure that migrations run 2021-05-11 17:15:11 -04:00
Alexander Skvortsov
5febbf8fb1 get/set enabled extensions from test case, not DB 2021-05-11 16:24:27 -04:00
Alexander Skvortsov
bd613ba70c Remove second beginTransaction
The transaction is already started in the proper `BeginTransactionAndSetDatabase` extender.
2021-05-03 01:27:06 -04:00
Alexander Skvortsov
148f810d96 Don't resolve routes early.
In normal Flarum, extensions are only enabled during requests. Here, however, we enable some during boot. This resolves the FilesystemManager early, which resolves the Url Generator early. To fix this, we directly provide a filesystem disk for assets instead of getting it from the filesystem manager.
2021-04-23 18:26:41 -04:00
Alexander Skvortsov
04b04f3635 Ensure app is booted when getting database 2021-04-23 15:20:29 -04:00
Alexander Skvortsov
0569da23e1 Drop all DB tables before installation during setup. (#9)
This ensures a clean state for the extension currently being tested. The alternative requires the user to create and keep track of multiple test databases, or manually delete/re-recreate the database every time they switch between extensions being tested. Now, a simple `composer test:setup` will always reset the test environment to the original state.
2021-04-20 14:47:07 -04:00
Alexander Skvortsov
8fd1cc4f0d TestCase Config method (#13)
Similarly to `settings`, this allows setting/overriding config prior to application boot.
2021-04-14 16:27:59 -04:00
Sami Mazouz
b2ecb8f020 Remove UsesSettingsTrait (#12) 2021-04-13 23:46:04 -04:00
Alexander Skvortsov
76a869a198 Start transactions before the app is fully booted. (#11)
This make a cleaner state more likely, and ensures that settings set via `$this->setting` are cleaned up after the test case runs.
2021-04-12 10:26:05 -04:00
Alexander Skvortsov
675627ac15 Add a few more automated tests 2021-04-11 23:00:36 -04:00
Alexander Skvortsov
f13d45f77b Test against dev version of core
Since we're making changes for the dev version of core, we should test against that too.

For now, this fixes issues with the `extensions` method of `Installation` being undefined.
2021-04-11 22:47:09 -04:00
Alexander Skvortsov
f2101e502e Don't enable extensions during installation (#7) 2021-04-08 18:39:21 -04:00
Alexander Skvortsov
9ed29cd35e Add automated tests for flarum/testing 2021-04-07 22:38:58 +01:00
Alexander Skvortsov
1fbf5fd029 Add setting method to integration TestCase
This allows adding settings before the app is booted. In the past we've used hacky workarounds like manually resetting a binding to override singletons to use custom setting values. It makes sense to support this through `TestCase`.
2021-04-07 15:01:40 -04:00
Clark Winkelmann
3506991d3e Requirement and formatting fixes (#5)
Add ext-json to composer requirements
Update editorconfig to match core
Update phpdoc to not reference missing import
2021-03-21 19:26:25 +01:00
Clark Winkelmann
f410f69b36 Add missing import for ExtensionManager (#6)
Replace bind with singleton, otherwise singleton behavior is lost
2021-03-21 19:25:02 +01:00
Clark Winkelmann
082a600adf Fix variable names (#4)
It's not causing any issue because the correct variable name is always used to set and read the value, and PHP is fine setting new attributes on a class dynamically. It's just the explicit variables declared don't match with those actually used later.
2021-03-20 18:46:03 -04:00
SychO9
c7fdb79ce3 Ignore generated tmp 2021-03-11 13:07:31 -05:00
SychO9
ca8b7424b8 Add required argument 2021-03-11 13:07:31 -05:00
Alexander Skvortsov
ce0e5c99a6 Use mockery 1.4 2021-03-06 18:58:07 -05:00
Alexander Skvortsov
19763f8641 Update PHPUnit to v9 2021-03-06 18:38:34 -05:00