Besides returning the last element, "end" also sets the internal pointer
of the array to the last element, and for that it receives a reference
to the array. Thus, "end(array_keys(..." can not be used, as it would
generate the Strict Standards error "Only variables should be passed by
reference", so the returned value from "array_keys" has to be stored in
a variable.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When running the integration tests through "run.sh" the parent directory
of the Spreed application must be the "apps" directory of an installed
Nextcloud server. Running the tests modifies the configuration and
database of that server, and the tests could fail too if the state of
its database conflicts with that expected by the tests.
The new "run-docker.sh" is a wrapper around "run.sh" that copies the
code (but not the configuration or data) of the Nextcloud server and its
applications to a Docker container, installs the Nextcloud server inside
the container (with a SQLite database), and then executes the
integration tests on the fresh server. This prevents the integration
tests from messing with the original Nextcloud server, and also ensures
that the integration tests will be run with a known initial state.
Besides that, when calling "run-docker.sh" the Docker image to be used
can be specified, so the tests can be easily run on PHP 5.6 or PHP 7.1
using "run-docker.sh --image nextcloudci/phpX.Y:phpX.Y-Z". If the
"--image" option is not given by default the image
"nextcloudci/php7.1:php7.1-15" will be used.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
As stated in the documentation for "uasort", "if two members compare as
equal, their relative order in the sorted array is undefined". "uasort"
is used in "RoomController" to sort the participants of a room by their
last ping, so when two participants have the same last ping they could
be returned in any order.
Although undefined, the order is probably consistent (so, whatever the
order is, it is the same between different executions for the same
data). When using PHP 7 the participants are sorted in the same order
that currently appears in the integration test definitions. However, PHP
5.6 uses a different order, so the tests fail in that case.
This commit adds sorting of the participants in a room returned by the
server, so they can be checked against the expected participant list no
matter the order used by the server; the list is sorted by default, but
that behaviour can be prevented adding ` [exact order]` to the
participant list in a test definition, so the participant list can be
checked in the exact order returned by the server too (for example, if
needed to check the participant list after setting the last ping for
them).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The "php7.1" and "php7.1-integration" tests are not actually being run
in Drone; when the command "more ./tests/autoconfig-oracle.php" is
executed by "core_install.sh" the execution of the remaining Drone
commands is broken (strange... probably some black magic related to TTYs
or something like that), and thus the tests are not run (although no
error is issued, so it wrongly seems that they were successful).
The problem occurs on CentOS based Docker images, but not on Debian
based ones. Therefore, the base images for the "php7.1" and
"php7.1-integration" tests were changed to use a newer version of the
"nextcloudci/php7.1" image, which is now based on Debian instead of
CentOS like the older ones.
This also removes the need of installing "wget", as it is already
included in the newer image too.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>