-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create unit tests for existing functions (#8)
- Loading branch information
1 parent
26f82ad
commit d04f93d
Showing
18 changed files
with
1,116 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
uses: php-actions/composer@v6 | ||
with: | ||
php_version: 8.3 | ||
command: update | ||
php_extensions: ldap xdebug | ||
- name: PHPUnit Tests for php8.3 | ||
uses: php-actions/phpunit@v3 | ||
env: | ||
XDEBUG_MODE: coverage | ||
with: | ||
configuration: phpunit.xml | ||
version: latest | ||
php_version: 8.3 | ||
php_extensions: ldap xdebug | ||
args: --coverage-text | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"> | ||
<testsuites> | ||
<testsuite name="main"> | ||
<directory suffix="Test.php">tests/Ltb</directory> | ||
</testsuite> | ||
</testsuites> | ||
<logging/> | ||
<source> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ACCCONFIGROOTPW=secret | ||
ACCDATAROOTPW=secret | ||
ADMIN_LDAP_PASSWORD=secret | ||
CUSTOMERID=acme | ||
FUSIONDIRECTORY_LDAP_PASSWORD=secret | ||
FUSIONDIRECTORY_LDAP_USERNAME=fd | ||
LSC_LDAP_PASSWORD=secret | ||
LSC_LDAP_USERNAME=lsc | ||
LDAP_PROTO=ldap | ||
LDAP_HOST=ltb-directory-server | ||
LDAP_PORT=33389 | ||
LDAP_SUFFIX=dc=fusioniam,dc=org | ||
LEMONLDAP2_LDAP_PASSWORD=secret | ||
LEMONLDAP2_LDAP_USERNAME=lemonldapng | ||
SERVICEDESK_LDAP_PASSWORD=secret | ||
SERVICEDESK_LDAP_USERNAME=sd | ||
WHITEPAGES_LDAP_PASSWORD=secret | ||
WHITEPAGES_LDAP_USERNAME=wp | ||
LDAP_TLS= | ||
LDAP_CERTIFICATE_FILE=/usr/local/openldap/etc/openldap/tls/cert.pem | ||
LDAP_CERTIFICATE_KEY=/usr/local/openldap/etc/openldap/tls/key.pem | ||
LDAP_TLS_PROTOCOL_MIN=3.4 | ||
LDAP_TLS_CIPHER_SUITE=HIGH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
# Which container to choose: podman by default, else docker | ||
CTN="docker" | ||
PWD=$( pwd ) | ||
|
||
|
||
ID=$( id -u ) | ||
# fusioniam default user id in container | ||
MYUID=1000 | ||
# fusioniam default group id in container | ||
MYGID=1000 | ||
# uidmap format: rootless user: container_uid:intermediate_uid:amount | ||
# rootful user: container_uid:host_uid:amount | ||
# rootless user: | ||
# map podman user uid (0) to fusioniam container uid (1000) + map lowest user uid in /etc/subuid (1) to root container uid (0) | ||
# rootful user: | ||
# map root (0) to fusioniam container uid (1000) + map user uid 100000 to root container uid (0) | ||
UIDMAP=$( [ "$CTN" = "podman" ] && if [ $(ID) -eq 0 ]; then echo "--uidmap $MYUID:0:1 --uidmap 0:100000:1"; else echo "--uidmap $MYUID:0:1 --uidmap 0:1:1"; fi || echo "" ) | ||
GIDMAP=$( [ "$CTN" = "podman" ] && if [ $(ID) -eq 0 ]; then echo "--gidmap $MYGID:0:1 --gidmap 0:100000:1"; else echo "--gidmap $MYGID:0:1 --gidmap 0:1:1"; fi || echo "" ) | ||
|
||
|
||
|
||
# Get OpenLDAP-LTB docker image before running tests | ||
$CTN pull gitlab.ow2.org:4567/fusioniam/fusioniam/fusioniam-openldap-ltb:snapshot | ||
|
||
# run docker image | ||
mkdir -p run/volumes/ldap-data run/volumes/ldap-config | ||
$CTN run \ | ||
--env-file=./run/ENVVAR.example \ | ||
-v $PWD/run/volumes/ldap-data:/usr/local/openldap/var/openldap-data \ | ||
-v $PWD/run/volumes/ldap-config:/usr/local/openldap/etc/openldap/slapd.d \ | ||
-v $PWD/run/volumes/ldap-tls:/usr/local/openldap/etc/openldap/tls \ | ||
--rm=true \ | ||
--network-alias=ltb-directory-server \ | ||
-p 127.0.0.1:33389:33389 \ | ||
--name=ltb-directory-server \ | ||
--detach=true \ | ||
$UIDMAP \ | ||
$GIDMAP \ | ||
gitlab.ow2.org:4567/fusioniam/fusioniam/fusioniam-openldap-ltb:snapshot | ||
|
||
# Check when started | ||
while ! $CTN logs ltb-directory-server 2>&1 | grep -q "slapd starting"; | ||
do | ||
# Wait for docker container to be up and running | ||
echo "slapd starting, please wait" | ||
sleep 1 | ||
done | ||
|
||
|
||
# Run tests | ||
echo "Starting tests" | ||
vendor/bin/phpunit tests/IntegrationTests | ||
|
||
# Stop and remove openldap container and volumes | ||
$CTN stop ltb-directory-server | ||
rm -rf run/volumes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.