friendica/tests
Art4 ea07b83fd0 adjust tests 2024-12-20 13:21:35 +00:00
..
Unit adjust tests 2024-12-20 13:21:35 +00:00
Util Remove unused AppDouble class 2024-12-15 22:15:46 +00:00
datasets Refactor tests for Util\Crypto 2024-11-09 23:50:06 +00:00
functional rename FixtureTest to FixtureTestCase 2024-12-14 07:55:22 +00:00
src replace more calls of DI::app(), add workaround for tests 2024-12-18 21:19:01 +00:00
ApiTestCase.php remove unnecessary Di::app() all 2024-12-18 19:57:00 +00:00
CacheTestCase.php Rename CacheTest to CacheTestCase 2024-12-15 21:06:49 +00:00
ConsoleTestCase.php Rename ConsoleTest to ConsoleTestCase 2024-12-14 08:16:37 +00:00
DatabaseTestCase.php rename DatabaseTest to DatabaseTestCase 2024-12-14 07:55:22 +00:00
DatabaseTestTrait.php REUSE tests directory 2024-08-24 14:31:41 +02:00
DiceHttpMockHandlerTrait.php REUSE tests directory 2024-08-24 14:31:41 +02:00
FixtureTestCase.php rename FixtureTest to FixtureTestCase 2024-12-14 07:55:22 +00:00
FixtureTestTrait.php REUSE tests directory 2024-08-24 14:31:41 +02:00
LockTestCase.php Rename LockTest to LockTestCase 2024-12-15 21:15:21 +00:00
LoggerDataTrait.php Rename AbstractLoggerTest to LoggerTestCase 2024-12-15 21:28:34 +00:00
LoggerTestCase.php Rename AbstractLoggerTest to LoggerTestCase 2024-12-15 21:28:34 +00:00
MemoryCacheTestCase.php Rename MemoryCacheTest to MemoryCacheTestCase 2024-12-15 21:09:57 +00:00
MockedTestCase.php Rename MockedTest to MockedTestCase 2024-12-14 07:55:22 +00:00
PConfigTestCase.php Rename PConfigTest to PConfigTestCase 2024-12-15 16:13:53 +00:00
README.md update testing documentation 2024-04-14 11:11:00 +02:00
StorageConfigTestCase.php rename StorageConfigTest to StorageConfigTestCase 2024-12-15 21:32:23 +00:00
StorageTestCase.php Rename StorageTest with StorageTestCase 2024-12-15 21:36:40 +00:00
bootstrap.php REUSE tests directory 2024-08-24 14:31:41 +02:00
phpunit-addons.xml Move Cache to strategies 2023-07-26 19:17:43 +02:00
phpunit.xml Add suffix for PHPUnit test cases 2024-12-14 07:55:22 +00:00

README.md

Using the Friendica tests

Install Tools

You need to install the following software:

  • PHP
  • MySQL or Mariadb (the latter is preferred)

For example in Ubuntu you can run:

sudo apt install mariadb-server php

Install PHP extensions

The following extensions must be installed:

  • MySQL
  • Curl
  • GD
  • XML
  • DOM
  • SimpleXML
  • Intl
  • Multi-precision
  • Multi-byte string

For example in Ubuntu:

sudo apt install php-mysql php-curl php-gd php-xml php-intl php-gmp php-mbstring

Create Local Database

The default database name is test, username friendica, password friendica. These can be overridden using environment variables DATABASE_NAME, DATABASE_USER, DATABASE_HOST, and DATABASE_PASSWORD. Whatever settings you choose, you must give the corresponding user the necessary privileges to create and destroy the chosen database.

GRANT ALL PRIVILEGES ON test.* TO 'friendica'@'localhost' IDENTIFIED BY 'friendica' WITH GRANT OPTION;
GRANT CREATE, DROP ON test.* TO 'friendica'@'localhost';

Use Docker Database

Instead of using a local database, you can also use a database running in a docker container.

TODO this section needs to be filled in with working examples.

Running Tests

You can then run the tests using the autotest.sh script. You should specify the type of database as an argument, either mysql or mariadb:

bin/dev/autotest.sh mariadb

You can also run just one particular file of tests:

bin/dev/autotest.sh mariadb src/Util/ImagesTest.php

Example output of tests passing:

OK (2 tests, 2 assertions)

Failed tests look like this. Examine the output before this to see which tests failed.

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.