1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 15:51:16 +02:00
Commit Graph

92 Commits

Author SHA1 Message Date
Daniël Klabbers
a3c419fba9 Add test for model object argument in callable for attribute defaults 2020-10-07 11:38:52 +02:00
Alexander Skvortsov
6ff50874fa Use Symfony TranslatorInterface for tests
This seems to be a leftover change missed in https://github.com/flarum/core/pull/2243
2020-10-05 16:02:12 -04:00
Franz Liedke
5500753278 Use Config class for data from config.php 2020-09-25 11:10:52 +02:00
Alexander Skvortsov
3a02edb15f Revert https://github.com/flarum/core/pull/1536 (#2305) 2020-09-24 11:30:27 -04:00
Alexander Skvortsov
c10ebea00c User Extender (prepareGroups functionality) (#2110) 2020-07-17 12:18:35 +02:00
Franz Liedke
b89ccaf83c Rename view extender
As discussed in my initial review, it seems unlikely that we need
the ability to remove (or otherwise modify) namespaces again.
Therefore, it seems more consistent with other extenders to go
for a "View" extender with a "namespace" method.

Sorry for the back and forth. ;)

Refs #1891, #2134.
2020-07-17 12:05:49 +02:00
Alexander Skvortsov
cd58692fca View Extender (add namespace) (#2134) 2020-07-17 11:59:00 +02:00
Franz Liedke
17eac0fa4a Clean up usages / deprecate path helpers (#2155)
* Write source map without creating temp file

Less I/O, and one less place where we access the global path helpers.

* Drop useless app_path() helper

This was probably taken straight from Laravel. There is no equivalent
concept in Flarum, so this should be safe to remove.

* Deprecate global path helpers

Developers using these helpers can inject the `Paths` class instead.

* Stop storing paths as strings in container

* Avoid using path helpers from Application class

* Deprecate path helpers from Application class

* Avoid using public_path() in prerequisite check

a) The comparison was already outdated, as a different path was passed.
b) We're trying to get rid of these global helpers.
2020-06-19 16:16:03 -04:00
Alexander Skvortsov
8d9e20f217 Send Test Mail Feature (#2023)
- Add UI, backend for sending test emails
- Change mail settings endpoint to /api/mail/settings
2020-05-30 22:49:36 -04:00
Franz Liedke
12aad66049 Tests: Actually accept multiple extenders
We did pass multiple extenders to this method in the tests for the
`Model` extender - now this actually has the desired effect.
2020-05-23 02:00:25 +02:00
Franz Liedke
00761946c7 Stop using app() helper in tests 2020-05-23 01:56:21 +02:00
Alexander Skvortsov
f7985bac61 Use drivers for display names, add display name extender (#2174)
* Deprecate GetDisplayName event

* Add interface for display name driver

* Add username driver as default

* Add code to register supported drivers / used driver as singletons

* Configured User class to use new driver-based system for display names

* Add extender for adding display name driver

* Add integration test for user display name driver

* Add frontend UI for selecting display name driver
2020-05-19 18:45:56 -04:00
Franz Liedke
417c6210ce Test setup: Do not use env() helper
Not needed, and not working without a full Laravel installation.
2020-05-08 23:30:17 +02:00
Franz Liedke
78b517641f Merge pull request #2142 from flarum/fl/2055-prepare-for-laravel-58
Split up Application and Container
2020-05-07 22:49:36 +02:00
Franz Liedke
3a7b4f392b Make two more tests compatible with PHPUnit 8 2020-05-07 09:18:04 +02:00
Franz Liedke
bf526125eb Split up Application and Container
- Stop trying to implement Laravel's Application contract, which
  has no value for us.
- Stop inheriting from the Container, injecting one works equally
  well and does not clutter up the interfaces.
- Inject the Paths collection instead of unwrapping it again, for
  better encapsulation.

This brings us one step closer toward upgrading our Laravel
components (#2055), because we no longer need to adopt the changes
to the Application contract.
2020-05-01 15:47:35 +02:00
Alexander Skvortsov
6416fbd5d3 Model extender: Fix inheritance (#2132)
This ensures that default values, date attributes and relationships are properly inherited, when we have deeper model class hierarchies.

This also adds test cases to ensure that inheritance order is honored for relationship and default attribute extender. As there's no way to remove date attributes, the order of evaluation there doesn't matter.
2020-04-24 21:17:31 +02:00
Franz Liedke
74027a8421 Model extender: Add failing test
We determined that child classes are not properly affected when
extending the parent classes.

Refs #2100.
2020-04-24 17:54:30 +02:00
Franz Liedke
4ac4af54e6 Fix test to match its description
Refs #2100.
2020-04-24 17:31:08 +02:00
Franz Liedke
56ef8b4613 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-04-24 14:56:37 +00:00
Franz Liedke
c87c2bcd4c Tweak model extender tests
- Format code
- Reorder methods
- Test a different scenario to avoid the use of sleep()

Refs #2100.
2020-04-24 16:55:04 +02:00
Alexander Skvortsov
ef44ff5603 Add model extender (#2100)
This covers default attribute values, date attributes and custom relationships.
2020-04-24 15:10:24 +02:00
Alexander Skvortsov
7dd5c92c31 Implement hidden permission groups (#2129)
Only users that have the new `viewHiddenGroups` permissions will be able to see these groups.

You might want this when you want to give certain users special permissions, but don't want to make your authorization scheme public to regular users.

Co-authored-by: luceos <daniel+github@klabbers.email>
2020-04-21 17:49:53 +02:00
Franz Liedke
699ffec331 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-04-13 09:59:07 +00:00
Franz Liedke
8b30734ffb Tweak event extender (tests)
- Inject contract, not implementation
- Do not dispatch event in test, let the core do that
- Ensure the relevant database tables are reset prior to the test
- Use correct parameter order for assertions

Refs #2097.
2020-04-13 11:58:47 +02:00
Franz Liedke
cde69480bf Tweak mail extender (tests)
- Use private over protected
- Use "public" API for building requests in tests
- Add more assertions
- Formatting
- Use correct parameter order for assertions

Refs #2012.
2020-04-13 11:58:46 +02:00
Alexander Skvortsov
0245df0573 Mail Extender (#2012)
This allows registering new drivers, or overwriting existing ones.
2020-04-13 10:46:33 +02:00
Alexander Skvortsov
f0adb6a120 Add event extender (used for domain events) (#2097) 2020-04-13 10:45:34 +02:00
Franz Liedke
c9f0673f4b Add integration test for API root endpoint 2020-04-10 17:46:15 +02:00
Alexander Skvortsov
d627d01544 Added CSRF Extender (#2095) 2020-04-03 21:32:18 +02:00
Alexander Skvortsov
c84dd4d5bf Add console extender (#2057)
* Made the console command system extender-friendly

* Added console extender

* Added ConsoleTestCase to integration tests

* Added integration tests for console extender

* Marked event-based console extension system as deprecated

* Moved trimming command output of whitespace into superclass

* Renamed 'add' to 'command'

* Added special processing for laravel commands

* Code style fixes

* More style fixes

* Fixed $this->container
2020-04-03 19:38:54 +02:00
Franz Liedke
3246fb3fea Make tests compatible with PHPUnit 8 2020-03-28 11:06:47 +01:00
Franz Liedke
20bc1e50fc Convert last two controller tests to request tests 2020-03-27 13:39:38 +01:00
Franz Liedke
2deae4b058 Rename API tests for more consistency
I could not come up with a noun for the new "UpdateTest" for users, so
this is easier in terms of consistency.
2020-03-27 13:22:27 +01:00
Franz Liedke
4e2f91fa00 Convert more controller tests to request tests 2020-03-27 13:21:10 +01:00
Matt Kilgore
b0fd63adc3 Fix test and extender for middleware (#2084) 2020-03-27 11:00:30 +01:00
Matt Kilgore
84dafdd5c3 fix insertAfter and insertBefore middleware extender functions (#2063) 2020-03-20 22:59:57 +01:00
Franz Liedke
b3dc2c7571 Convert more controller tests to request tests 2020-03-20 18:54:20 +01:00
Franz Liedke
a70acdf9cb Apply fixes from StyleCI
[ci skip] [skip ci]
2020-03-20 17:28:58 +00:00
Franz Liedke
2b0bc2865d Tests: Use new authenticatedAs option where useful
There are two more API integration tests that explicitly add the
"Authorization" header right now:

- `Flarum\Tests\integration\api\authentication\WithApiKeyTest`
- `Flarum\Tests\integration\api\csrf_protection\RequireCsrfTokenTest`

These two specifically test authentication, so in those cases the
explicitness seems desirable.
2020-03-20 18:28:35 +01:00
Franz Liedke
8e21fee06c Replace authenticatedRequest() by request() option
I feel this makes the parameters a bit more clear, does not rely on
inheritance (you can only inherit from one class, but we might want more
of these helpers in the future), and has less side effects (e.g. no
creation and, more importantly, deletion of users in the database).

Refs #2052.
2020-03-20 18:23:06 +01:00
Franz Liedke
6540049421 Tests: Extract trait for building requests 2020-03-20 17:51:03 +01:00
Alexander Skvortsov
fe8df6df4e Add Authenticated Test Case utility 2020-03-20 17:18:35 +01:00
Franz Liedke
7096da722e Add a baseline test for the middleware extender
Refs #2017.
2020-03-06 15:05:16 +01:00
Franz Liedke
a1a2b35221 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-03-06 13:55:39 +00:00
Matt Kilgore
390b529da7 Test Middleware extender (#2017) 2020-03-06 14:55:21 +01:00
Franz Liedke
d30f2a0ca9 Merge pull request #2002 from flarum/fl/extender-tests
Start testing extenders
2020-02-14 18:47:58 +01:00
Clark Winkelmann
4350baa1f1 Rename dead is_activated references with the new is_email_confirmed (#1974) 2020-02-14 15:34:32 +01:00
Franz Liedke
12ff8dbcc3 Start testing Route extender 2020-02-08 00:04:32 +01:00
Franz Liedke
b2c3392a83 Integration tests: Allow registering extenders 2020-02-07 23:29:14 +01:00