Commit Graph

48 Commits

Author SHA1 Message Date
Daniël Klabbers
c4a501f82a
Improved foundational backend unit tests (#1405)
* part one of adding tests, updating core

* Apply fixes from StyleCI

[ci skip] [skip ci]

* we need xdebug for code coverage, and hhvm was already removed

* forgot about the sidecar for mysql completely 🤦

* gitignore removed this installed json we need to fake that we have extensions

* using reguarded closure
2018-04-17 11:15:28 +02:00
Franz Liedke
e8d915850d
Fix test namespace 2018-03-04 00:04:43 +01:00
Franz Liedke
a061eda019
Change namespace of test classes
(as implemented by @luceos in his WIP PR)
2018-03-04 00:01:49 +01:00
Toby Zerner
1c1cefa017 Update test namespaces 2018-01-11 01:25:10 +10:30
Daniel Klabbers
4d9e2335c7 pleasing the angry god Circle 2017-11-27 11:05:15 +01:00
Daniel Klabbers
3f9dc81874 satisfying styleci, undo mysql in travis 2017-10-05 14:02:54 +02:00
Daniel Klabbers
1c01145a14 fixed those exception handling tests 2017-10-05 13:57:31 +02:00
Franz Liedke
66abd7ecfd
Extract new Flarum\Post namespace 2017-10-03 18:47:23 +02:00
Franz Liedke
6c9ff72efb
Finalize Flarum\Foundation namespace 2017-10-03 18:47:23 +02:00
Franz Liedke
564ea8ff73
Extract new Flarum\User namespace 2017-10-03 18:47:23 +02:00
Franz Liedke
9b24fbd5e5
Restructure Flarum\Api namespace 2017-10-03 18:45:40 +02:00
Toby Zerner
1031826a3d Apply fixes from StyleCI
[ci skip] [skip ci]
2016-11-29 05:03:53 +00:00
Toby Zerner
5f7291db39 Actually test IlluminateValidationExceptionHandler 2016-06-05 09:25:47 +09:30
Toby Zerner
f5988bae23 Distinguish between attributes/relationships in ValidationException
This exception could be a candidate for inclusion in tobscure/json-api...
2016-06-05 09:25:26 +09:30
Toby Zerner
6db27dff4f Move phpunit.xml into root to make PHPUnit easier to run
This seems to be pretty standard. Can just run `vendor/bin/phpunit` without any arguments. Removes the need for `composer test` (which is not ideal anyway as it removes colours from the output).
2016-06-05 09:16:29 +09:30
Daniel Klabbers
5a7b57df96 adding new tests to cover api handlers, part 1 of #245 and #74 2016-03-03 11:00:11 +01:00
Toby Zerner
a6cf10f854 Applied fixes from StyleCI 2016-02-25 22:09:39 -05:00
Toby Zerner
d743e56bc1 Fix tests and CS 2015-12-05 22:31:33 +10:30
Kirk Bushell
409a63d77a Added validation handler tests 2015-10-28 12:46:49 +00:00
Kirk Bushell
78f6249b24 Added tests for permission denied exception handler 2015-10-28 12:41:28 +00:00
Kirk Bushell
2edda9baaa Added model not found error handler tests 2015-10-28 12:39:38 +00:00
Kirk Bushell
1b3d674c39 Added tests for invalid confirmation token handling 2015-10-27 14:47:03 +00:00
Kirk Bushell
400aa4fef9 Added more tests 2015-10-27 13:22:30 +00:00
Kirk Bushell
a4ef9e7cf4 Added output test for flooding exception handler 2015-10-27 12:54:10 +00:00
Kirk Bushell
f230c72ebb Fied broken test 2015-10-27 12:50:11 +00:00
Kirk Bushell
f0883471ef Updated tests namespace to be ps4-valid. Added tests for flooding exception, fixed broken code 2015-10-27 12:48:27 +00:00
Toby Zerner
ddfedcb4dd Add Interface suffix to SettingsRepository 2015-10-19 14:58:47 +10:30
Toby Zerner
b53e612007 Fix failing tests + CS 2015-10-11 23:37:51 +10:30
Toby Zerner
dd67291ce0 Major refactor and improvements
- Reorganised all namespaces and class names for consistency and structure. Following PSR bylaws (Abstract prefix, Interface/Trait suffix).
  - Move models into root of Core, because writing `use Flarum\Core\Discussion` is nice. Namespace the rest by type. (Namespacing by entity was too arbitrary.)
  - Moved some non-domain stuff out of Core: Database, Formatter, Settings.
  - Renamed config table and all references to "settings" for consistency.
  - Remove Core class and add url()/isInstalled()/inDebugMode() as instance methods of Foundation\Application.
  - Cleanup, docblocking, etc.

- Improvements to HTTP architecture
  - API and forum/admin Actions are now actually all the same thing (simple PSR-7 Request handlers), renamed to Controllers.
  - Upgrade to tobscure/json-api 0.2 branch.
  - Where possible, moved generic functionality to tobscure/json-api (e.g. pagination links). I'm quite happy with the backend balance now re: #262

- Improvements to other architecture
  - Use Illuminate's Auth\Access\Gate interface/implementation instead of our old Locked trait. We still use events to actually determine the permissions though. Our Policy classes are actually glorified event subscribers.
  - Extract model validation into Core\Validator classes.
  - Make post visibility permission stuff much more efficient and DRY.

- Renamed Flarum\Event classes for consistency. ref #246
  - `Configure` prefix for events dedicated to configuring an object.
  - `Get` prefix for events whose listeners should return something.
  - `Prepare` prefix when a variable is passed by reference so it can be modified.
  - `Scope` prefix when a query builder is passed.

- Miscellaneous improvements/bug-fixes. I'm easily distracted!
  - Increase default height of post composer.
  - Improve post stream redraw flickering in Safari by keying loading post placeholders with their IDs. ref #451
  - Use a PHP JavaScript minification library for minifying TextFormatter's JavaScript, instead of ClosureCompilerService (can't rely on external service!)
  - Use UrlGenerator properly in various places. closes #123
  - Make Api\Client return Response object. closes #128
  - Allow extensions to specify custom icon images.
  - Allow external API/admin URLs to be optionally specified in config.php. If the value or "url" is an array, we look for the corresponding path inside. Otherwise, we append the path to the base URL, using the corresponding value in "paths" if present. closes #244
