cms/tests/Integration
Allon Moritz 7611824c5c
Move API system tests to cypress (#40135)
* tests

* api

* artiucles crud

* banners

* contact

* media

* media

* Remove codeception

* cs

* more traces of codeception

* readd certs

* dependencies

* more deps

* secret

* cs

* better doc

* write

* config workaround

* cs

* revert

* prepare db for api tests

* variable

* revert pool

* end connections

* no limit

* cs

* prefix

* Update tests/cypress/drone-system-run.sh

* run specific specs in drone

* Update tests/README.md

Co-authored-by: Brian Teeman <brian@teeman.net>

* Update tests/cypress/integration/api/com_media/Files.cy.js

Co-authored-by: Brian Teeman <brian@teeman.net>

* Update tests/cypress/integration/api/com_media/Files.cy.js

Co-authored-by: Brian Teeman <brian@teeman.net>

* postgres

* media on postgres

* sign

* cs

* remove more traces

* basic api tests

* cleanup

* path

* run recursive specs

* chmod images folder

* path to cms

* correct dependencies and better cleanup

* cleaner deps

* Update tests/cypress/drone-system-run.sh

Co-authored-by: Brian Teeman <brian@teeman.net>

* missing fields

* stabilize cleanup

* cs

* secret in install test

* order of tests

* optimize cleanup

* cs

* cache the connection

* revert connection cache

* docs

* Rename cypress to system

* lint

* simplification and docs

* docs

* better cleanup

* move

* merge conflict

* remove redundant connect

---------

Co-authored-by: Brian Teeman <brian@teeman.net>
2023-03-20 09:51:42 +01:00
..
Libraries/Cms/Table Fixes various code style issues and integrate PHP CS Fixer into drone (#39745) 2023-01-31 11:20:05 +01:00
Plugin/Authentication/Ldap Optimizing import statements (#39984) 2023-03-08 00:12:14 -05:00
datasets [4.0] Remove display widths for integer data types from SQL scripts for MySQL and MariaDB databases (#32608) 2021-05-02 23:16:29 +01:00
DBTestHelper.php Fixes various code style issues and integrate PHP CS Fixer into drone (#39745) 2023-01-31 11:20:05 +01:00
DBTestInterface.php [4.2] Convert tests to PSR-12 (#38161) 2022-06-28 09:43:33 +02:00
DBTestTrait.php [4.2] Convert tests to PSR-12 (#38161) 2022-06-28 09:43:33 +02:00
IntegrationTestCase.php Introduce an Ldap factory in the authentication plugin (#39661) 2023-01-27 20:44:36 -05:00
README.md Move API system tests to cypress (#40135) 2023-03-20 09:51:42 +01:00

README.md

Integration Tests for Joomla 4.x

This folder contains the integration tests for the Joomla CMS. The tests are run with phpunit and the actual tests.

How to run the tests

When you are checking out the current development branch of 4.x and run composer install, your system is automatically set up to run the tests. The steps thus are the following:

  1. Checkout the current Joomla 4.x development branch from Github. (https://github.com/joomla/joomla-cms.git)
  2. Run composer install in the root of your checkout.
  3. Copy ./phpunit.xml.dist to ./phpunit.xml. Edit configuration file ./phpunit.xml. Within the <php> adapt the value of JTEST_DB_ENGINE (mysqli or pgsql), JTEST_DB_HOST, JTEST_DB_NAME, JTEST_DB_USER, and JTEST_DB_PASSWORD to your local environment.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/Unit/bootstrap.php" colors="false">
	<testsuites>
		<testsuite name="Unit">
			<directory suffix="Test.php">./tests/Unit</directory>
		</testsuite>
		<testsuite name="Integration">
			<directory suffix="Test.php">./tests/Integration</directory>
		</testsuite>
	</testsuites>
	<php>
		<const name="JTEST_DB_ENGINE" value="mysqli" />
		<const name="JTEST_DB_HOST" value="localhost" />
		<const name="JTEST_DB_NAME" value="joomla_db" />
		<const name="JTEST_DB_USER" value="Your DB user" />
		<const name="JTEST_DB_PASSWORD" value="Your Password" />
		...
	</php>
</phpunit>
  1. Run an openldap docker image and/or configure the ldap settings in ./phpunit.xml.
    • If you set JTEST_LDAP_HOST to localhost (or change your hosts file so "openldap" points to the ip where the service listens for connections), the following command should give you a working configuration. If needed, replace $(pwd) with the path to where the docker service can access the Joomla root. docker run --rm --name openldap --env LDAP_ADMIN_USERNAME=admin --env LDAP_ADMIN_PASSWORD=adminpassword --env LDAP_USERS=customuser --env LDAP_PASSWORDS=custompassword --publish 1389:1389 --publish 1636:1636 --env LDAP_ENABLE_TLS=yes --env LDAP_TLS_CERT_FILE=/opt/bitnami/certs/openldap.crt --env LDAP_TLS_KEY_FILE=/opt/bitnami/certs/openldap.key --env LDAP_TLS_CA_FILE=/opt/bitnami/certs/CA.crt --env LDAP_CONFIG_ADMIN_ENABLED=yes --env LDAP_CONFIG_ADMIN_USERNAME=admin --env LDAP_CONFIG_ADMIN_PASSWORD=configpassword --env BITNAMI_DEBUG=true -v $(pwd)/tests/certs:/opt/bitnami/certs bitnami/openldap:latest
    • If your ldap server supports "None", "STARTTLS" and "SSL/TLS" encryption and works with both "Bind and Search" and "Bind Directly as User" methods, you can use your own if you configure the JTEST_LDAP_ directives in your phpunit.xml file according to your environment.
    • If you do not want to run the docker openldap image and don't have an LDAP server running, you can skip the LDAP tests if you set JTEST_LDAP_HOST to an empty value.
  2. Run ./libraries/vendor/bin/phpunit --testsuite Integration.

You should now see on the command line something like this:

$ ./libraries/vendor/bin/phpunit --testsuite Integration
PHPUnit 8.3.4 by Sebastian Bergmann and contributors.

........                                                            8 / 8 (100%)

Time: 155 ms, Memory: 10.00 MB

OK (8 tests, 33 assertions)

If you configured your environment for the integration tests, you can run integration and unit tests at once, using ./libraries/vendor/bin/phpunit.