This is a bit crude, but serves the purpose for now. To emulate an AJAX
request we set the `Content-Type` header to `application/json`, and json
encode the params in the body of the request.
To ensure tests don't step on each others toes, make sure we back up
the static properties of the global App class before running tests that
modify any of these properties.
Just use default values of 'text/html' and 0 for now. Should probably be
set to more realistic values at some point, but for now it seems to
work.
This fixes warnings in the OwaTest.
Introduce helper functions to access the various fields of the xchan
stored in `App::$observer'. This removes direct access to the attribute
from core, with the aim of allowing further refactoring later.
We can not yet make the `App::$observer` attribute private, though, as
it is also accessed directly by some addons.
If the /owa endpoint received a request with a missing or invalid
Authorization header, it would return an error to the requester, but
without any message describing why it failes.
This patch adds a message to the error response, so that it will be a
bit easier to debug these issues in the future.
The owa spec includes a 'message' field in the error response, but makes
it optional. Any conforming implementations should accept a response
that includes the 'message' field.
Only tests the delegate functionality at the moment.
This patch also includes some minor fixes to the Magic module, triggered
by the tests with empty destination URL's.
Just a basic test to ensure that the module `get()` method behaves
somewhat reasonable when no query params are given.
Had to make a small change to the Rpost module itself. Since the
`$_SESSION` superglobal may not always be set (and is not in the test),
use `isset` instead of `array_key_exists` to check if we have saved
query params in the session.
In general, isset is safer than array_key_exists if there's a chance
that the array itself may not exist.