2015-10-08 14:28:02 +10:30
kirkbushell
b179ca1c48 Added tests for admin login/cookie checks 2015-09-28 16:02:37 +01:00
kirkbushell
c3374197d1 Added zend-stragility (missing), removed some redundant code. 2015-09-28 15:59:07 +01:00
kirkbushell
a00226c05a Added some tests for the database setting repository 2015-09-28 15:34:32 +01:00
kirkbushell
7706714ad9 Removed phpsec as the testing library, added phpunit and converted the first spec test to phpunit format. Also added mockery. 2015-09-28 15:09:13 +01:00
Toby Zerner
7706914b33 Get rid of Codeception for now
There's nothing in there that's of value.
2015-07-18 10:55:30 +09:30
Franz Liedke
d1cd4b174b Remove last remaining usage of DB facade 2015-06-09 02:40:02 +02:00
Maksim Knyshov
1bd69f80c7 Remove unneeded .gitkeep's 2015-03-31 22:38:15 +03:00
Toby Zerner
2c46888db5 Upgrade to L5 + huge refactor + more. closes #2
New stuff:
- Signup + email confirmation.
- Updated authentication strategy with remember cookies. closes #5
- New search system with some example gambits! This is cool - check out
the source. Fulltext drivers will be implemented as decorators
overriding the EloquentPostRepository’s findByContent method.
- Lay down the foundation for bootstrapping the Ember app.
- Update Web layer’s asset manager to properly publish CSS/JS files.
- Console commands to run installation migrations and seeds.

Refactoring:
- New structure: move models, repositories, commands, and events into
their own namespaces, rather than grouping by entity.
- All events are classes.
- Use L5 middleware and command bus implementations.
- Clearer use of repositories and the Active Record pattern.
Repositories are used only for retrieval of ActiveRecord objects, and
then save/delete operations are called directly on those ActiveRecords.
This way, we don’t over-abstract at the cost of Eloquent magic, but
testing is still easy.
- Refactor of Web layer so that it uses the Actions routing
architecture.
- “Actor” concept instead of depending on Laravel’s Auth.
- General cleanup!
2015-02-24 20:33:18 +10:30
Toby Zerner
28d213d868 Implement discussion composition and creation 2015-02-06 14:07:15 +10:30
Toby Zerner
e37d3743ed Use our own token instead of Laravel's
Laravel’s remember_token is tied to the session/cookies, which we don’t
need as the API is stateless. It makes much more sense to use our own
token mechanism.
2015-01-30 12:08:02 +10:30
Toby Zerner
b57a8d3bc2 Improve auth API tests 2015-01-23 15:24:38 +10:30
Toby Zerner
ad269fdb5a Implement token-based auth API 2015-01-22 14:44:33 +10:30
Allineer
823a3f0e82 [proposal] cameCase in the test names
Sorry :)
2015-01-22 01:42:47 +03:00
Toby Zerner
21863759e6 Improve discussions API tests 2015-01-21 12:23:10 +10:30
Toby Zerner
c91c1518d5 Integration tests for DiscussionRepository
Also add some TestDummy factories (needs more work)
2015-01-21 12:22:20 +10:30
Toby Zerner
586cb9b00d Update todo list, add screenshot 2015-01-20 15:07:38 +10:30
Toby Zerner
2fcb1dc7c8 Begin testing API (see #3) 2015-01-19 20:46:14 +10:30
Mike Dugan
bf94197dcd add codeception, update gitignore 2014-12-22 08:28:01 -05:00
Toby Zerner
74db323f83 Hello world! 2014-12-20 16:56:46 +10:30